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

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

Issue 671913002: harmony-scoping: Allow 'const' iteration variables in strict mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 700d104a51a396bfb11ba922e777b373e573fedc..ee6ff27ef5027a2344ae77ebfabf40eb2979dcad 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -4205,3 +4205,34 @@ TEST(ObjectLiteralPropertyShorthandYieldInGeneratorError) {
RunParserSyncTest(context_data, name_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
}
+
+
+TEST(ConstParsingInForIn) {
+ const char* context_data[][2] = {{"'use strict';", ""},
+ {"function foo(){ 'use strict';", "}"},
+ {NULL, NULL}};
+
+ const char* data[] = {"for(const x = 1; ; ) {}", "for(const x in [1,2,3]) {}",
rossberg 2014/10/23 09:44:54 Add a case like "for (const x = 1, y = 2; ; )".
Dmitry Lomov (no reviews) 2014/10/23 10:33:34 Done.
+ "for(const x of [1,2,3]) {}", NULL};
+ static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
+ RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+}
+
+
+TEST(ConstParsingInForInError) {
+ const char* context_data[][2] = {{"'use strict';", ""},
+ {"function foo(){ 'use strict';", "}"},
+ {NULL, NULL}};
+
+ const char* data[] = {
+ "for(const x,y = 1; ; ) {}",
+ "for(const x = 4 in [1,2,3]) {}",
+ "for(const x = 4, y in [1,2,3]) {}",
+ "for(const x = 4 of [1,2,3]) {}",
+ "for(const x = 4, y of [1,2,3]) {}",
rossberg 2014/10/23 09:44:54 Add "for (const x, y in/of [])".
Dmitry Lomov (no reviews) 2014/10/23 10:33:34 Done.
+ NULL};
+ static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
+ RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+}

Powered by Google App Engine
This is Rietveld 408576698