| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 31651904e3a2ca7dc42862bba55188d9de89b1e6..57671c0d9e11907e8bbeaec4f8f5fdb3ab087fee 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -2486,7 +2486,7 @@ TEST(StrictObjectLiteralChecking) {
|
| { NULL, NULL }
|
| };
|
|
|
| - // ES6 allows duplicate properties even in strict mode.
|
| + // These are only errors in strict mode.
|
| const char* statement_data[] = {
|
| "foo: 1, foo: 2",
|
| "\"foo\": 1, \"foo\": 2",
|
| @@ -2499,7 +2499,7 @@ TEST(StrictObjectLiteralChecking) {
|
| };
|
|
|
| RunParserSyncTest(non_strict_context_data, statement_data, kSuccess);
|
| - RunParserSyncTest(strict_context_data, statement_data, kSuccess);
|
| + RunParserSyncTest(strict_context_data, statement_data, kError);
|
| }
|
|
|
|
|
| @@ -2511,17 +2511,23 @@ TEST(ErrorsObjectLiteralChecking) {
|
| };
|
|
|
| const char* statement_data[] = {
|
| - ",",
|
| - // Wrong number of parameters
|
| - "get bar(x) {}",
|
| - "get bar(x, y) {}",
|
| - "set bar() {}",
|
| - "set bar(x, y) {}",
|
| - // Parsing FunctionLiteral for getter or setter fails
|
| - "get foo( +",
|
| - "get foo() \"error\"",
|
| - NULL
|
| - };
|
| + ",", "foo: 1, get foo() {}", "foo: 1, set foo(v) {}",
|
| + "\"foo\": 1, get \"foo\"() {}", "\"foo\": 1, set \"foo\"(v) {}",
|
| + "1: 1, get 1() {}", "1: 1, set 1() {}",
|
| + // It's counter-intuitive, but these collide too (even in classic
|
| + // mode). Note that we can have "foo" and foo as properties in classic
|
| + // mode,
|
| + // but we cannot have "foo" and get foo, or foo and get "foo".
|
| + "foo: 1, get \"foo\"() {}", "foo: 1, set \"foo\"(v) {}",
|
| + "\"foo\": 1, get foo() {}", "\"foo\": 1, set foo(v) {}",
|
| + "1: 1, get \"1\"() {}", "1: 1, set \"1\"() {}",
|
| + "\"1\": 1, get 1() {}"
|
| + "\"1\": 1, set 1(v) {}"
|
| + // Wrong number of parameters
|
| + "get bar(x) {}",
|
| + "get bar(x, y) {}", "set bar() {}", "set bar(x, y) {}",
|
| + // Parsing FunctionLiteral for getter or setter fails
|
| + "get foo( +", "get foo() \"error\"", NULL};
|
|
|
| RunParserSyncTest(context_data, statement_data, kError);
|
| }
|
| @@ -2565,24 +2571,6 @@ TEST(NoErrorsObjectLiteralChecking) {
|
| "super: 6",
|
| "eval: 7",
|
| "arguments: 8",
|
| - // Duplicate property names are allowed in ES6.
|
| - "foo: 1, get foo() {}",
|
| - "foo: 1, set foo(v) {}",
|
| - "\"foo\": 1, get \"foo\"() {}",
|
| - "\"foo\": 1, set \"foo\"(v) {}",
|
| - "1: 1, get 1() {}",
|
| - "1: 1, set 1(v) {}",
|
| - // It's counter-intuitive, but these collide too (even in classic
|
| - // mode). Note that we can have "foo" and foo as properties in classic mode,
|
| - // but we cannot have "foo" and get foo, or foo and get "foo".
|
| - "foo: 1, get \"foo\"() {}",
|
| - "foo: 1, set \"foo\"(v) {}",
|
| - "\"foo\": 1, get foo() {}",
|
| - "\"foo\": 1, set foo(v) {}",
|
| - "1: 1, get \"1\"() {}",
|
| - "1: 1, set \"1\"(v) {}",
|
| - "\"1\": 1, get 1() {}",
|
| - "\"1\": 1, set 1(v) {}",
|
| NULL
|
| };
|
|
|
|
|