Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: test/cctest/test-parsing.cc

Issue 869293002: Lexical declarations should not be allowed in Statement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unused error messages Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 034a0b951739f132f19e7787121ae8dd00a27ce7..2d72e3b990a386886739267ddcde86e12dc9247e 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3788,9 +3788,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 {}",
@@ -3801,7 +3801,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));
}
@@ -4831,3 +4831,26 @@ TEST(DuplicateProtoNoError) {
RunParserSyncTest(context_data, error_data, kSuccess, 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));
+}
« no previous file with comments | « src/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698