Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index f2b82ccf9811107ef798d3666b9c897a515f8aff..3e24f9f68c8c6c455f80503e39b98ac0c6131301 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -3797,9 +3797,9 @@ TEST(ClassExpressionNoErrors) { |
TEST(ClassDeclarationNoErrors) { |
- const char* context_data[][2] = {{"", ""}, |
- {"{", "}"}, |
- {"if (true) {", "}"}, |
+ const char* context_data[][2] = {{"'use strict'; ", ""}, |
+ {"'use strict'; {", "}"}, |
+ {"'use strict'; if (true) {", "}"}, |
{NULL, NULL}}; |
const char* statement_data[] = { |
"class name {}", |
@@ -3810,7 +3810,7 @@ TEST(ClassDeclarationNoErrors) { |
NULL}; |
static const ParserFlag always_flags[] = { |
- kAllowHarmonyClasses, kAllowHarmonySloppy}; |
+ kAllowHarmonyClasses, kAllowHarmonyScoping}; |
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, |
always_flags, arraysize(always_flags)); |
} |
@@ -4668,3 +4668,26 @@ TEST(ComputedPropertyNameShorthandError) { |
RunParserSyncTest(context_data, error_data, kError, NULL, 0, |
always_flags, arraysize(always_flags)); |
} |
+ |
+ |
+TEST(DeclarationsError) { |
+ const char* context_data[][2] = {{"'use strict'; if (true)", ""}, |
+ {"'use strict'; if (false) {} else", ""}, |
+ {"'use strict'; while (false)", ""}, |
+ {"'use strict'; for (;;)", ""}, |
+ {"'use strict'; for (x in y)", ""}, |
+ {"'use strict'; do ", " while (false)"}, |
+ {NULL, NULL}}; |
+ |
+ const char* statement_data[] = { |
+ "let x = 1;", |
+ "const x = 1;", |
+ "class C {}", |
+ NULL}; |
+ |
+ static const ParserFlag always_flags[] = { |
+ kAllowHarmonyClasses, kAllowHarmonyScoping |
+ }; |
+ RunParserSyncTest(context_data, statement_data, kError, NULL, 0, |
+ always_flags, arraysize(always_flags)); |
+} |