diff --git a/test/annexB/labelled-function-declaration.js b/test/annexB/labelled-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..86eb59042b871312d79b1ca3aba51fc0de7b4218 --- /dev/null +++ b/test/annexB/labelled-function-declaration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + function declarations in statement position in non-strict mode: + label: Statement +flags: [noStrict] +---*/ +label: function g() {} + diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-2.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-2.js index 0e3f67777373241e613584b57c68e4ada45fc49d..20acbdc76661db9abe516debd5af770a1dff5c7a 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-2.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-2.js @@ -15,7 +15,6 @@ includes: function testcase() { var result = Object.getOwnPropertyNames(Object); var expResult = ["getPrototypeOf", "getOwnPropertyDescriptor", "getOwnPropertyNames", "create", "defineProperty", "defineProperties", "seal", "freeze", "preventExtensions", "isSealed", "isFrozen", "isExtensible", "keys", "prototype", "length"]; - var found; return arrayContains(result, expResult); } diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js index 683c888792c26bfd15a5b800c9080691cc3fcb7e..d7156dec7834fcbb0e0c61184703576b61c7abe7 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js @@ -19,9 +19,9 @@ function testcase() { var str = new String("abc"); str[5] = "de"; - var expected = ["0", "1", "2", "length", "5"]; + var expected = ["0", "1", "2", "5", "length"]; var actual = Object.getOwnPropertyNames(str); - return compareArray(actual.sort(), expected.sort()); + return compareArray(actual, expected); } runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js index 9246232b21abdfab0a9b5a752e276bdae7d13b14..a09232e9f7cd56c2d689c83a1f333d9bfd8cc1f1 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js @@ -19,6 +19,6 @@ function testcase() { var expected = ["0", "1", "2", "length"]; var actual = Object.getOwnPropertyNames(arr); - return compareArray(actual.sort(), expected.sort()); + return compareArray(actual, expected); } runTestCase(testcase); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js index 5adc29a5ac8415c5dab7cab9b9635bda9fb2b1d2..54c8575b605e18d4adb71de32ab8f8d9ed58cf1a 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js @@ -42,6 +42,6 @@ function testcase() { var actual = Object.getOwnPropertyNames(obj); var expected = ["a", "b", "c", "d"]; - return compareArray(actual.sort(), expected.sort()); + return compareArray(actual, expected); } runTestCase(testcase); diff --git a/test/built-ins/Object/is/length.js b/test/built-ins/Object/is/length.js index c109511379da8f7bbc5a21302d19a9541f2cf6a6..61cd9a4b2960a3731ad9af4e50f7c33c69cc71b1 100644 --- a/test/built-ins/Object/is/length.js +++ b/test/built-ins/Object/is/length.js @@ -13,6 +13,5 @@ includes: [propertyHelper.js] assert.sameValue(Object.is.length, 2, "The value of `Object.is.length` is `2`"); verifyNotEnumerable(Object.is, "length"); -verifyConfigurable(Object.is, "length"); verifyNotWritable(Object.is, "length"); - +verifyConfigurable(Object.is, "length"); diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js index 36136a28946a943a8ca909df7e1df50c9843d96b..4fdb621e7840ad3c357611fd2b62e9fee7c39b1c 100644 --- a/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js @@ -4,18 +4,19 @@ es6id: 13.1 description: > for-in to acquire properties from array -includes: [compareArray.js] +includes: [arrayContains.js] ---*/ function props(x) { var array = []; for (let p in x) array.push(p); - return array.sort(); + return array; } assert.sameValue(props([]).length, 0); assert.sameValue(props([1]).length, 1); assert.sameValue(props([1,2]).length, 2); +assert.sameValue(props([1,2,3]).length, 3); -assert(compareArray(props([1]), ["0"])); -assert(compareArray(props([1,2]), ["0", "1"])); -assert(compareArray(props([1,2,3]), ["0", "1", "2"])); +assert(arrayContains(props([1]), ["0"])); +assert(arrayContains(props([1,2]), ["0", "1"])); +assert(arrayContains(props([1,2,3]), ["0", "1", "2"])); diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js index 069c074f3218b57b267d5aedb64a6e23226a8bc3..ccd68eb6a7a5d903c32bbbb7787aecf40c2f3abd 100644 --- a/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js @@ -4,18 +4,19 @@ es6id: 13.1 description: > for-in to acquire properties from object -includes: [compareArray.js] +includes: [arrayContains.js] ---*/ function props(x) { var array = []; for (let p in x) array.push(p); - return array.sort(); + return array; } assert.sameValue(props({}).length, 0); assert.sameValue(props({x:1}).length, 1); assert.sameValue(props({x:1, y:2}).length, 2); +assert.sameValue(props({x:1, y:2, zoom:3}).length, 3); -assert(compareArray(props({x:1}), ["x"])); -assert(compareArray(props({x:1, y:2}), ["x", "y"])); -assert(compareArray(props({x:1, y:2, zoom:3}), ["x", "y", "zoom"])); +assert(arrayContains(props({x:1}), ["x"])); +assert(arrayContains(props({x:1, y:2}), ["x", "y"])); +assert(arrayContains(props({x:1, y:2, zoom:3}), ["x", "y", "zoom"])); diff --git a/test/language/class/method-definition/yield-as-function-expression-binding-identifier.js b/test/language/class/method-definition/yield-as-function-expression-binding-identifier.js index 7b1db5ddce9a27537e77c238c1fbb368683e9d41..bb081f14e90e0209e6714b3d9750f8ae946038b5 100644 --- a/test/language/class/method-definition/yield-as-function-expression-binding-identifier.js +++ b/test/language/class/method-definition/yield-as-function-expression-binding-identifier.js @@ -3,21 +3,15 @@ /*--- description: > - `yield` may be used as the binding identifier of a function expression - within generator bodies. + `yield` may not be used as the binding identifier of a function + expression within classes. features: [generators] es6id: 14.1 - flags: [noStrict] + negative: SyntaxError ---*/ -var result; class A { *g() { (function yield() {}); } } - -result = A.prototype.g().next(); - -assert.sameValue(result.value, undefined); -assert.sameValue(result.done, true); diff --git a/test/language/class/method-definition/yield-as-generator-method-binding-identifier.js b/test/language/class/method-definition/yield-as-generator-method-binding-identifier.js index 441d522a739d1507d44c53608517137d7d4fd5ab..50e0709c73da4e4f1dfdae66d3f83e8eb1ccc613 100644 --- a/test/language/class/method-definition/yield-as-generator-method-binding-identifier.js +++ b/test/language/class/method-definition/yield-as-generator-method-binding-identifier.js @@ -7,7 +7,6 @@ strict mode. features: [generators] es6id: 12.1.1 - flags: [noStrict] ---*/ var iter, result; diff --git a/test/language/class/method-definition/yield-as-identifier-in-nested-function.js b/test/language/class/method-definition/yield-as-identifier-in-nested-function.js index 10a1d11064cee50077153607325de7a06e5f3b26..1cf64ff35780c8034f8ce6b78ce234dc1b330a5c 100644 --- a/test/language/class/method-definition/yield-as-identifier-in-nested-function.js +++ b/test/language/class/method-definition/yield-as-identifier-in-nested-function.js @@ -3,14 +3,13 @@ /*--- description: > - `yield` is not a reserved keyword within normal function bodies declared - within generator function bodies. + `yield` is a reserved keyword within normal function bodies declared + within classes. features: [generators] es6id: 12.1.1 - flags: [noStrict] + negative: SyntaxError ---*/ -var result; class A { *g() { function h() { @@ -18,7 +17,3 @@ class A { } } } - -result = A.prototype.g().next(); -assert.sameValue(result.value, undefined); -assert.sameValue(result.done, true); diff --git a/test/language/computed-property-names/basics/symbol.js b/test/language/computed-property-names/basics/symbol.js index 64f778643c0218cc98b149ead0e15063cb4c0133..60e4784872af73e341878e9608cb00e41a336f53 100644 --- a/test/language/computed-property-names/basics/symbol.js +++ b/test/language/computed-property-names/basics/symbol.js @@ -27,24 +27,7 @@ assert( compareArray(Object.keys(object), ['a', 'c']), "`compareArray(Object.keys(object), ['a', 'c'])` returns `true`" ); - -// compareArray expects arguments to be sorted, -// which will cause an array containing symbols to -// throw an exception when toString() is called. -// -// Since there is no guarantee of order: -// -// - Assert only that the symbol is present -// - Assert that the length is correct -// -var symbols = Object.getOwnPropertySymbols(object); - -assert( - symbols.indexOf(sym1) !== -1, - "The result of `symbols.indexOf(sym1) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(object);`" -); assert( - symbols.indexOf(sym2) !== -1, - "The result of `symbols.indexOf(sym2) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(object);`" + compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`" ); -assert.sameValue(symbols.length, 2, "The value of `symbols.length` is `2`, after executing `var symbols = Object.getOwnPropertySymbols(object);`"); diff --git a/test/language/computed-property-names/class/method/symbol.js b/test/language/computed-property-names/class/method/symbol.js index a622ffed3960d521ee4fff6aadc09bb5168a03d4..c7425fcb6a5556060d0b229b7651a86dc63712ac 100644 --- a/test/language/computed-property-names/class/method/symbol.js +++ b/test/language/computed-property-names/class/method/symbol.js @@ -31,24 +31,7 @@ assert( compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c']), "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c'])` returns `true`" ); - -// compareArray expects arguments to be sorted, -// which will cause an array containing symbols to -// throw an exception when toString() is called. -// -// Since there is no guarantee of order: -// -// - Assert only that the symbol is present -// - Assert that the length is correct -// -var symbols = Object.getOwnPropertySymbols(C.prototype); - -assert( - symbols.indexOf(sym1) !== -1, - "The result of `symbols.indexOf(sym1) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(C.prototype);`" -); assert( - symbols.indexOf(sym2) !== -1, - "The result of `symbols.indexOf(sym2) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(C.prototype);`" + compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2])` returns `true`" ); -assert.sameValue(symbols.length, 2, "The value of `symbols.length` is `2`, after executing `var symbols = Object.getOwnPropertySymbols(C.prototype);`"); diff --git a/test/language/computed-property-names/class/static/method-number.js b/test/language/computed-property-names/class/static/method-number.js index e678335a6a73cbd317159181dc961b15b6bbf6ac..1c553a193098641fe5d7b9156dbee02ed7f3ff5b 100644 --- a/test/language/computed-property-names/class/static/method-number.js +++ b/test/language/computed-property-names/class/static/method-number.js @@ -21,6 +21,6 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'name', 'prototype', 'a', 'c']), - "`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'name', 'prototype', 'a', 'c'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name']), + "`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/static/method-string.js b/test/language/computed-property-names/class/static/method-string.js index 865c520fa47ddea470de71aaeca8bd95ae1b44ec..2b5f09b83fd2f0ef09f72584b8178ccba0b7680c 100644 --- a/test/language/computed-property-names/class/static/method-string.js +++ b/test/language/computed-property-names/class/static/method-string.js @@ -21,6 +21,6 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'b', 'c', 'd']), - "`compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'b', 'c', 'd'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name']), + "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/static/method-symbol.js b/test/language/computed-property-names/class/static/method-symbol.js index 30d12ff555e00f9b41e8417a6ec0a49d33f45f37..31012afeb8723219c33d7ca1e6d83b198cc3b4a0 100644 --- a/test/language/computed-property-names/class/static/method-symbol.js +++ b/test/language/computed-property-names/class/static/method-symbol.js @@ -23,32 +23,10 @@ assert( "`compareArray(Object.keys(C), [])` returns `true`" ); assert( - compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'c']), - "`compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'c'])` returns `true`" + compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name']), + "`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name'])` returns `true`" ); - - -// compareArray expects arguments to be sorted, -// which will cause an array containing symbols to -// throw an exception when toString() is called. -// -// Since there is no guarantee of order: -// -// - Assert only that the symbol is present -// - Assert that the length is correct -// -var symbols = Object.getOwnPropertySymbols(C); - assert( - symbols.indexOf(sym1) !== -1, - "The result of `symbols.indexOf(sym1) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(C);`" -); -assert( - symbols.indexOf(sym2) !== -1, - "The result of `symbols.indexOf(sym2) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(C);`" -); -assert.sameValue( - symbols.length, - 2, - "The value of `symbols.length` is `2`, after executing `var symbols = Object.getOwnPropertySymbols(C);`" + compareArray(Object.getOwnPropertySymbols(C), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(C), [sym1, sym2])` returns `true`" ); diff --git a/test/language/computed-property-names/object/method/symbol.js b/test/language/computed-property-names/object/method/symbol.js index 72247098dbfa75676c77d39c91aaa76610987943..3c76e856be04a7da412b84725c3ca1c11f110637 100644 --- a/test/language/computed-property-names/object/method/symbol.js +++ b/test/language/computed-property-names/object/method/symbol.js @@ -27,24 +27,7 @@ assert( compareArray(Object.keys(object), ['a', 'c']), "`compareArray(Object.keys(object), ['a', 'c'])` returns `true`" ); - -// compareArray expects arguments to be sorted, -// which will cause an array containing symbols to -// throw an exception when toString() is called. -// -// Since there is no guarantee of order: -// -// - Assert only that the symbol is present -// - Assert that the length is correct -// -var symbols = Object.getOwnPropertySymbols(object); - -assert( - symbols.indexOf(sym1) !== -1, - "The result of `symbols.indexOf(sym1) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(object);`" -); assert( - symbols.indexOf(sym2) !== -1, - "The result of `symbols.indexOf(sym2) !== -1` is `true`, after executing `var symbols = Object.getOwnPropertySymbols(object);`" + compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`" ); -assert.sameValue(symbols.length, 2, "The value of `symbols.length` is `2`, after executing `var symbols = Object.getOwnPropertySymbols(object);`"); diff --git a/test/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js b/test/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js index 61071254c8174f80048bd8fa397607cc37528f1f..66167079159893898ff9719f249258fedcb08b48 100644 --- a/test/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js +++ b/test/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js @@ -17,7 +17,7 @@ var obj = { } }; -result = A.prototype.g().next(); +result = obj.g().next(); assert.sameValue(result.value, undefined); assert.sameValue(result.done, true); diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js b/test/language/statements/labeled/labelled-function-declaration-strict.js similarity index 87% rename from test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js rename to test/language/statements/labeled/labelled-function-declaration-strict.js index 7d8b02305015e89523d2f3245bde26825f672a0f..9f6fa35e41419fee9eaf032b68c4e4cc2828f48f 100644 --- a/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js +++ b/test/language/statements/labeled/labelled-function-declaration-strict.js @@ -5,6 +5,8 @@ es6id: 13.1 description: > function declarations in statement position in strict mode: label: Statement +flags: [onlyStrict] +negative: SyntaxError ---*/ label: function g() {} diff --git a/test/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict.js b/test/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict.js index 107d6b986a84b172a50a60dda072f88b2522b885..ae7142b70b176656376a9c68b4fe1f5377d48d89 100644 --- a/test/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict.js +++ b/test/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict.js @@ -6,7 +6,7 @@ description: > for declaration: identifier "let" disallowed as lefthandside expression in strict mode flags: [onlyStrict] -negative: ReferrenceError +negative: SyntaxError ---*/ var o = { a: 1 }; for (let in o) { }