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

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

Issue 713413003: harmony-scoping: better error messages for let declarations in sloppy mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing Created 6 years, 1 month 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') | test/mjsunit/harmony/block-non-strict-errors.js » ('j') | 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 2f42eadc84fba4774f810db86765090a8e7351cb..a36bd92763270a4b839b43d5e5a9ead34f645b7b 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -4432,3 +4432,28 @@ TEST(ScanUnterminatedTemplateLiterals) {
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
}
+
+
+TEST(LexicalScopingSloppyMode) {
+ const char* context_data[][2] = {
+ {"", ""},
+ {"function f() {", "}"},
+ {"{", "}"},
+ {NULL, NULL}};
+ const char* bad_data[] = {
+ "let x = 1;",
+ "for(let x = 1;;){}",
+ "for(let x of []){}",
+ "for(let x in []){}",
+ NULL};
+ static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
+ RunParserSyncTest(context_data, bad_data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+
+ const char* good_data[] = {
+ "let = 1;",
+ "for(let = 1;;){}",
+ NULL};
+ RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+}
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/harmony/block-non-strict-errors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698