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

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

Issue 1439693002: [runtime] Support Proxy setPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-11-09_new_Proxy_1417063011
Patch Set: merging with master Created 5 years, 1 month 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 522c95d5b36f13c2cea2af654601dd342554374f..e74a42f9d456767140952e73bcccebbf3955af21 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2282,17 +2282,12 @@ TEST(ErrorsYieldStrict) {
TEST(ErrorsYieldSloppy) {
- const char* context_data[][2] = {
- { "", "" },
- { "function not_gen() {", "}" },
- { "(function not_gen() {", "})" },
- { NULL, NULL }
- };
+ const char* context_data[][2] = {{"", ""},
+ {"function not_gen() {", "}"},
+ {"(function not_gen() {", "})"},
+ {NULL, NULL}};
- const char* statement_data[] = {
- "(function * yield() { })",
- NULL
- };
+ const char* statement_data[] = {"(function * yield() { })", NULL};
RunParserSyncTest(context_data, statement_data, kError);
}
@@ -2307,52 +2302,32 @@ TEST(NoErrorsGenerator) {
};
const char* statement_data[] = {
- // A generator without a body is valid.
- ""
- // Valid yield expressions inside generators.
- "yield 2;",
- "yield * 2;",
- "yield * \n 2;",
- "yield yield 1;",
- "yield * yield * 1;",
- "yield 3 + (yield 4);",
- "yield * 3 + (yield * 4);",
- "(yield * 3) + (yield * 4);",
- "yield 3; yield 4;",
- "yield * 3; yield * 4;",
- "(function (yield) { })",
- "(function yield() { })",
- "yield { yield: 12 }",
- "yield /* comment */ { yield: 12 }",
- "yield * \n { yield: 12 }",
- "yield /* comment */ * \n { yield: 12 }",
- // You can return in a generator.
- "yield 1; return",
- "yield * 1; return",
- "yield 1; return 37",
- "yield * 1; return 37",
- "yield 1; return 37; yield 'dead';",
- "yield * 1; return 37; yield * 'dead';",
- // Yield is still a valid key in object literals.
- "({ yield: 1 })",
- "({ get yield() { } })",
- // Yield without RHS.
- "yield;",
- "yield",
- "yield\n",
- "yield /* comment */"
- "yield // comment\n"
- "(yield)",
- "[yield]",
- "{yield}",
- "yield, yield",
- "yield; yield",
- "(yield) ? yield : yield",
- "(yield) \n ? yield : yield",
- // If there is a newline before the next token, we don't look for RHS.
- "yield\nfor (;;) {}",
- NULL
- };
+ // A generator without a body is valid.
+ ""
+ // Valid yield expressions inside generators.
+ "yield 2;",
+ "yield * 2;", "yield * \n 2;", "yield yield 1;", "yield * yield * 1;",
+ "yield 3 + (yield 4);", "yield * 3 + (yield * 4);",
+ "(yield * 3) + (yield * 4);", "yield 3; yield 4;",
+ "yield * 3; yield * 4;", "(function (yield) { })",
+ "(function yield() { })", "yield { yield: 12 }",
+ "yield /* comment */ { yield: 12 }", "yield * \n { yield: 12 }",
+ "yield /* comment */ * \n { yield: 12 }",
+ // You can return in a generator.
+ "yield 1; return", "yield * 1; return", "yield 1; return 37",
+ "yield * 1; return 37", "yield 1; return 37; yield 'dead';",
+ "yield * 1; return 37; yield * 'dead';",
+ // Yield is still a valid key in object literals.
+ "({ yield: 1 })", "({ get yield() { } })",
+ // Yield without RHS.
+ "yield;", "yield", "yield\n",
+ "yield /* comment */"
+ "yield // comment\n"
+ "(yield)",
+ "[yield]", "{yield}", "yield, yield", "yield; yield",
+ "(yield) ? yield : yield", "(yield) \n ? yield : yield",
+ // If there is a newline before the next token, we don't look for RHS.
+ "yield\nfor (;;) {}", NULL};
RunParserSyncTest(context_data, statement_data, kSuccess);
}
@@ -2366,41 +2341,28 @@ TEST(ErrorsYieldGenerator) {
};
const char* statement_data[] = {
- // Invalid yield expressions inside generators.
- "var yield;",
- "var foo, yield;",
- "try { } catch (yield) { }",
- "function yield() { }",
- // The name of the NFE is bound in the generator, which does not permit
- // yield to be an identifier.
- "(function * yield() { })",
- // Yield isn't valid as a formal parameter for generators.
- "function * foo(yield) { }",
- "(function * foo(yield) { })",
- "yield = 1;",
- "var foo = yield = 1;",
- "++yield;",
- "yield++;",
- "yield *",
- "(yield *)",
- // Yield binds very loosely, so this parses as "yield (3 + yield 4)", which
- // is invalid.
- "yield 3 + yield 4;",
- "yield: 34",
- "yield ? 1 : 2",
- // Parses as yield (/ yield): invalid.
- "yield / yield",
- "+ yield",
- "+ yield 3",
- // Invalid (no newline allowed between yield and *).
- "yield\n*3",
- // Invalid (we see a newline, so we parse {yield:42} as a statement, not an
- // object literal, and yield is not a valid label).
- "yield\n{yield: 42}",
- "yield /* comment */\n {yield: 42}",
- "yield //comment\n {yield: 42}",
- NULL
- };
+ // Invalid yield expressions inside generators.
+ "var yield;", "var foo, yield;", "try { } catch (yield) { }",
+ "function yield() { }",
+ // The name of the NFE is bound in the generator, which does not permit
+ // yield to be an identifier.
+ "(function * yield() { })",
+ // Yield isn't valid as a formal parameter for generators.
+ "function * foo(yield) { }", "(function * foo(yield) { })", "yield = 1;",
+ "var foo = yield = 1;", "++yield;", "yield++;", "yield *", "(yield *)",
+ // Yield binds very loosely, so this parses as "yield (3 + yield 4)",
+ // which
+ // is invalid.
+ "yield 3 + yield 4;", "yield: 34", "yield ? 1 : 2",
+ // Parses as yield (/ yield): invalid.
+ "yield / yield", "+ yield", "+ yield 3",
+ // Invalid (no newline allowed between yield and *).
+ "yield\n*3",
+ // Invalid (we see a newline, so we parse {yield:42} as a statement, not
+ // an
+ // object literal, and yield is not a valid label).
+ "yield\n{yield: 42}", "yield /* comment */\n {yield: 42}",
+ "yield //comment\n {yield: 42}", NULL};
RunParserSyncTest(context_data, statement_data, kError);
}
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/mjsunit/harmony/proxy/proxy-setPrototypeOf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698