| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 4dd797105d0d575922ec2deb9c020a052131a55d..85b2f3c4002c50a051d6604f59b968be6cba0fd2 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -1940,3 +1940,40 @@ TEST(DontRegressPreParserDataSizes) {
|
| CHECK(!data.has_error());
|
| }
|
| }
|
| +
|
| +
|
| +TEST(FunctionDeclaresItselfStrict) {
|
| + // Tests that we produce the right kinds of errors when a function declares
|
| + // itself strict (we cannot produce there errors as soon as we see the
|
| + // offending identifiers, because we don't know at that point whether the
|
| + // function is strict or not).
|
| + const char* context_data[][2] = {
|
| + {"function eval() {", "}"},
|
| + {"function arguments() {", "}"},
|
| + {"function yield() {", "}"},
|
| + {"function interface() {", "}"},
|
| + {"function foo(eval) {", "}"},
|
| + {"function foo(arguments) {", "}"},
|
| + {"function foo(yield) {", "}"},
|
| + {"function foo(interface) {", "}"},
|
| + {"function foo(bar, eval) {", "}"},
|
| + {"function foo(bar, arguments) {", "}"},
|
| + {"function foo(bar, yield) {", "}"},
|
| + {"function foo(bar, interface) {", "}"},
|
| + {"function foo(bar, bar) {", "}"},
|
| + { NULL, NULL }
|
| + };
|
| +
|
| + const char* strict_statement_data[] = {
|
| + "\"use strict\";",
|
| + NULL
|
| + };
|
| +
|
| + const char* non_strict_statement_data[] = {
|
| + ";",
|
| + NULL
|
| + };
|
| +
|
| + RunParserSyncTest(context_data, strict_statement_data, kError);
|
| + RunParserSyncTest(context_data, non_strict_statement_data, kSuccess);
|
| +}
|
|
|