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

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 and rebase 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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 12c6a4012d2e1d5a8422e464af1c56af519e3dea..a54688f5fc69fdad41a0f85932fa58e6b79a3d33 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6345,6 +6345,37 @@ TEST(DestructuringPositiveTests) {
NULL};
// clang-format on
RunParserSyncTest(context_data, data, kSuccess);
+
+ // v8:5201
+ {
+ const char* sloppy_context_data[][2] = {
+ {"", ""},
+ {NULL, NULL}
+ };
+ const char* data1[] = {
+ "var {arguments} = {}",
+ "var {eval} = {}",
+ "var {x: arguments} = {x: 5}",
+ "var {x: eval} = {x: 5}",
+ "function f({eval = false } = {}) {}",
+ "function f(argument1, {eval = false} = {}) {}",
+ "function f(argument1, {eval} = {}) {}",
adamk 2016/08/19 18:14:56 Rather than enumerating different surrounding stuf
lpy 2016/08/19 18:58:17 Done.
+ NULL,
+ };
+ RunParserSyncTest(sloppy_context_data, data1, kSuccess);
+
+ const char* empty_context_data[][2] = {
+ {"'use strict';", ""},
+ {"", ""},
+ {NULL, NULL}
+ };
+ const char* data2[] = {
+ "var {arguments: x} = {argumnets: 1};",
+ "var {eval: x} = {eval: 1};",
adamk 2016/08/19 18:14:56 These two tests can just go in the main block of t
lpy 2016/08/19 18:58:17 Done.
+ NULL
+ };
+ RunParserSyncTest(empty_context_data, data2, kSuccess);
+ }
}
@@ -6457,6 +6488,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 +6497,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);

Powered by Google App Engine
This is Rietveld 408576698