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

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

Issue 1149043005: [destructuring] Grand for statement parsing unification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase feedback Created 5 years, 7 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/pattern-rewriter.cc ('k') | test/mjsunit/es6/debug-stepnext-for.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 659680d8288989917b64a7a2cadd9510b7d2e1f4..c7b044d7192631637e14417226e01d4e872ac185 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6525,6 +6525,32 @@ TEST(DestructuringNegativeTests) {
}
+TEST(DestructuringDisallowPatternsInForVarIn) {
+ i::FLAG_harmony_destructuring = true;
+ static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
+ const char* context_data[][2] = {
+ {"", ""}, {"function f() {", "}"}, {NULL, NULL}};
+ // clang-format off
+ const char* error_data[] = {
+ "for (var {x} = {} in null);",
+ "for (var {x} = {} of null);",
+ "for (let x = {} in null);",
+ "for (let x = {} of null);",
+ NULL};
+ // clang-format on
+ RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+
+ // clang-format off
+ const char* success_data[] = {
+ "for (var x = {} in null);",
+ NULL};
+ // clang-format on
+ RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+}
+
+
TEST(SpreadArray) {
i::FLAG_harmony_spread_arrays = true;
« no previous file with comments | « src/pattern-rewriter.cc ('k') | test/mjsunit/es6/debug-stepnext-for.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698