Index: test/mjsunit/strict-mode.js |
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js |
index 88e3a5d645f676f6fe0aa6399f1dcba2c41aeee6..5fb404a7990913cc953fe400315a3e4e455ced4a 100644 |
--- a/test/mjsunit/strict-mode.js |
+++ b/test/mjsunit/strict-mode.js |
@@ -166,6 +166,17 @@ assertThrows('\ |
"use strict";\ |
}', SyntaxError); |
+// Duplicate data properties. |
+CheckStrictMode("var x = { dupe : 1, nondupe: 3, dupe : 2 };", SyntaxError); |
+CheckStrictMode("var x = { '1234' : 1, '2345' : 2, '1234' : 3 };", SyntaxError); |
+CheckStrictMode("var x = { '1234' : 1, '2345' : 2, 1234 : 3 };", SyntaxError); |
+CheckStrictMode("var x = { 3.14 : 1, 2.71 : 2, 3.14 : 3 };", SyntaxError); |
+CheckStrictMode("var x = { 3.14 : 1, '3.14' : 2 };", SyntaxError); |
+CheckStrictMode("var x = { \ |
+ 123: 1, \ |
+ 123.00000000000000000000000000000000000000000000000000000000000000000001: 2 \ |
+}", SyntaxError); |
+ |
// Non-conflicting data properties. |
(function StrictModeNonDuplicate() { |
"use strict"; |
@@ -177,52 +188,37 @@ assertThrows('\ |
}; |
})(); |
-// Duplicate properties are no longer errors in ES6. |
-(function Duplicates() { |
- "use strict"; |
- |
- ({ dupe : 1, nondupe: 3, dupe : 2 }); |
- ({ '1234' : 1, '2345' : 2, '1234' : 3 }); |
- ({ '1234' : 1, '2345' : 2, 1234 : 3 }); |
- ({ 3.14 : 1, 2.71 : 2, 3.14 : 3 }); |
- ({ 3.14 : 1, '3.14' : 2 }); |
- ({ |
- 123: 1, |
- 123.00000000000000000000000000000000000000000000000000000000000000000001: 2 |
- }); |
- |
- // Two getters |
- ({ get foo() { }, get foo() { } }); |
- ({ get foo(){}, get 'foo'(){}}); |
- ({ get 12(){}, get '12'(){}}); |
- |
- // Two setters |
- ({ set foo(v) { }, set foo(v) { } }); |
- ({ set foo(v) { }, set 'foo'(v) { } }); |
- ({ set 13(v) { }, set '13'(v) { } }); |
- |
- // Setter and data |
- ({ foo: 'data', set foo(v) { } }); |
- ({ set foo(v) { }, foo: 'data' }); |
- ({ foo: 'data', set 'foo'(v) { } }); |
- ({ set foo(v) { }, 'foo': 'data' }); |
- ({ 'foo': 'data', set foo(v) { } }); |
- ({ set 'foo'(v) { }, foo: 'data' }); |
- ({ 'foo': 'data', set 'foo'(v) { } }); |
- ({ set 'foo'(v) { }, 'foo': 'data' }); |
- ({ 12: 1, set '12'(v){}}); |
- ({ 12: 1, set 12(v){}}); |
- ({ '12': 1, set '12'(v){}}); |
- ({ '12': 1, set 12(v){}}); |
- |
- // Getter and data |
- ({ foo: 'data', get foo() { } }); |
- ({ get foo() { }, foo: 'data' }); |
- ({ 'foo': 'data', get foo() { } }); |
- ({ get 'foo'() { }, 'foo': 'data' }); |
- ({ '12': 1, get '12'(){}}); |
- ({ '12': 1, get 12(){}}); |
-})(); |
+// Two getters (non-strict) |
+assertThrows("var x = { get foo() { }, get foo() { } };", SyntaxError); |
+assertThrows("var x = { get foo(){}, get 'foo'(){}};", SyntaxError); |
+assertThrows("var x = { get 12(){}, get '12'(){}};", SyntaxError); |
+ |
+// Two setters (non-strict) |
+assertThrows("var x = { set foo(v) { }, set foo(v) { } };", SyntaxError); |
+assertThrows("var x = { set foo(v) { }, set 'foo'(v) { } };", SyntaxError); |
+assertThrows("var x = { set 13(v) { }, set '13'(v) { } };", SyntaxError); |
+ |
+// Setter and data (non-strict) |
+assertThrows("var x = { foo: 'data', set foo(v) { } };", SyntaxError); |
+assertThrows("var x = { set foo(v) { }, foo: 'data' };", SyntaxError); |
+assertThrows("var x = { foo: 'data', set 'foo'(v) { } };", SyntaxError); |
+assertThrows("var x = { set foo(v) { }, 'foo': 'data' };", SyntaxError); |
+assertThrows("var x = { 'foo': 'data', set foo(v) { } };", SyntaxError); |
+assertThrows("var x = { set 'foo'(v) { }, foo: 'data' };", SyntaxError); |
+assertThrows("var x = { 'foo': 'data', set 'foo'(v) { } };", SyntaxError); |
+assertThrows("var x = { set 'foo'(v) { }, 'foo': 'data' };", SyntaxError); |
+assertThrows("var x = { 12: 1, set '12'(v){}};", SyntaxError); |
+assertThrows("var x = { 12: 1, set 12(v){}};", SyntaxError); |
+assertThrows("var x = { '12': 1, set '12'(v){}};", SyntaxError); |
+assertThrows("var x = { '12': 1, set 12(v){}};", SyntaxError); |
+ |
+// Getter and data (non-strict) |
+assertThrows("var x = { foo: 'data', get foo() { } };", SyntaxError); |
+assertThrows("var x = { get foo() { }, foo: 'data' };", SyntaxError); |
+assertThrows("var x = { 'foo': 'data', get foo() { } };", SyntaxError); |
+assertThrows("var x = { get 'foo'() { }, 'foo': 'data' };", SyntaxError); |
+assertThrows("var x = { '12': 1, get '12'(){}};", SyntaxError); |
+assertThrows("var x = { '12': 1, get 12(){}};", SyntaxError); |
// Assignment to eval or arguments |
CheckStrictMode("function strict() { eval = undefined; }", SyntaxError); |