| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 5a2ee1303852b9ab440351b8f16b9f67fdec81db..c88b2dc4464193b2cd4eee714f35df26dd50af3b 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -2472,3 +2472,57 @@ TEST(TooManyArguments) {
|
| static const ParserFlag empty_flags[] = {kAllowLazy};
|
| RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1);
|
| }
|
| +
|
| +
|
| +TEST(StrictDelete) {
|
| + // "delete <Identifier>" is not allowed in strict mode.
|
| + const char* strict_context_data[][2] = {
|
| + {"\"use strict\"; ", ""},
|
| + { NULL, NULL }
|
| + };
|
| +
|
| + const char* sloppy_context_data[][2] = {
|
| + {"", ""},
|
| + { NULL, NULL }
|
| + };
|
| +
|
| + // These are errors in the strict mode.
|
| + const char* sloppy_statement_data[] = {
|
| + "delete foo;",
|
| + "delete foo + 1;",
|
| + "delete (foo);",
|
| + "delete eval;",
|
| + "delete interface;",
|
| + NULL
|
| + };
|
| +
|
| + // These are always OK
|
| + const char* good_statement_data[] = {
|
| + "delete this;",
|
| + "delete 1;",
|
| + "delete 1 + 2;",
|
| + "delete foo();",
|
| + "delete foo.bar;",
|
| + "delete foo[bar];",
|
| + "delete foo--;",
|
| + "delete --foo;",
|
| + "delete new foo();",
|
| + "delete new foo(bar);",
|
| + NULL
|
| + };
|
| +
|
| + // These are always errors
|
| + const char* bad_statement_data[] = {
|
| + "delete if;",
|
| + NULL
|
| + };
|
| +
|
| + RunParserSyncTest(strict_context_data, sloppy_statement_data, kError);
|
| + RunParserSyncTest(sloppy_context_data, sloppy_statement_data, kSuccess);
|
| +
|
| + RunParserSyncTest(strict_context_data, good_statement_data, kSuccess);
|
| + RunParserSyncTest(sloppy_context_data, good_statement_data, kSuccess);
|
| +
|
| + RunParserSyncTest(strict_context_data, bad_statement_data, kError);
|
| + RunParserSyncTest(sloppy_context_data, bad_statement_data, kError);
|
| +}
|
|
|