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

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

Issue 385613002: Parser sync tests for `let` identifiers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 6 years, 5 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/parser.cc ('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 d4fc206e76f48c482dc5a0317f9f5ae60595a198..6ec9edd672b16d4e1d31e641f873885aeb61eeab 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1749,9 +1749,43 @@ TEST(ErrorsReservedWords) {
}
+TEST(NoErrorsLetSloppyAllModes) {
+ // In sloppy mode, it's okay to use "let" as identifier.
+ const char* context_data[][2] = {
+ { "", "" },
+ { "function f() {", "}" },
+ { "(function f() {", "})" },
+ { NULL, NULL }
+ };
+
+ const char* statement_data[] = {
+ "var let;",
+ "var foo, let;",
+ "try { } catch (let) { }",
+ "function let() { }",
+ "(function let() { })",
+ "function foo(let) { }",
+ "function foo(bar, let) { }",
+ "let = 1;",
+ "var foo = let = 1;",
+ "let * 2;",
+ "++let;",
+ "let++;",
+ "let: 34",
+ "function let(let) { let: let(let + let(0)); }",
+ "({ let: 1 })",
+ "({ get let() { 1 } })",
+ "let(100)",
+ NULL
+ };
+
+ RunParserSyncTest(context_data, statement_data, kSuccess);
+}
+
+
TEST(NoErrorsYieldSloppyAllModes) {
// In sloppy mode, it's okay to use "yield" as identifier, *except* inside a
- // generator (see next test).
+ // generator (see other test).
const char* context_data[][2] = {
{ "", "" },
{ "function not_gen() {", "}" },
@@ -1769,19 +1803,19 @@ TEST(NoErrorsYieldSloppyAllModes) {
"function foo(bar, yield) { }",
"yield = 1;",
"var foo = yield = 1;",
+ "yield * 2;",
"++yield;",
"yield++;",
"yield: 34",
- "function yield(yield) { yield: yield (yield + yield (0)); }",
+ "function yield(yield) { yield: yield (yield + yield(0)); }",
"({ yield: 1 })",
"({ get yield() { 1 } })",
- "yield (100)",
+ "yield(100)",
+ "yield[100]",
NULL
};
- static const ParserFlag always_flags[] = {kAllowArrowFunctions};
- RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
- always_flags, ARRAY_SIZE(always_flags));
+ RunParserSyncTest(context_data, statement_data, kSuccess);
}
@@ -1809,20 +1843,20 @@ TEST(NoErrorsYieldSloppyGeneratorsEnabled) {
"(function * yield() { })",
"yield = 1;",
"var foo = yield = 1;",
+ "yield * 2;",
"++yield;",
"yield++;",
"yield: 34",
- "function yield(yield) { yield: yield (yield + yield (0)); }",
+ "function yield(yield) { yield: yield (yield + yield(0)); }",
"({ yield: 1 })",
"({ get yield() { 1 } })",
- "yield (100)",
+ "yield(100)",
+ "yield[100]",
NULL
};
// This test requires kAllowGenerators to succeed.
- static const ParserFlag always_true_flags[] = {
- kAllowGenerators
- };
+ static const ParserFlag always_true_flags[] = { kAllowGenerators };
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_true_flags, 1);
}
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698