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

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

Issue 1060883004: [strong] Implement static restrictions on binding 'undefined' in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests/fix some existing test flags. Created 5 years, 8 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 e1fe1930928b094f8893bc06404c9ea4db7e8a99..7d2409688bc6ecdbf916e62902649cbd86379b5b 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5869,13 +5869,48 @@ TEST(StrongUndefinedLocal) {
"(class undefined {'use strong'});",
NULL};
- static const ParserFlag always_flags[] = {kAllowStrongMode};
+ static const ParserFlag always_flags[] = {
+ kAllowStrongMode, kAllowHarmonySloppy
+ };
RunParserSyncTest(context_data, data, kError, NULL, 0,
always_flags, arraysize(always_flags));
}
+TEST(StrongArrow) {
rossberg 2015/04/10 14:02:56 Nit: rename to StrongUndefinedArrow
conradw 2015/04/10 14:20:49 Done.
+ const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
+ const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
+ const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
+
+ const char* data[] = {
+ "(undefined => {return});",
+ "((undefined, b, c) => {return});",
+ "((a, undefined, c) => {return});",
+ "((a, b, undefined) => {return});",
+ NULL};
+
+ const char* local_strong[] = {
+ "(undefined => {'use strong';});",
+ "((undefined, b, c) => {'use strong';});",
+ "((a, undefined, c) => {'use strong';});",
+ "((a, b, undefined) => {'use strong';});",
+ NULL};
+
+ static const ParserFlag always_flags[] = {
+ kAllowStrongMode, kAllowHarmonyArrowFunctions
+ };
+ RunParserSyncTest(sloppy_context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(sloppy_context_data, local_strong, kError, NULL, 0,
+ always_flags, arraysize(always_flags));
+}
+
+
TEST(ArrowFunctionASIErrors) {
const char* context_data[][2] = {{"'use strict';", ""}, {"", ""},
{NULL, NULL}};

Powered by Google App Engine
This is Rietveld 408576698