From 48856b5108f899289f6c29e8d03f5e51248e920c Mon Sep 17 00:00:00 2001 From: Ashley Claymore Date: Wed, 27 Jul 2022 15:26:06 +0100 Subject: [PATCH 1/2] fixup: typo toSpliced -> with --- test/built-ins/TypedArray/prototype/with/metadata/length.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/with/metadata/length.js b/test/built-ins/TypedArray/prototype/with/metadata/length.js index 2cd73a715a0..5e160c6f6c2 100644 --- a/test/built-ins/TypedArray/prototype/with/metadata/length.js +++ b/test/built-ins/TypedArray/prototype/with/metadata/length.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-%typedarray%.prototype.toSpliced +esid: sec-%typedarray%.prototype.with description: > - The "length" property of %TypedArray%.prototype.toSpliced + The "length" property of %TypedArray%.prototype.with info: | 17 ECMAScript Standard Built-in Objects @@ -22,7 +22,7 @@ includes: [testTypedArray.js, propertyHelper.js] features: [TypedArray, change-array-by-copy] ---*/ -verifyProperty(TypedArray.prototype.toSpliced, "length", { +verifyProperty(TypedArray.prototype.with, "length", { value: 2, writable: false, enumerable: false, From 6507f721052a267813b0b5d5771692906e405f74 Mon Sep 17 00:00:00 2001 From: Ashley Claymore Date: Wed, 27 Jul 2022 15:30:43 +0100 Subject: [PATCH 2/2] TypedArray toSpliced tests are no longer needed --- ...lamped-between-zero-and-remaining-count.js | 40 ----------------- .../toSpliced/deleteCount-missing.js | 24 ---------- .../toSpliced/deleteCount-undefined.js | 29 ------------ .../prototype/toSpliced/ignores-species.js | 42 ----------------- .../prototype/toSpliced/immutable.js | 19 -------- .../toSpliced/length-property-ignored.js | 45 ------------------- .../prototype/toSpliced/metadata/length.js | 30 ------------- .../prototype/toSpliced/metadata/name.js | 28 ------------ .../toSpliced/metadata/property-descriptor.js | 25 ----------- .../prototype/toSpliced/not-a-constructor.js | 33 -------------- .../start-and-deleteCount-missing.js | 25 ----------- .../start-and-deleteCount-undefineds.js | 29 ------------ .../toSpliced/start-bigger-than-length.js | 25 ----------- .../toSpliced/start-neg-infinity-is-zero.js | 24 ---------- ...tart-neg-less-than-minus-length-is-zero.js | 24 ---------- .../start-neg-subtracted-from-length.js | 24 ---------- ...start-undefined-and-deleteCount-missing.js | 29 ------------ .../prototype/toSpliced/this-value-invalid.js | 35 --------------- 18 files changed, 530 deletions(-) delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/deleteCount-clamped-between-zero-and-remaining-count.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/deleteCount-missing.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/deleteCount-undefined.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/ignores-species.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/immutable.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/length-property-ignored.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/metadata/length.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/metadata/name.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/metadata/property-descriptor.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/not-a-constructor.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-missing.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-undefineds.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-bigger-than-length.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-neg-infinity-is-zero.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-neg-less-than-minus-length-is-zero.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-neg-subtracted-from-length.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/start-undefined-and-deleteCount-missing.js delete mode 100644 test/built-ins/TypedArray/prototype/toSpliced/this-value-invalid.js diff --git a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-clamped-between-zero-and-remaining-count.js b/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-clamped-between-zero-and-remaining-count.js deleted file mode 100644 index 0adada4e52f..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-clamped-between-zero-and-remaining-count.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: deleteCount is clamped between zero and len - actualStart -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced (start, deleteCount , ...items ) - - ... - 10. Else, - a. Let insertCount be the number of elements in items. - b. Let dc be ? ToIntegerOrInfinity(deleteCount). - c. Let actualDeleteCount be the result of clamping dc between 0 and len - actualStart. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - assert.compareArray( - new TA([0, 1, 2, 3, 4, 5]).toSpliced(2, -1), - [0, 1, 2, 3, 4, 5] - ); - - assert.compareArray( - new TA([0, 1, 2, 3, 4, 5]).toSpliced(-4, -1), - [0, 1, 2, 3, 4, 5] - ); - - assert.compareArray( - new TA([0, 1, 2, 3, 4, 5]).toSpliced(2, 6), - [0, 1] - ); - - assert.compareArray( - new TA([0, 1, 2, 3, 4, 5]).toSpliced(-4, 6), - [0, 1] - ); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-missing.js b/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-missing.js deleted file mode 100644 index 34a4b293d6a..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-missing.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: '%TypedArray%.prototype.toSpliced deletes the elements after start when called with one argument' -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced (start, deleteCount , ...items ) - - ... - 9. Else if deleteCount is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be len - actualStart. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - assert.compareArray( - new TA([1, 2, 3]).toSpliced(1), - [1] - ); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-undefined.js b/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-undefined.js deleted file mode 100644 index 628cfd1132e..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/deleteCount-undefined.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: '%TypedArray%.prototype.toSpliced(number, undefined) returns a copy of the original array' -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced (start, deleteCount , ...items ) - - ... - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - ... - 7. Else, let actualStart be min(relativeStart, len). - 8. If start is not present, then - ... - 9. Else if deleteCount is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be len - actualStart. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - assert.compareArray( - new TA([1, 2, 3]).toSpliced(1, undefined), - [1, 2, 3] - ); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/ignores-species.js b/test/built-ins/TypedArray/prototype/toSpliced/ignores-species.js deleted file mode 100644 index ae963456d6a..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/ignores-species.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced ignores @@species -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 12. Let A be ? TypedArraySpeciesCreate(O, « 𝔽(len) », true). - ... - - TypedArraySpeciesCreate ( exemplar, argumentList [ , noSpeciesOverride ] ) - ... - 2. Let defaultConstructor be the intrinsic object listed in column one of Table 63 for exemplar.[[TypedArrayName]]. - 3. If noSpeciesOverride is true, let constructor be defaultConstructor. - ... -includes: [testTypedArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors(TA => { - var ta = new TA([1, 2, 3]); - ta.constructor = TA === Uint8Array ? Int32Array : Uint8Array; - assert.sameValue(Object.getPrototypeOf(ta.toSpliced(0, 2)), TA.prototype); - - ta = new TA([1, 2, 3]); - ta.constructor = { - [Symbol.species]: TA === Uint8Array ? Int32Array : Uint8Array, - }; - assert.sameValue(Object.getPrototypeOf(ta.toSpliced(0, 2)), TA.prototype); - - ta = new TA(); - Object.defineProperty(ta, "constructor", { - get() { - throw new Test262Error("Should not get .constructor"); - } - }); - ta.toSpliced(0, 2); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/immutable.js b/test/built-ins/TypedArray/prototype/toSpliced/immutable.js deleted file mode 100644 index 0a969657339..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/immutable.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced does not mutate its this value -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors(TA => { - var ta = new TA([3, 1, 2]); - ta.toSpliced(0, 2); - - assert.compareArray(ta, [3, 1, 2]); - assert.notSameValue(ta.toSpliced(0, 2), ta); - assert.notSameValue(ta.toSpliced(0, 0), ta); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/length-property-ignored.js b/test/built-ins/TypedArray/prototype/toSpliced/length-property-ignored.js deleted file mode 100644 index 1c82f5f3a02..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/length-property-ignored.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced reads the TypedArray length ignoring the .length property -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 4. Let len be O.[[ArrayLength]]. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors(TA => { - var ta = new TA([3, 1, 2]); - Object.defineProperty(ta, "length", { value: 2 }) - var res = ta.toSpliced(0, 0, 5); - assert.compareArray([res[0], res[1], res[2], res[3], res[4]], [5, 3, 1, 2, undefined]) - - ta = new TA([3, 1, 2]); - Object.defineProperty(ta, "length", { value: 5 }); - res = ta.toSpliced(0, 0, 5); - assert.compareArray([res[0], res[1], res[2], res[3], res[4]], [5, 3, 1, 2, undefined]) -}); - -var length; -Object.defineProperty(TypedArray.prototype, "length", { - get: () => length, -}); - -testWithTypedArrayConstructors(TA => { - var ta = new TA([3, 1, 2]); - - length = 2; - var res = ta.toSpliced(0, 0, 5); - assert.compareArray([res[0], res[1], res[2], res[3], res[4]], [5, 3, 1, 2, undefined]) - - length = 5; - res = ta.toSpliced(0, 0, 5); - assert.compareArray([res[0], res[1], res[2], res[3], res[4]], [5, 3, 1, 2, undefined]) -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/metadata/length.js b/test/built-ins/TypedArray/prototype/toSpliced/metadata/length.js deleted file mode 100644 index 2cd73a715a0..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/metadata/length.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - The "length" property of %TypedArray%.prototype.toSpliced -info: | - 17 ECMAScript Standard Built-in Objects - - Every built-in function object, including constructors, has a length property - whose value is an integer. Unless otherwise specified, this value is equal to - the largest number of named arguments shown in the subclause headings for the - function description. Optional parameters (which are indicated with brackets: - [ ]) or rest parameters (which are shown using the form «...name») are not - included in the default argument count. - - Unless otherwise specified, the length property of a built-in function object - has the attributes { [[Writable]]: false, [[Enumerable]]: false, - [[Configurable]]: true }. -includes: [testTypedArray.js, propertyHelper.js] -features: [TypedArray, change-array-by-copy] ----*/ - -verifyProperty(TypedArray.prototype.toSpliced, "length", { - value: 2, - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/metadata/name.js b/test/built-ins/TypedArray/prototype/toSpliced/metadata/name.js deleted file mode 100644 index a00696be4f6..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/metadata/name.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced.name is "toSpliced". -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - 17 ECMAScript Standard Built-in Objects: - Every built-in Function object, including constructors, that is not - identified as an anonymous function has a name property whose value - is a String. - - Unless otherwise specified, the name property of a built-in Function - object, if it exists, has the attributes { [[Writable]]: false, - [[Enumerable]]: false, [[Configurable]]: true }. -includes: [testTypedArray.js, propertyHelper.js] -features: [TypedArray, change-array-by-copy] ----*/ - -verifyProperty(TypedArray.prototype.toSpliced, "name", { - value: "toSpliced", - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/metadata/property-descriptor.js b/test/built-ins/TypedArray/prototype/toSpliced/metadata/property-descriptor.js deleted file mode 100644 index 05335b41148..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/metadata/property-descriptor.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - "toSpliced" property of %TypedArray%.prototype -info: | - 17 ECMAScript Standard Built-in Objects - - Every other data property described in clauses 18 through 26 and in Annex B.2 - has the attributes { [[Writable]]: true, [[Enumerable]]: false, - [[Configurable]]: true } unless otherwise specified. -includes: [testTypedArray.js, propertyHelper.js] -features: [TypedArray, change-array-by-copy] ----*/ - -assert.sameValue(typeof TypedArray.prototype.toSpliced, "function", "typeof"); - -verifyProperty(TypedArray.prototype, "toSpliced", { - value: TypedArray.prototype.toSpliced, - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/not-a-constructor.js b/test/built-ins/TypedArray/prototype/toSpliced/not-a-constructor.js deleted file mode 100644 index 26f5e311ed8..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/not-a-constructor.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-ecmascript-standard-built-in-objects -description: > - %TypedArray%.prototype.toSpliced does not implement [[Construct]], is not new-able -info: | - ECMAScript Function Objects - - Built-in function objects that are not identified as constructors do not - implement the [[Construct]] internal method unless otherwise specified in - the description of a particular function. - - sec-evaluatenew - - ... - 7. If IsConstructor(constructor) is false, throw a TypeError exception. - ... -includes: [isConstructor.js, testTypedArray.js] -features: [TypedArray, change-array-by-copy, Reflect.construct] ----*/ - -assert.sameValue( - isConstructor(TypedArray.prototype.toSpliced), - false, - 'isConstructor(TypedArray.prototype.toSpliced) must return false' -); - -assert.throws(TypeError, () => { - new TypedArray.prototype.toSpliced(); -}, '`new %TypedArray%.prototype.toSpliced()` throws TypeError'); - diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-missing.js b/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-missing.js deleted file mode 100644 index 12d5696b028..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-missing.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: '%TypedArray%.prototype.toSpliced returns a copy of the TypedArray if called with zero arguments' -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced (start, deleteCount , ...items ) - - ... - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - ... - 7. Else, let actualStart be min(relativeStart, len). - 8. If start is not present, then - a. Let actualDeleteCount be 0. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([1, 2, 3]).toSpliced(); - - assert.compareArray(result, [1, 2, 3]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-undefineds.js b/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-undefineds.js deleted file mode 100644 index b9752bca1ad..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-and-deleteCount-undefineds.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: '%TypedArray%.prototype.toSpliced(undefined, undefined) returns a copy of the original TypedArray' -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced ( start, deleteCount , ...items ) - - ... - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - ... - 7. Else, let actualStart be min(relativeStart, len). - 8. If start is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be 0. - 9. Else if deleteCount is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be len - actualStart. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([1, 2, 3]).toSpliced(undefined, undefined); - - assert.compareArray(result, [1, 2, 3]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-bigger-than-length.js b/test/built-ins/TypedArray/prototype/toSpliced/start-bigger-than-length.js deleted file mode 100644 index b4f91e39d04..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-bigger-than-length.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced converts the this value length to a number. -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 3. Let len be O.[[ArrayLength]]. - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - 5. If relativeStart is -∞, let actualStart be 0. - 6. Else if relativeStart < 0, let actualStart be max(len + relativeStart, 0). - 7. Else, let actualStart be min(relativeStart, len). - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([0, 1, 2, 3, 4]).toSpliced(10, 1, 5, 6); - assert.compareArray(result, [0, 1, 2, 3, 4, 5, 6]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-infinity-is-zero.js b/test/built-ins/TypedArray/prototype/toSpliced/start-neg-infinity-is-zero.js deleted file mode 100644 index 952c3fb3e52..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-infinity-is-zero.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced converts the this value length to a number. -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 3. Let len be O.[[ArrayLength]]. - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - 5. If relativeStart is -∞, let actualStart be 0. - 6. Else if relativeStart < 0, let actualStart be max(len + relativeStart, 0). - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([0, 1, 2, 3, 4]).toSpliced(-Infinity, 2); - assert.compareArray(result, [2, 3, 4]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-less-than-minus-length-is-zero.js b/test/built-ins/TypedArray/prototype/toSpliced/start-neg-less-than-minus-length-is-zero.js deleted file mode 100644 index 6f66dcbcbae..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-less-than-minus-length-is-zero.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced converts the this value length to a number. -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 3. Let len be O.[[ArrayLength]]. - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - 5. If relativeStart is -∞, let actualStart be 0. - 6. Else if relativeStart < 0, let actualStart be max(len + relativeStart, 0). - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([0, 1, 2, 3, 4]).toSpliced(-20, 2); - assert.compareArray(result, [2, 3, 4]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-subtracted-from-length.js b/test/built-ins/TypedArray/prototype/toSpliced/start-neg-subtracted-from-length.js deleted file mode 100644 index 2f66b793ebe..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-neg-subtracted-from-length.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced converts the this value length to a number. -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount, ...items ) - - ... - 3. Let len be O.[[ArrayLength]]. - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - 5. If relativeStart is -∞, let actualStart be 0. - 6. Else if relativeStart < 0, let actualStart be max(len + relativeStart, 0). - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([0, 1, 2, 3, 4]).toSpliced(-3, 2); - assert.compareArray(result, [0, 1, 4]); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/start-undefined-and-deleteCount-missing.js b/test/built-ins/TypedArray/prototype/toSpliced/start-undefined-and-deleteCount-missing.js deleted file mode 100644 index 63b8c7e980f..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/start-undefined-and-deleteCount-missing.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: '%TypedArray%.prototype.toSpliced(undefined) returns an empty array' -info: | - 22.1.3.25 %TypedArray%.prototype.toSpliced ( start, deleteCount , ...items ) - - ... - 4. Let relativeStart be ? ToIntegerOrInfinity(start). - ... - 7. Else, let actualStart be min(relativeStart, len). - ... - 8. If start is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be 0. - 8. Else if deleteCount is not present, then - a. Let insertCount be 0. - b. Let actualDeleteCount be len - actualStart. - ... -includes: [testTypedArray.js, compareArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -testWithTypedArrayConstructors((TA) => { - var result = new TA([1, 2, 3]).toSpliced(undefined); - assert.compareArray(result, []); -}); diff --git a/test/built-ins/TypedArray/prototype/toSpliced/this-value-invalid.js b/test/built-ins/TypedArray/prototype/toSpliced/this-value-invalid.js deleted file mode 100644 index 2505ebdfd26..00000000000 --- a/test/built-ins/TypedArray/prototype/toSpliced/this-value-invalid.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2021 Igalia. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-%typedarray%.prototype.toSpliced -description: > - %TypedArray%.prototype.toSpliced throws if the receiver is null or undefined -info: | - %TypedArray%.prototype.toSpliced ( start, deleteCount , ...items ) - - 1. Let O be the this value. - 2. Perform ? ValidateTypedArray(O). - ... -includes: [testTypedArray.js] -features: [TypedArray, change-array-by-copy] ----*/ - -var invalidValues = { - 'null': null, - 'undefined': undefined, - 'true': true, - '"abc"': "abc", - '12': 12, - 'Symbol()': Symbol(), - '[1, 2, 3]': [1, 2, 3], - '{ 0: 1, 1: 2, 2: 3, length: 3 }': { 0: 1, 1: 2, 2: 3, length: 3 }, - 'Uint8Array.prototype': Uint8Array.prototype, -}; - -Object.keys(invalidValues).forEach(desc => { - var value = invalidValues[desc]; - assert.throws(TypeError, () => { - TypedArray.prototype.toSpliced.call(value); - }, `${desc} is not a valid TypedArray`); -});