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

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

Issue 2185223002: Fix not throwing error when redefine eval or arguments in strict mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Clean up tests Created 4 years, 4 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/parsing/parser-base.h ('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 12c6a4012d2e1d5a8422e464af1c56af519e3dea..2b8e0fb3a6c8869409a51280d1395b15065ee832 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6342,9 +6342,46 @@ TEST(DestructuringPositiveTests) {
"[...rest]",
"[a,b,...rest]",
"[a,,...rest]",
+ "{arguments: x}",
+ "{eval: x}",
NULL};
// clang-format on
RunParserSyncTest(context_data, data, kSuccess);
+
+ // v8:5201
+ // TODO(lpy): The two test sets below should be merged once
+ // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577
+ {
+ const char* sloppy_context_data1[][2] = {
+ {"var ", " = {};"},
+ {"function f(", ") {}"},
+ {"function f(argument1, ", ") {}"},
+ {"var f = (", ") => {};"},
+ {"var f = (argument1,", ") => {};"},
+ {"try {} catch(", ") {}"},
+ {NULL, NULL}
+ };
+ const char* data1[] = {
+ "{eval}",
+ "{x: eval}",
+ "{eval = false}",
+ NULL
+ };
+ RunParserSyncTest(sloppy_context_data1, data1, kSuccess);
+
+ const char* sloppy_context_data2[][2] = {
+ {"var ", " = {};"},
+ {"try {} catch(", ") {}"},
+ {NULL, NULL}
+ };
+ const char* data2[] = {
+ "{arguments}",
+ "{x: arguments}",
+ "{arguments = false}",
+ NULL,
+ };
+ RunParserSyncTest(sloppy_context_data2, data2, kSuccess);
+ }
}
@@ -6457,6 +6494,7 @@ TEST(DestructuringNegativeTests) {
{ // Strict mode.
const char* context_data[][2] = {
+ {"'use strict'; var ", " = {};"},
{"'use strict'; let ", " = {};"},
{"'use strict'; const ", " = {};"},
{"'use strict'; function f(", ") {}"},
@@ -6465,10 +6503,18 @@ TEST(DestructuringNegativeTests) {
// clang-format off
const char* data[] = {
+ "[arguments]",
"[eval]",
"{ a : arguments }",
+ "{ a : eval }",
"[public]",
"{ x : private }",
+ "{ x : arguments }",
+ "{ x : eval }",
+ "{ arguments }",
+ "{ eval }",
+ "{ arguments = false }"
+ "{ eval = false }",
NULL};
// clang-format on
RunParserSyncTest(context_data, data, kError);
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698