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

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

Issue 1146683002: [destructuring] Implement initializers in patterns. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased onto ToT 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/preparser.h ('k') | test/mjsunit/harmony/destructuring.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 c10f5405e661f0be0b68005658efb57b04a6dd0c..16f0cf37494e59df333f881827b897949d3218af 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6366,21 +6366,35 @@ TEST(DestructuringPositiveTests) {
const char* data[] = {
"a",
"{ x : y }",
+ "{ x : y = 1 }",
"[a]",
+ "[a = 1]",
"[a,b,c]",
+ "[a, b = 42, c]",
"{ x : x, y : y }",
+ "{ x : x = 1, y : y }",
+ "{ x : x, y : y = 42 }",
"[]",
"{}",
"[{x:x, y:y}, [a,b,c]]",
+ "[{x:x = 1, y:y = 2}, [a = 3, b = 4, c = 5]]",
+ "{x}",
+ "{x, y}",
+ "{x = 42, y = 15}",
"[a,,b]",
"{42 : x}",
+ "{42 : x = 42}",
"{42e-2 : x}",
+ "{42e-2 : x = 42}",
"{'hi' : x}",
+ "{'hi' : x = 42}",
"{var: x}",
+ "{var: x = 42}",
"{}",
NULL};
// clang-format on
- static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
+ static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals,
+ kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
}
@@ -6388,7 +6402,8 @@ TEST(DestructuringPositiveTests) {
TEST(DestructuringNegativeTests) {
i::FLAG_harmony_destructuring = true;
- static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring};
+ static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals,
+ kAllowHarmonyDestructuring};
{ // All modes.
const char* context_data[][2] = {{"'use strict'; let ", " = {};"},
@@ -6440,6 +6455,10 @@ TEST(DestructuringNegativeTests) {
"var",
"[var]",
"{x : {y : var}}",
+ "{x : x = a+}",
+ "{x : x = (a+)}",
+ "{x : x += a}",
+ "{m() {} = 0}",
NULL};
// clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/harmony/destructuring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698