Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 9cb5d69e6c5c1849465a769c2205451cdc7f2421..d47a5d9c26d3c42986fe717100e7d092bbb97811 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -2482,7 +2482,7 @@ TEST(StrictObjectLiteralChecking) { |
{ NULL, NULL } |
}; |
- // These are only errors in strict mode. |
+ // ES6 allows duplicate properties even in strict mode. |
const char* statement_data[] = { |
"foo: 1, foo: 2", |
"\"foo\": 1, \"foo\": 2", |
@@ -2495,7 +2495,7 @@ TEST(StrictObjectLiteralChecking) { |
}; |
RunParserSyncTest(non_strict_context_data, statement_data, kSuccess); |
- RunParserSyncTest(strict_context_data, statement_data, kError); |
+ RunParserSyncTest(strict_context_data, statement_data, kSuccess); |
} |
@@ -2508,23 +2508,6 @@ TEST(ErrorsObjectLiteralChecking) { |
const char* statement_data[] = { |
",", |
- "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) {}", |
@@ -2578,6 +2561,24 @@ 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 |
}; |