diff --git a/test/staging/sm/TypedArray/at.js b/test/staging/sm/TypedArray/at.js index 224ea89c9c..52d22d9479 100644 --- a/test/staging/sm/TypedArray/at.js +++ b/test/staging/sm/TypedArray/at.js @@ -41,9 +41,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.at.call(invalidReceiver); - }, TypeError, "Assert that 'at' fails if this value is not a TypedArray"); + }, "Assert that 'at' fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/bug1526838.js b/test/staging/sm/TypedArray/bug1526838.js index 70a9d9a8ce..da4c5269cf 100644 --- a/test/staging/sm/TypedArray/bug1526838.js +++ b/test/staging/sm/TypedArray/bug1526838.js @@ -11,7 +11,7 @@ esid: pending ---*/ const testArray = [1n]; for (const constructor of anyTypedArrayConstructors) { - assertThrowsInstanceOf(() => new constructor(testArray), TypeError); - assertThrowsInstanceOf(() => new constructor(testArray.values()), TypeError); + assert.throws(TypeError, () => new constructor(testArray)); + assert.throws(TypeError, () => new constructor(testArray.values())); } diff --git a/test/staging/sm/TypedArray/constructor-buffer-sequence.js b/test/staging/sm/TypedArray/constructor-buffer-sequence.js index acab0e0f5d..cc273a7be6 100644 --- a/test/staging/sm/TypedArray/constructor-buffer-sequence.js +++ b/test/staging/sm/TypedArray/constructor-buffer-sequence.js @@ -70,8 +70,8 @@ function ValueReturning(value, detach) { for (let {buffer} of createBuffers()) { let constructor = ConstructorWithThrowingPrototype(); - assertThrowsInstanceOf(() => - Reflect.construct(Int32Array, [buffer, poisonedValue, 0], constructor), ExpectedError); + assert.throws(ExpectedError, () => + Reflect.construct(Int32Array, [buffer, poisonedValue, 0], constructor)); } // Ensure step 4 |AllocateTypedArray| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -79,8 +79,8 @@ for (let {buffer, detach} of createBuffers()) { let constructor = ConstructorWithThrowingPrototype(); detach(); - assertThrowsInstanceOf(() => - Reflect.construct(Int32Array, [buffer, 0, 0], constructor), ExpectedError); + assert.throws(ExpectedError, () => + Reflect.construct(Int32Array, [buffer, 0, 0], constructor)); } // Ensure step 4 |AllocateTypedArray| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -88,16 +88,16 @@ for (let {buffer, detach} of createBuffers()) { for (let {buffer, detach} of createBuffers()) { let constructor = ConstructorWithThrowingPrototype(detach); - assertThrowsInstanceOf(() => - Reflect.construct(Int32Array, [buffer, 0, 0], constructor), ExpectedError); + assert.throws(ExpectedError, () => + Reflect.construct(Int32Array, [buffer, 0, 0], constructor)); } // Ensure step 4 |AllocateTypedArray| is executed before step 8.a |ToIndex(length)|. for (let {buffer} of createBuffers()) { let constructor = ConstructorWithThrowingPrototype(); - assertThrowsInstanceOf(() => - Reflect.construct(Int32Array, [buffer, 0, poisonedValue], constructor), ExpectedError); + assert.throws(ExpectedError, () => + Reflect.construct(Int32Array, [buffer, 0, poisonedValue], constructor)); } // Ensure step 6 |ToIndex(byteOffset)| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -105,7 +105,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueThrowing(); detach(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, 0), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, 0)); } // Ensure step 6 |ToIndex(byteOffset)| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -113,14 +113,14 @@ for (let {buffer, detach} of createBuffers()) { for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueThrowing(detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, 0), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, 0)); } // Ensure step 6 |ToIndex(byteOffset)| is executed before step 8.a |ToIndex(length)|. for (let {buffer} of createBuffers()) { let byteOffset = ValueThrowing(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, poisonedValue), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, poisonedValue)); } // Ensure step 7 |offset modulo elementSize ≠ 0| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -128,7 +128,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 1; detach(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, 0), RangeError); + assert.throws(RangeError, () => new Int32Array(buffer, byteOffset, 0)); } // Ensure step 7 |offset modulo elementSize ≠ 0| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -136,12 +136,12 @@ for (let {buffer, detach} of createBuffers()) { for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueReturning(1, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, 0), RangeError); + assert.throws(RangeError, () => new Int32Array(buffer, byteOffset, 0)); } // Ensure step 7 |offset modulo elementSize ≠ 0| is executed before step 8.a |ToIndex(length)|. for (let {buffer} of createBuffers()) { - assertThrowsInstanceOf(() => new Int32Array(buffer, 1, poisonedValue), RangeError); + assert.throws(RangeError, () => new Int32Array(buffer, 1, poisonedValue)); } // Ensure step 8.a |ToIndex(length)| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -150,7 +150,7 @@ for (let {buffer, detach} of createBuffers()) { let length = ValueThrowing(); detach(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure step 8.a |ToIndex(length)| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -159,7 +159,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueReturning(0, detach); let length = ValueThrowing(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure step 8.a |ToIndex(length)| is executed before step 9 |IsDetachedBuffer(buffer)|. @@ -168,7 +168,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 0; let length = ValueThrowing(detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), ExpectedError); + assert.throws(ExpectedError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 11.a |bufferByteLength modulo elementSize ≠ 0|. @@ -176,7 +176,7 @@ for (let {buffer, detach} of createBuffers([1, 9])) { let byteOffset = 0; detach(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 11.a |bufferByteLength modulo elementSize ≠ 0|. @@ -184,7 +184,7 @@ for (let {buffer, detach} of createBuffers([1, 9])) { for (let {buffer, detach} of createBuffers([1, 9])) { let byteOffset = ValueReturning(0, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 11.c |newByteLength < 0|. @@ -192,7 +192,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 64; detach(); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 11.c |newByteLength < 0|. @@ -200,7 +200,7 @@ for (let {buffer, detach} of createBuffers()) { for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueReturning(64, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 12.b |offset+newByteLength > bufferByteLength|. @@ -209,7 +209,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 64; let length = ValueReturning(0, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure step 9 |IsDetachedBuffer(buffer)| is executed before step 12.b |offset+newByteLength > bufferByteLength|. @@ -218,7 +218,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 0; let length = ValueReturning(64, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure we handle the case when ToIndex(byteOffset) detaches the array buffer. @@ -226,7 +226,7 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = ValueReturning(0, detach); let length = 0; - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset, length)); } // Ensure we handle the case when ToIndex(length) detaches the array buffer. @@ -234,6 +234,6 @@ for (let {buffer, detach} of createBuffers()) { let byteOffset = 0; let length = ValueReturning(0, detach); - assertThrowsInstanceOf(() => new Int32Array(buffer, byteOffset, length), TypeError); + assert.throws(TypeError, () => new Int32Array(buffer, byteOffset, length)); } diff --git a/test/staging/sm/TypedArray/constructor-byteoffsets-bounds.js b/test/staging/sm/TypedArray/constructor-byteoffsets-bounds.js index 63c4ec004f..c4dc7c0f11 100644 --- a/test/staging/sm/TypedArray/constructor-byteoffsets-bounds.js +++ b/test/staging/sm/TypedArray/constructor-byteoffsets-bounds.js @@ -17,27 +17,27 @@ const ab = new ArrayBuffer(0); for (let TA of typedArrayConstructors) { // Test bound checks around INT32_MAX for |byteOffset| argument. - assertThrowsInstanceOf(() => new TA(ab, 2**31 - TA.BYTES_PER_ELEMENT), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**31 - 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**31), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**31 + 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**31 + TA.BYTES_PER_ELEMENT), RangeError); + assert.throws(RangeError, () => new TA(ab, 2**31 - TA.BYTES_PER_ELEMENT)); + assert.throws(RangeError, () => new TA(ab, 2**31 - 1)); + assert.throws(RangeError, () => new TA(ab, 2**31)); + assert.throws(RangeError, () => new TA(ab, 2**31 + 1)); + assert.throws(RangeError, () => new TA(ab, 2**31 + TA.BYTES_PER_ELEMENT)); // Test bound checks around UINT32_MAX for |byteOffset| argument. - assertThrowsInstanceOf(() => new TA(ab, 2**32 - TA.BYTES_PER_ELEMENT), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**32 - 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**32), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**32 + 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 2**32 + TA.BYTES_PER_ELEMENT), RangeError); + assert.throws(RangeError, () => new TA(ab, 2**32 - TA.BYTES_PER_ELEMENT)); + assert.throws(RangeError, () => new TA(ab, 2**32 - 1)); + assert.throws(RangeError, () => new TA(ab, 2**32)); + assert.throws(RangeError, () => new TA(ab, 2**32 + 1)); + assert.throws(RangeError, () => new TA(ab, 2**32 + TA.BYTES_PER_ELEMENT)); // Test bound checks around INT32_MAX for |length| argument. - assertThrowsInstanceOf(() => new TA(ab, 0, 2**31 - 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 0, 2**31), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 0, 2**31 + 1), RangeError); + assert.throws(RangeError, () => new TA(ab, 0, 2**31 - 1)); + assert.throws(RangeError, () => new TA(ab, 0, 2**31)); + assert.throws(RangeError, () => new TA(ab, 0, 2**31 + 1)); // Test bound checks around UINT32_MAX for |length| argument. - assertThrowsInstanceOf(() => new TA(ab, 0, 2**32 - 1), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 0, 2**32), RangeError); - assertThrowsInstanceOf(() => new TA(ab, 0, 2**32 + 1), RangeError); + assert.throws(RangeError, () => new TA(ab, 0, 2**32 - 1)); + assert.throws(RangeError, () => new TA(ab, 0, 2**32)); + assert.throws(RangeError, () => new TA(ab, 0, 2**32 + 1)); } diff --git a/test/staging/sm/TypedArray/constructor-iterator-primitive.js b/test/staging/sm/TypedArray/constructor-iterator-primitive.js index dc9fe4a7f8..79dbf65b55 100644 --- a/test/staging/sm/TypedArray/constructor-iterator-primitive.js +++ b/test/staging/sm/TypedArray/constructor-iterator-primitive.js @@ -30,9 +30,9 @@ for (let ctor of typedArrayConstructors) { return primitive; } }; - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { new ctor(arg); - }, TypeError); + }); } } diff --git a/test/staging/sm/TypedArray/constructor-non-detached.js b/test/staging/sm/TypedArray/constructor-non-detached.js index 8d61212a68..df9539733f 100644 --- a/test/staging/sm/TypedArray/constructor-non-detached.js +++ b/test/staging/sm/TypedArray/constructor-non-detached.js @@ -12,11 +12,11 @@ esid: pending for (var constructor of typedArrayConstructors) { var buf = new constructor(); $262.detachArrayBuffer(buf.buffer); - assertThrowsInstanceOf(() => new constructor(buf), TypeError); + assert.throws(TypeError, () => new constructor(buf)); var buffer = new ArrayBuffer(); $262.detachArrayBuffer(buffer); - assertThrowsInstanceOf(() => new constructor(buffer), TypeError); + assert.throws(TypeError, () => new constructor(buffer)); } diff --git a/test/staging/sm/TypedArray/constructor-not-callable.js b/test/staging/sm/TypedArray/constructor-not-callable.js index caf6ac0579..39bb1130f3 100644 --- a/test/staging/sm/TypedArray/constructor-not-callable.js +++ b/test/staging/sm/TypedArray/constructor-not-callable.js @@ -10,10 +10,10 @@ description: | esid: pending ---*/ for (var constructor of anyTypedArrayConstructors) { - assertThrowsInstanceOf(() => constructor(), TypeError); - assertThrowsInstanceOf(() => constructor(1), TypeError); - assertThrowsInstanceOf(() => constructor.call(null), TypeError); - assertThrowsInstanceOf(() => constructor.apply(null, []), TypeError); - assertThrowsInstanceOf(() => Reflect.apply(constructor, null, []), TypeError); + assert.throws(TypeError, () => constructor()); + assert.throws(TypeError, () => constructor(1)); + assert.throws(TypeError, () => constructor.call(null)); + assert.throws(TypeError, () => constructor.apply(null, [])); + assert.throws(TypeError, () => Reflect.apply(constructor, null, [])); } diff --git a/test/staging/sm/TypedArray/constructor_bad-args.js b/test/staging/sm/TypedArray/constructor_bad-args.js index b7ca2ca249..1da1e7fb25 100644 --- a/test/staging/sm/TypedArray/constructor_bad-args.js +++ b/test/staging/sm/TypedArray/constructor_bad-args.js @@ -14,9 +14,9 @@ esid: pending var AB = new ArrayBuffer(12); // Length divides 4 var BC = new ArrayBuffer(14); // Length does not divide 4 -assertThrowsInstanceOf(() => new Int32Array(AB, -1), RangeError); // 22.2.4.5 #8 -assertThrowsInstanceOf(() => new Int32Array(AB, 2), RangeError); // 22.2.4.5 #10 -assertThrowsInstanceOf(() => new Int32Array(BC), RangeError); // 22.2.4.5 #13.a -assertThrowsInstanceOf(() => new Int32Array(AB, 16), RangeError); // 22.2.4.5 #13.c -assertThrowsInstanceOf(() => new Int32Array(AB, 0, 4), RangeError); // 22.2.4.5 #14.c +assert.throws(RangeError, () => new Int32Array(AB, -1)); // 22.2.4.5 #8 +assert.throws(RangeError, () => new Int32Array(AB, 2)); // 22.2.4.5 #10 +assert.throws(RangeError, () => new Int32Array(BC)); // 22.2.4.5 #13.a +assert.throws(RangeError, () => new Int32Array(AB, 16)); // 22.2.4.5 #13.c +assert.throws(RangeError, () => new Int32Array(AB, 0, 4)); // 22.2.4.5 #14.c diff --git a/test/staging/sm/TypedArray/detached-array-buffer-checks.js b/test/staging/sm/TypedArray/detached-array-buffer-checks.js index 05f988a103..b40eda5810 100644 --- a/test/staging/sm/TypedArray/detached-array-buffer-checks.js +++ b/test/staging/sm/TypedArray/detached-array-buffer-checks.js @@ -30,87 +30,87 @@ var POISON = (function() { }); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.copyWithin(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.entries(); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.fill(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.filter(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.find(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.findIndex(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.forEach(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.indexOf(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.includes(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.join(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.keys(); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.lastIndexOf(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.map(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.reduce(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.reduceRight(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.reverse(); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.slice(POISON, POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.some(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.values(); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.every(POISON); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { array.sort(POISON); -}, TypeError); +}); diff --git a/test/staging/sm/TypedArray/entries.js b/test/staging/sm/TypedArray/entries.js index 5833b747d0..48e4d3dec9 100644 --- a/test/staging/sm/TypedArray/entries.js +++ b/test/staging/sm/TypedArray/entries.js @@ -39,9 +39,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.entries.call(invalidReceiver); - }, TypeError, "Assert that entries fails if this value is not a TypedArray"); + }, "Assert that entries fails if this value is not a TypedArray"); }); } diff --git a/test/staging/sm/TypedArray/every-and-some.js b/test/staging/sm/TypedArray/every-and-some.js index a1da925ea1..acd333f8ee 100644 --- a/test/staging/sm/TypedArray/every-and-some.js +++ b/test/staging/sm/TypedArray/every-and-some.js @@ -86,14 +86,14 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(count, 3); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.every(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.every(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -113,9 +113,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.every.call(invalidReceiver, () => true); - }, TypeError, "Assert that every fails if this value is not a TypedArray"); + }, "Assert that every fails if this value is not a TypedArray"); }); // Test that the length getter is never called. @@ -209,14 +209,14 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(count, 3); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.some(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.some(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -239,9 +239,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.some.call(invalidReceiver, () => true); - }, TypeError, "Assert that some fails if this value is not a TypedArray"); + }, "Assert that some fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/fill-detached.js b/test/staging/sm/TypedArray/fill-detached.js index 50c29c265b..48d20069e5 100644 --- a/test/staging/sm/TypedArray/fill-detached.js +++ b/test/staging/sm/TypedArray/fill-detached.js @@ -33,13 +33,13 @@ function DetachTypedArrayValue(ta, value) { for (let length of [0, 1, 10, 4096]) { let ta = new Int32Array(length); let value = DetachArrayBufferValue(ta.buffer, 123); - assertThrowsInstanceOf(() => ta.fill(value), TypeError); + assert.throws(TypeError, () => ta.fill(value)); } // Test when ArrayBuffer is reified during the fill() call. for (let length of [0, 1, 10, 4096]) { let ta = new Int32Array(length); let value = DetachTypedArrayValue(ta, 123); - assertThrowsInstanceOf(() => ta.fill(value), TypeError); + assert.throws(TypeError, () => ta.fill(value)); } diff --git a/test/staging/sm/TypedArray/fill.js b/test/staging/sm/TypedArray/fill.js index 2d661a2552..8ee8b8712b 100644 --- a/test/staging/sm/TypedArray/fill.js +++ b/test/staging/sm/TypedArray/fill.js @@ -55,9 +55,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.fill.call(invalidReceiver, 1); - }, TypeError); + }); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/find-and-findIndex.js b/test/staging/sm/TypedArray/find-and-findIndex.js index 626289fd9c..cbb5d0f607 100644 --- a/test/staging/sm/TypedArray/find-and-findIndex.js +++ b/test/staging/sm/TypedArray/find-and-findIndex.js @@ -35,11 +35,11 @@ anyTypedArrayConstructors.forEach(constructor => { thisValues.push(Symbol()); thisValues.forEach(thisArg => - assertThrowsInstanceOf(() => arr[method].call(thisArg, () => true), TypeError) + assert.throws(TypeError, () => arr[method].call(thisArg, () => true)) ); - assertThrowsInstanceOf(() => arr[method](), TypeError); - assertThrowsInstanceOf(() => arr[method](1), TypeError); + assert.throws(TypeError, () => arr[method]()); + assert.throws(TypeError, () => arr[method](1)); }); }); diff --git a/test/staging/sm/TypedArray/findLast-and-findLastIndex.js b/test/staging/sm/TypedArray/findLast-and-findLastIndex.js index 3590f924ca..f9810141ca 100644 --- a/test/staging/sm/TypedArray/findLast-and-findLastIndex.js +++ b/test/staging/sm/TypedArray/findLast-and-findLastIndex.js @@ -35,11 +35,11 @@ anyTypedArrayConstructors.forEach(constructor => { thisValues.push(Symbol()); thisValues.forEach(thisArg => - assertThrowsInstanceOf(() => arr[method].call(thisArg, () => true), TypeError) + assert.throws(TypeError, () => arr[method].call(thisArg, () => true)) ); - assertThrowsInstanceOf(() => arr[method](), TypeError); - assertThrowsInstanceOf(() => arr[method](1), TypeError); + assert.throws(TypeError, () => arr[method]()); + assert.throws(TypeError, () => arr[method](1)); }); }); diff --git a/test/staging/sm/TypedArray/forEach.js b/test/staging/sm/TypedArray/forEach.js index b4e3dd4c42..93a202e2a3 100644 --- a/test/staging/sm/TypedArray/forEach.js +++ b/test/staging/sm/TypedArray/forEach.js @@ -65,14 +65,14 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(count, 3); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.forEach(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.forEach(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -94,9 +94,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.forEach.call(invalidReceiver, () => true); - }, TypeError, "Assert that some fails if this value is not a TypedArray"); + }, "Assert that some fails if this value is not a TypedArray"); }); } diff --git a/test/staging/sm/TypedArray/from_constructor.js b/test/staging/sm/TypedArray/from_constructor.js index 4c2966c075..3e1589642c 100644 --- a/test/staging/sm/TypedArray/from_constructor.js +++ b/test/staging/sm/TypedArray/from_constructor.js @@ -25,9 +25,9 @@ for (var constructor of anyTypedArrayConstructors) { () => ({}) // arrow functions are not constructors ]; for (var v of nonconstructors) { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.from.call(v, arr); - }, TypeError); + }); } // %TypedArray%.from does not get confused if global constructors for typed arrays diff --git a/test/staging/sm/TypedArray/from_errors.js b/test/staging/sm/TypedArray/from_errors.js index b51a8140b1..454be0d9fc 100644 --- a/test/staging/sm/TypedArray/from_errors.js +++ b/test/staging/sm/TypedArray/from_errors.js @@ -11,9 +11,9 @@ esid: pending ---*/ for (var constructor of anyTypedArrayConstructors) { // %TypedArray%.from throws if the argument is undefined or null. - assertThrowsInstanceOf(() => constructor.from(), TypeError); - assertThrowsInstanceOf(() => constructor.from(undefined), TypeError); - assertThrowsInstanceOf(() => constructor.from(null), TypeError); + assert.throws(TypeError, () => constructor.from()); + assert.throws(TypeError, () => constructor.from(undefined)); + assert.throws(TypeError, () => constructor.from(null)); // Unlike Array.from, %TypedArray%.from doesn't get or set the length property. function ObjectWithThrowingLengthGetterSetter(...rest) { @@ -29,12 +29,12 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(ObjectWithThrowingLengthGetterSetter.from([123])[0], 123); // %TypedArray%.from throws if mapfn is neither callable nor undefined. - assertThrowsInstanceOf(() => constructor.from([3, 4, 5], {}), TypeError); - assertThrowsInstanceOf(() => constructor.from([3, 4, 5], "also not a function"), TypeError); - assertThrowsInstanceOf(() => constructor.from([3, 4, 5], null), TypeError); + assert.throws(TypeError, () => constructor.from([3, 4, 5], {})); + assert.throws(TypeError, () => constructor.from([3, 4, 5], "also not a function")); + assert.throws(TypeError, () => constructor.from([3, 4, 5], null)); // Even if the function would not have been called. - assertThrowsInstanceOf(() => constructor.from([], JSON), TypeError); + assert.throws(TypeError, () => constructor.from([], JSON)); // If mapfn is not undefined and not callable, the error happens before anything else. // Before calling the constructor, before touching the arrayLike. @@ -50,7 +50,7 @@ for (var constructor of anyTypedArrayConstructors) { get: function () { log += "2"; }, getOwnPropertyDescriptor: function () { log += "3"; } }); - assertThrowsInstanceOf(() => constructor.from.call(C, p, {}), TypeError); + assert.throws(TypeError, () => constructor.from.call(C, p, {})); assert.sameValue(log, ""); // If mapfn throws, the new object has already been created. @@ -66,20 +66,19 @@ for (var constructor of anyTypedArrayConstructors) { // It's a TypeError if the @@iterator property is a primitive (except null and undefined). for (var primitive of ["foo", 17, Symbol(), true]) { - assertThrowsInstanceOf(() => constructor.from({[Symbol.iterator] : primitive}), TypeError); + assert.throws(TypeError, () => constructor.from({[Symbol.iterator] : primitive})); } assert.deepEqual(constructor.from({[Symbol.iterator]: null}), new constructor()); assert.deepEqual(constructor.from({[Symbol.iterator]: undefined}), new constructor()); // It's a TypeError if the iterator's .next() method returns a primitive. for (var primitive of [undefined, null, "foo", 17, Symbol(), true]) { - assertThrowsInstanceOf( + assert.throws(TypeError, () => constructor.from({ [Symbol.iterator]() { return {next() { return primitive; }}; } - }), - TypeError); + })); } } diff --git a/test/staging/sm/TypedArray/from_surfaces.js b/test/staging/sm/TypedArray/from_surfaces.js index d7c23a91f9..7d1f79946d 100644 --- a/test/staging/sm/TypedArray/from_surfaces.js +++ b/test/staging/sm/TypedArray/from_surfaces.js @@ -16,6 +16,6 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(desc.enumerable, false); assert.sameValue(desc.writable, true); assert.sameValue(constructor.from.length, 1); - assertThrowsInstanceOf(() => new constructor.from(), TypeError); // not a constructor + assert.throws(TypeError, () => new constructor.from()); // not a constructor } diff --git a/test/staging/sm/TypedArray/from_typedarray_fastpath_detached.js b/test/staging/sm/TypedArray/from_typedarray_fastpath_detached.js index 3bea29117e..3af00f8b1d 100644 --- a/test/staging/sm/TypedArray/from_typedarray_fastpath_detached.js +++ b/test/staging/sm/TypedArray/from_typedarray_fastpath_detached.js @@ -15,5 +15,5 @@ esid: pending var ta = new Int32Array(4); $262.detachArrayBuffer(ta.buffer); -assertThrowsInstanceOf(() => Int32Array.from(ta), TypeError); +assert.throws(TypeError, () => Int32Array.from(ta)); diff --git a/test/staging/sm/TypedArray/includes.js b/test/staging/sm/TypedArray/includes.js index d88a5babf9..833ef00c93 100644 --- a/test/staging/sm/TypedArray/includes.js +++ b/test/staging/sm/TypedArray/includes.js @@ -34,9 +34,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.includes.call(invalidReceiver); - }, TypeError, "Assert that reverse fails if this value is not a TypedArray"); + }, "Assert that reverse fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/indexOf-and-lastIndexOf.js b/test/staging/sm/TypedArray/indexOf-and-lastIndexOf.js index 020d6956a7..da5e966f12 100644 --- a/test/staging/sm/TypedArray/indexOf-and-lastIndexOf.js +++ b/test/staging/sm/TypedArray/indexOf-and-lastIndexOf.js @@ -43,9 +43,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.indexOf.call(invalidReceiver); - }, TypeError, "Assert that indexOf fails if this value is not a TypedArray"); + }, "Assert that indexOf fails if this value is not a TypedArray"); }); // test that this.length is never called @@ -104,9 +104,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.lastIndexOf.call(invalidReceiver); - }, TypeError, "Assert that lastIndexOf fails if this value is not a TypedArray"); + }, "Assert that lastIndexOf fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/iterator-next-with-detached.js b/test/staging/sm/TypedArray/iterator-next-with-detached.js index ba21fbca98..8c4ed8c496 100644 --- a/test/staging/sm/TypedArray/iterator-next-with-detached.js +++ b/test/staging/sm/TypedArray/iterator-next-with-detached.js @@ -68,14 +68,14 @@ if (typeof $262.detachArrayBuffer === "function" && typeof createNewGlobal === " checkResult(thisNext.call(iterator), {value: 2, done: false}); bufferGlobal.$262.detachArrayBuffer(buffer); - assertThrowsInstanceOf(() => thisNext.call(iterator), TypeError); + assert.throws(TypeError, () => thisNext.call(iterator)); // Test an unexhausted iterator. [arr, buffer, iterator] = arrayBufferIterator(); checkResult(thisNext.call(iterator), {value: 1, done: false}); bufferGlobal.$262.detachArrayBuffer(buffer); - assertThrowsInstanceOf(() => thisNext.call(iterator), TypeError); + assert.throws(TypeError, () => thisNext.call(iterator)); } } } diff --git a/test/staging/sm/TypedArray/join.js b/test/staging/sm/TypedArray/join.js index fc99bc0953..3eddb899c5 100644 --- a/test/staging/sm/TypedArray/join.js +++ b/test/staging/sm/TypedArray/join.js @@ -25,8 +25,8 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(new constructor(1).join(), "0"); assert.sameValue(new constructor(3).join(), "0,0,0"); - assertThrowsInstanceOf(() => new constructor().join({toString(){throw new TypeError}}), TypeError); - assertThrowsInstanceOf(() => new constructor().join(Symbol()), TypeError); + assert.throws(TypeError, () => new constructor().join({toString(){throw new TypeError}})); + assert.throws(TypeError, () => new constructor().join(Symbol())); // Called from other globals. if (typeof createNewGlobal === "function") { @@ -38,9 +38,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.join.call(invalidReceiver); - }, TypeError, "Assert that join fails if this value is not a TypedArray"); + }, "Assert that join fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/keys.js b/test/staging/sm/TypedArray/keys.js index ff539d43e5..0763a2ca70 100644 --- a/test/staging/sm/TypedArray/keys.js +++ b/test/staging/sm/TypedArray/keys.js @@ -37,9 +37,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.keys.call(invalidReceiver); - }, TypeError, "Assert that keys fails if this value is not a TypedArray"); + }, "Assert that keys fails if this value is not a TypedArray"); }); } diff --git a/test/staging/sm/TypedArray/map-and-filter.js b/test/staging/sm/TypedArray/map-and-filter.js index 0d9c52e810..ce8ea0e761 100644 --- a/test/staging/sm/TypedArray/map-and-filter.js +++ b/test/staging/sm/TypedArray/map-and-filter.js @@ -94,14 +94,14 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(count, 3); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.map(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.map(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -121,9 +121,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.filter.call(invalidReceiver, () => true); - }, TypeError, "Assert that map fails if this value is not a TypedArray"); + }, "Assert that map fails if this value is not a TypedArray"); }); // Test that the length getter is never called. @@ -218,14 +218,14 @@ for (var constructor of anyTypedArrayConstructors) { assert.sameValue(count, 3); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.filter(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.filter(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -246,9 +246,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.filter.call(invalidReceiver, () => true); - }, TypeError, "Assert that filter fails if this value is not a TypedArray"); + }, "Assert that filter fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/object-defineproperty.js b/test/staging/sm/TypedArray/object-defineproperty.js index 05a10eaef3..2b3c14be8c 100644 --- a/test/staging/sm/TypedArray/object-defineproperty.js +++ b/test/staging/sm/TypedArray/object-defineproperty.js @@ -32,8 +32,8 @@ var throws = [ ]; for (var desc of throws) { - assertThrowsInstanceOf(function() { Object.defineProperty(obj, 0, desc); }, TypeError); - assertThrowsInstanceOf(function() { Object.defineProperties(obj, {0: desc}); }, TypeError); + assert.throws(TypeError, function() { Object.defineProperty(obj, 0, desc); }); + assert.throws(TypeError, function() { Object.defineProperties(obj, {0: desc}); }); } Object.defineProperty(obj, 0, {}); diff --git a/test/staging/sm/TypedArray/of.js b/test/staging/sm/TypedArray/of.js index 5b4c10a636..77f2877e77 100644 --- a/test/staging/sm/TypedArray/of.js +++ b/test/staging/sm/TypedArray/of.js @@ -27,8 +27,8 @@ for (var constructor of anyTypedArrayConstructors) { assert.deepEqual(constructor.of("1", "2", "3"), new constructor([1, 2, 3])); // This method can't be transplanted to other constructors. - assertThrowsInstanceOf(() => constructor.of.call(Array), TypeError); - assertThrowsInstanceOf(() => constructor.of.call(Array, 1, 2, 3), TypeError); + assert.throws(TypeError, () => constructor.of.call(Array)); + assert.throws(TypeError, () => constructor.of.call(Array, 1, 2, 3)); var hits = 0; assert.deepEqual(constructor.of.call(function(len) { @@ -51,40 +51,40 @@ for (var constructor of anyTypedArrayConstructors) { var invalidConstructors = [undefined, null, 1, false, "", Symbol(), [], {}, /./, constructor.of, () => {}]; invalidConstructors.forEach(C => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call(C); - }, TypeError); + }); }); // Throw if `this` is a method definition or a getter/setter function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call({method() {}}.method); - }, TypeError); - assertThrowsInstanceOf(() => { + }); + assert.throws(TypeError, () => { constructor.of.call(Object.getOwnPropertyDescriptor({get getter() {}}, "getter").get); - }, TypeError); + }); // Generators are not legal constructors. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call(function*(len) { return len; }, "a") - }, TypeError); + }); // An exception might be thrown in a strict assignment to the new object's indexed properties. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call(function() { return {get 0() {}}; }, "a"); - }, TypeError); + }); - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call(function() { return Object("1"); }, "a"); - }, TypeError); + }); - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.of.call(function() { return Object.create({ set 0(v) { @@ -92,7 +92,7 @@ for (var constructor of anyTypedArrayConstructors) { } }); }, "a"); - }, TypeError); + }); } for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) { diff --git a/test/staging/sm/TypedArray/reduce-and-reduceRight.js b/test/staging/sm/TypedArray/reduce-and-reduceRight.js index 9b4b2848e4..e5bb47aa35 100644 --- a/test/staging/sm/TypedArray/reduce-and-reduceRight.js +++ b/test/staging/sm/TypedArray/reduce-and-reduceRight.js @@ -51,7 +51,7 @@ for (var constructor of anyTypedArrayConstructors) { // Throw an exception in the callback. var count = 0; var sum = 0; - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduce((previous, current, index, array) => { count++; sum += current; @@ -59,19 +59,19 @@ for (var constructor of anyTypedArrayConstructors) { throw TypeError("reduce"); } }) - }, TypeError); + }); assert.sameValue(count, 3); assert.sameValue(sum, 9); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduce(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduce(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -89,9 +89,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(3), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.reduce.call(invalidReceiver, () => {}); - }, TypeError, "Assert that reduce fails if this value is not a TypedArray"); + }, "Assert that reduce fails if this value is not a TypedArray"); }); // Test that the length getter is never called. @@ -144,7 +144,7 @@ for (var constructor of anyTypedArrayConstructors) { // Throw an exception in the callback. var count = 0; var sum = 0; - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduceRight((previous, current, index, array) => { count++; sum += current; @@ -152,19 +152,19 @@ for (var constructor of anyTypedArrayConstructors) { throw TypeError("reduceRight"); } }) - }, TypeError); + }); assert.sameValue(count, 3); assert.sameValue(sum, 9); // There is no callback or callback is not a function. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduceRight(); - }, TypeError); + }); var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./]; invalidCallbacks.forEach(callback => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { arr.reduceRight(callback); - }, TypeError); + }); }) // Callback is a generator. @@ -182,9 +182,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(3), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.reduceRight.call(invalidReceiver, () => {}); - }, TypeError, "Assert that reduceRight fails if this value is not a TypedArray"); + }, "Assert that reduceRight fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/reverse.js b/test/staging/sm/TypedArray/reverse.js index 77faa15f6d..3b2fb0165e 100644 --- a/test/staging/sm/TypedArray/reverse.js +++ b/test/staging/sm/TypedArray/reverse.js @@ -32,9 +32,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.reverse.call(invalidReceiver); - }, TypeError, "Assert that reverse fails if this value is not a TypedArray"); + }, "Assert that reverse fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/seal-and-freeze.js b/test/staging/sm/TypedArray/seal-and-freeze.js index cdd45aabcb..67959f7b93 100644 --- a/test/staging/sm/TypedArray/seal-and-freeze.js +++ b/test/staging/sm/TypedArray/seal-and-freeze.js @@ -29,9 +29,9 @@ assert.sameValue(Object.isSealed(array), false); array = new Int32Array(2); array.b = "test"; -assertThrowsInstanceOf(() => Object.seal(array), TypeError); +assert.throws(TypeError, () => Object.seal(array)); assert.sameValue(Object.isSealed(array), false); -assertThrowsInstanceOf(() => array.c = 15, TypeError); +assert.throws(TypeError, () => array.c = 15); // Freeze assert.sameValue(Object.isFrozen(new Int32Array(2)), false); @@ -52,7 +52,7 @@ assert.sameValue(Object.isFrozen(array), true); // Non-empty typed arrays can never be frozen, because the elements stay writable array = new Int32Array(1); -assertThrowsInstanceOf(() => Object.freeze(array), TypeError); +assert.throws(TypeError, () => Object.freeze(array)); assert.sameValue(Object.isExtensible(array), false); assert.sameValue(Object.isFrozen(array), false); diff --git a/test/staging/sm/TypedArray/set-detached-bigint.js b/test/staging/sm/TypedArray/set-detached-bigint.js index 9d9bea7ada..d6e17fc514 100644 --- a/test/staging/sm/TypedArray/set-detached-bigint.js +++ b/test/staging/sm/TypedArray/set-detached-bigint.js @@ -24,5 +24,5 @@ let obj = { }; // Throws a SyntaxError, because "huzzah!" can't be parsed as a BigInt. -assertThrowsInstanceOf(() => ta.set(obj), SyntaxError); +assert.throws(SyntaxError, () => ta.set(obj)); diff --git a/test/staging/sm/TypedArray/set-detached.js b/test/staging/sm/TypedArray/set-detached.js index 28fc476f40..d8c35dca88 100644 --- a/test/staging/sm/TypedArray/set-detached.js +++ b/test/staging/sm/TypedArray/set-detached.js @@ -27,11 +27,11 @@ if (typeof $262.detachArrayBuffer === "function") { for (let {typedArray, buffer} of createTypedArrays()) { $262.detachArrayBuffer(buffer); - assertThrowsInstanceOf(() => typedArray.set(null, { + assert.throws(ExpectedError, () => typedArray.set(null, { valueOf() { throw new ExpectedError(); } - }), ExpectedError); + })); } // Check for detached buffer after calling ToInteger(offset). Test with: @@ -41,12 +41,12 @@ if (typeof $262.detachArrayBuffer === "function") { for (let [offset, error] of [[0, TypeError], [1000000, TypeError], [-1, RangeError]]) { for (let source of [[], [0], new Int32Array(0), new Int32Array(1)]) { for (let {typedArray, buffer} of createTypedArrays()) { - assertThrowsInstanceOf(() => typedArray.set(source, { + assert.throws(error, () => typedArray.set(source, { valueOf() { $262.detachArrayBuffer(buffer); return offset; } - }), error); + })); } } } @@ -56,11 +56,11 @@ if (typeof $262.detachArrayBuffer === "function") { for (let {typedArray: source, buffer: sourceBuffer} of createTypedArrays()) { $262.detachArrayBuffer(sourceBuffer); - assertThrowsInstanceOf(() => typedArray.set(source, { + assert.throws(ExpectedError, () => typedArray.set(source, { valueOf() { throw new ExpectedError(); } - }), ExpectedError); + })); } } @@ -71,12 +71,12 @@ if (typeof $262.detachArrayBuffer === "function") { for (let [offset, error] of [[0, TypeError], [1000000, TypeError], [-1, RangeError]]) { for (let {typedArray} of createTypedArrays()) { for (let {typedArray: source, buffer: sourceBuffer} of createTypedArrays()) { - assertThrowsInstanceOf(() => typedArray.set(source, { + assert.throws(error, () => typedArray.set(source, { valueOf() { $262.detachArrayBuffer(sourceBuffer); return offset; } - }), error); + })); } } } @@ -89,12 +89,12 @@ if (typeof $262.detachArrayBuffer === "function") { for (let src of [ta => ta, ta => new Int32Array(ta.buffer), ta => new Float32Array(ta.buffer)]) { for (let {typedArray, buffer} of createTypedArrays()) { let source = src(typedArray); - assertThrowsInstanceOf(() => typedArray.set(source, { + assert.throws(TypeError, () => typedArray.set(source, { valueOf() { $262.detachArrayBuffer(buffer); return 0; } - }), TypeError); + })); } } @@ -142,7 +142,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }; if (typedArray.length === 0) { - assertThrowsInstanceOf(() => typedArray.set(source), RangeError); + assert.throws(RangeError, () => typedArray.set(source)); } else { typedArray.set(source); } @@ -162,7 +162,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }; let err = typedArray.length === 0 ? RangeError : ExpectedError; - assertThrowsInstanceOf(() => typedArray.set(source), err); + assert.throws(err, () => typedArray.set(source)); } // Same as above, but with side-effect when executing ToNumber(Get(src, "0")). @@ -183,7 +183,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }; let err = typedArray.length === 0 ? RangeError : ExpectedError; - assertThrowsInstanceOf(() => typedArray.set(source), err); + assert.throws(err, () => typedArray.set(source)); } // Side-effects when getting the source elements detach the buffer. @@ -197,7 +197,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }); if (typedArray.length === 0) { - assertThrowsInstanceOf(() => typedArray.set(source), RangeError); + assert.throws(RangeError, () => typedArray.set(source)); } else { typedArray.set(source); } @@ -223,7 +223,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }); if (typedArray.length <= 1) { - assertThrowsInstanceOf(() => typedArray.set(source), RangeError); + assert.throws(RangeError, () => typedArray.set(source)); } else { assert.sameValue(accessed, false); typedArray.set(source); @@ -240,7 +240,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }]; if (typedArray.length === 0) { - assertThrowsInstanceOf(() => typedArray.set(source), RangeError); + assert.throws(RangeError, () => typedArray.set(source)); } else { typedArray.set(source); } @@ -263,7 +263,7 @@ if (typeof $262.detachArrayBuffer === "function") { } }]; if (typedArray.length <= 1) { - assertThrowsInstanceOf(() => typedArray.set(source), RangeError); + assert.throws(RangeError, () => typedArray.set(source)); } else { assert.sameValue(accessed, false); typedArray.set(source); diff --git a/test/staging/sm/TypedArray/set-tointeger.js b/test/staging/sm/TypedArray/set-tointeger.js index 1788910885..1785b742f0 100644 --- a/test/staging/sm/TypedArray/set-tointeger.js +++ b/test/staging/sm/TypedArray/set-tointeger.js @@ -83,7 +83,7 @@ let invalidOffsets = [ for (let offset of invalidOffsets) { for (let source of sources) { - assertThrowsInstanceOf(() => ta.set(source, offset), RangeError); + assert.throws(RangeError, () => ta.set(source, offset)); } } @@ -93,12 +93,12 @@ for (let source of emptySources) { ta.set(source, 4.9); } for (let source of nonEmptySource) { - assertThrowsInstanceOf(() => ta.set(source, 4), RangeError); - assertThrowsInstanceOf(() => ta.set(source, 4.9), RangeError); + assert.throws(RangeError, () => ta.set(source, 4)); + assert.throws(RangeError, () => ta.set(source, 4.9)); } // ToInteger(symbol value) throws a TypeError. for (let source of sources) { - assertThrowsInstanceOf(() => ta.set(source, Symbol()), TypeError); + assert.throws(TypeError, () => ta.set(source, Symbol())); } diff --git a/test/staging/sm/TypedArray/set-toobject.js b/test/staging/sm/TypedArray/set-toobject.js index 544e379605..0bfe5548f6 100644 --- a/test/staging/sm/TypedArray/set-toobject.js +++ b/test/staging/sm/TypedArray/set-toobject.js @@ -15,15 +15,15 @@ let ta = new Int32Array(4); for (let nullOrUndefined of [null, undefined]) { // ToObject(array) throws a TypeError when |array| is null or undefined. - assertThrowsInstanceOf(() => ta.set(nullOrUndefined), TypeError); + assert.throws(TypeError, () => ta.set(nullOrUndefined)); // ToInteger(offset) is called before ToObject(array). class ExpectedError extends Error {} - assertThrowsInstanceOf(() => ta.set(nullOrUndefined, { + assert.throws(ExpectedError, () => ta.set(nullOrUndefined, { valueOf() { throw new ExpectedError(); } - }), ExpectedError); + })); } // Ensure ta is still initialized with zeros. @@ -37,7 +37,7 @@ ta.set("123"); assert.compareArray(ta, [1, 2, 3, 0]); // Throws a RangeError if the length is too large. -assertThrowsInstanceOf(() => ta.set("456789"), RangeError); +assert.throws(RangeError, () => ta.set("456789")); assert.compareArray(ta, [1, 2, 3, 0]); // When called with other primitive values the typed array contents don't diff --git a/test/staging/sm/TypedArray/set-wrapped.js b/test/staging/sm/TypedArray/set-wrapped.js index 7a56c9a3be..975fce9752 100644 --- a/test/staging/sm/TypedArray/set-wrapped.js +++ b/test/staging/sm/TypedArray/set-wrapped.js @@ -45,7 +45,7 @@ if (typeof createNewGlobal === "function") { // Called with wrapped typed array, array buffer already detached. otherGlobal.$262.detachArrayBuffer(source.buffer); - assertThrowsInstanceOf(() => target.set(source), TypeError); + assert.throws(TypeError, () => target.set(source)); var source = new otherGlobal[TA.name](1); taintLengthProperty(source); @@ -58,7 +58,7 @@ if (typeof createNewGlobal === "function") { return 0; } }; - assertThrowsInstanceOf(() => target.set(source, offset), TypeError); + assert.throws(TypeError, () => target.set(source, offset)); } // Create typed array from different global (implictly created when @@ -70,7 +70,7 @@ if (typeof createNewGlobal === "function") { // Called with wrapped typed array, array buffer already detached. otherGlobal.$262.detachArrayBuffer(source.buffer); - assertThrowsInstanceOf(() => target.set(source), TypeError); + assert.throws(TypeError, () => target.set(source)); var source = new TA(new otherGlobal.ArrayBuffer(1 * TA.BYTES_PER_ELEMENT)); taintLengthProperty(source); @@ -83,7 +83,7 @@ if (typeof createNewGlobal === "function") { return 0; } }; - assertThrowsInstanceOf(() => target.set(source, offset), TypeError); + assert.throws(TypeError, () => target.set(source, offset)); } } } diff --git a/test/staging/sm/TypedArray/slice-detached.js b/test/staging/sm/TypedArray/slice-detached.js index 756098dece..b8a9c97dcd 100644 --- a/test/staging/sm/TypedArray/slice-detached.js +++ b/test/staging/sm/TypedArray/slice-detached.js @@ -32,9 +32,9 @@ if (typeof $262.detachArrayBuffer === "function") { // ArrayBuffer is detached when entering slice(). for (let {typedArray, buffer} of createTypedArrays()) { $262.detachArrayBuffer(buffer()); - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { typedArray.slice(0); - }, TypeError, "ArrayBuffer is detached on function entry"); + }, "ArrayBuffer is detached on function entry"); } // ArrayBuffer is detached when computing ToInteger(start). @@ -54,9 +54,9 @@ if (typeof $262.detachArrayBuffer === "function") { if (length === 0) { typedArray.slice(start); } else { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { typedArray.slice(start); - }, TypeError, "ArrayBuffer is detached in ToInteger(start)"); + }, "ArrayBuffer is detached in ToInteger(start)"); } assert.sameValue(detached, true, "$262.detachArrayBuffer was called"); } @@ -78,9 +78,9 @@ if (typeof $262.detachArrayBuffer === "function") { if (length === 0) { typedArray.slice(0, end); } else { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { typedArray.slice(0, end); - }, TypeError, "ArrayBuffer is detached in ToInteger(end)"); + }, "ArrayBuffer is detached in ToInteger(end)"); } assert.sameValue(detached, true, "$262.detachArrayBuffer was called"); } @@ -102,9 +102,9 @@ if (typeof $262.detachArrayBuffer === "function") { if (length === 0) { typedArray.slice(0); } else { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { typedArray.slice(0); - }, TypeError, "ArrayBuffer is detached in TypedArraySpeciesCreate(...)"); + }, "ArrayBuffer is detached in TypedArraySpeciesCreate(...)"); } assert.sameValue(detached, true, "$262.detachArrayBuffer was called"); } diff --git a/test/staging/sm/TypedArray/slice-species.js b/test/staging/sm/TypedArray/slice-species.js index 3cc295f397..4bf8f0767f 100644 --- a/test/staging/sm/TypedArray/slice-species.js +++ b/test/staging/sm/TypedArray/slice-species.js @@ -15,11 +15,11 @@ for (var constructor of typedArrayConstructors) { undefConstructor.constructor = undefined; assert.deepEqual(undefConstructor.slice(1), new constructor(1)); - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { var strConstructor = new constructor; strConstructor.constructor = "not a constructor"; strConstructor.slice(123); - }, TypeError, "Assert that we have an invalid constructor"); + }, "Assert that we have an invalid constructor"); // If obj.constructor[@@species] is undefined or null then the default // constructor is used. @@ -49,10 +49,10 @@ for (var constructor of typedArrayConstructors) { // If obj.constructor[@@species] is neither undefined nor null, and it's // not a constructor, TypeError should be thrown. - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { var strSpecies = new constructor; strSpecies.constructor = { [Symbol.species]: "not a constructor" }; strSpecies.slice(123); - }, TypeError); + }); } diff --git a/test/staging/sm/TypedArray/slice.js b/test/staging/sm/TypedArray/slice.js index 3d1838fc69..1a8ca3c879 100644 --- a/test/staging/sm/TypedArray/slice.js +++ b/test/staging/sm/TypedArray/slice.js @@ -38,9 +38,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.slice.call(invalidReceiver, 0); - }, TypeError, "Assert that slice fails if this value is not a TypedArray"); + }, "Assert that slice fails if this value is not a TypedArray"); }); // Test that the length getter is never called. diff --git a/test/staging/sm/TypedArray/sort-non-function.js b/test/staging/sm/TypedArray/sort-non-function.js index fcfde5f1bf..3de49b292c 100644 --- a/test/staging/sm/TypedArray/sort-non-function.js +++ b/test/staging/sm/TypedArray/sort-non-function.js @@ -18,7 +18,7 @@ const typedArray = new Int32Array(0); // Throws if the comparator is neither undefined nor callable. for (let invalidComparator of [null, 0, true, Symbol(), {}, []]) { - assertThrowsInstanceOf(() => typedArray.sort(invalidComparator), TypeError); + assert.throws(TypeError, () => typedArray.sort(invalidComparator)); } // Doesn't throw if the comparator is undefined or a callable object. diff --git a/test/staging/sm/TypedArray/sort_errors.js b/test/staging/sm/TypedArray/sort_errors.js index 8c6c22d3ed..a8f2b9a259 100644 --- a/test/staging/sm/TypedArray/sort_errors.js +++ b/test/staging/sm/TypedArray/sort_errors.js @@ -11,12 +11,12 @@ esid: pending ---*/ // Ensure that TypedArrays throw when attempting to sort a detached ArrayBuffer if (typeof $262.detachArrayBuffer === "function") { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { let buffer = new ArrayBuffer(32); let array = new Int32Array(buffer); $262.detachArrayBuffer(buffer); array.sort(); - }, TypeError); + }); } // Ensure detaching buffer in comparator doesn't throw an error. @@ -58,23 +58,23 @@ if (typeof createNewGlobal === "function" && typeof $262.detachArrayBuffer === " } // Ensure that TypedArray.prototype.sort will not sort non-TypedArrays -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { let array = [4, 3, 2, 1]; Int32Array.prototype.sort.call(array); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { Int32Array.prototype.sort.call({a: 1, b: 2}); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { Int32Array.prototype.sort.call(Int32Array.prototype); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { let buf = new ArrayBuffer(32); Int32Array.prototype.sort.call(buf); -}, TypeError); +}); // Ensure that comparator errors are propagataed function badComparator(x, y) { @@ -83,14 +83,14 @@ function badComparator(x, y) { return x - y; } -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { let array = new Uint8Array([99, 99, 99, 99]); array.sort(badComparator); -}, TypeError); +}); -assertThrowsInstanceOf(() => { +assert.throws(TypeError, () => { let array = new Uint8Array([1, 99, 2, 99]); array.sort(badComparator); -}, TypeError); +}); diff --git a/test/staging/sm/TypedArray/test-integrity-level.js b/test/staging/sm/TypedArray/test-integrity-level.js index 992476de9a..5c88024116 100644 --- a/test/staging/sm/TypedArray/test-integrity-level.js +++ b/test/staging/sm/TypedArray/test-integrity-level.js @@ -26,7 +26,7 @@ const NON_INLINE_STORAGE = 1024; // Non-empty typed arrays cannot be sealed. for (let length of [INLINE_STORAGE, NON_INLINE_STORAGE]) { let ta = new Int32Array(length); - assertThrowsInstanceOf(() => Object.seal(ta), TypeError); + assert.throws(TypeError, () => Object.seal(ta)); assert.sameValue(Object.isExtensible(ta), false); assert.sameValue(Object.isSealed(ta), false); @@ -46,7 +46,7 @@ for (let length of [INLINE_STORAGE, NON_INLINE_STORAGE]) { // Non-empty typed arrays cannot be frozen. for (let length of [INLINE_STORAGE, NON_INLINE_STORAGE]) { let ta = new Int32Array(length); - assertThrowsInstanceOf(() => Object.freeze(ta), TypeError); + assert.throws(TypeError, () => Object.freeze(ta)); assert.sameValue(Object.isExtensible(ta), false); assert.sameValue(Object.isSealed(ta), false); diff --git a/test/staging/sm/TypedArray/toLocaleString-detached.js b/test/staging/sm/TypedArray/toLocaleString-detached.js index cf503e0635..25f7adc443 100644 --- a/test/staging/sm/TypedArray/toLocaleString-detached.js +++ b/test/staging/sm/TypedArray/toLocaleString-detached.js @@ -16,7 +16,7 @@ if (typeof $262.detachArrayBuffer === "function") { for (let constructor of typedArrayConstructors) { let typedArray = new constructor(42); $262.detachArrayBuffer(typedArray.buffer); - assertThrowsInstanceOf(() => typedArray.toLocaleString(), TypeError); + assert.throws(TypeError, () => typedArray.toLocaleString()); } // Doesn't throw a TypeError if detached in Number.prototype.toLocaleString. diff --git a/test/staging/sm/TypedArray/toLocaleString.js b/test/staging/sm/TypedArray/toLocaleString.js index c1ad6806bf..16239161cb 100644 --- a/test/staging/sm/TypedArray/toLocaleString.js +++ b/test/staging/sm/TypedArray/toLocaleString.js @@ -32,9 +32,9 @@ assert.sameValue(TypedArrayPrototype.toLocaleString.name, "toLocaleString"); assert.sameValue(TypedArrayPrototype.toLocaleString.length, 0); // It's not a generic method. -assertThrowsInstanceOf(() => TypedArrayPrototype.toLocaleString.call(), TypeError); +assert.throws(TypeError, () => TypedArrayPrototype.toLocaleString.call()); for (let invalid of [void 0, null, {}, [], function(){}, true, 0, "", Symbol()]) { - assertThrowsInstanceOf(() => TypedArrayPrototype.toLocaleString.call(invalid), TypeError); + assert.throws(TypeError, () => TypedArrayPrototype.toLocaleString.call(invalid)); } const localeOne = 1..toLocaleString(), diff --git a/test/staging/sm/TypedArray/toReversed-detached.js b/test/staging/sm/TypedArray/toReversed-detached.js index 071634a368..5782965c6f 100644 --- a/test/staging/sm/TypedArray/toReversed-detached.js +++ b/test/staging/sm/TypedArray/toReversed-detached.js @@ -14,5 +14,5 @@ var ta = new Int32Array([3, 2, 1]); $262.detachArrayBuffer(ta.buffer); -assertThrowsInstanceOf(() => ta.toReversed(), TypeError); +assert.throws(TypeError, () => ta.toReversed()); diff --git a/test/staging/sm/TypedArray/toSorted-detached.js b/test/staging/sm/TypedArray/toSorted-detached.js index 4a6bac4a85..a66275c375 100644 --- a/test/staging/sm/TypedArray/toSorted-detached.js +++ b/test/staging/sm/TypedArray/toSorted-detached.js @@ -14,5 +14,5 @@ var ta = new Int32Array([3, 2, 1]); $262.detachArrayBuffer(ta.buffer); -assertThrowsInstanceOf(() => ta.toSorted(), TypeError); +assert.throws(TypeError, () => ta.toSorted()); diff --git a/test/staging/sm/TypedArray/values.js b/test/staging/sm/TypedArray/values.js index f78706fa6c..631acd170d 100644 --- a/test/staging/sm/TypedArray/values.js +++ b/test/staging/sm/TypedArray/values.js @@ -38,9 +38,9 @@ for (var constructor of anyTypedArrayConstructors) { var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./, new Proxy(new constructor(), {})]; invalidReceivers.forEach(invalidReceiver => { - assertThrowsInstanceOf(() => { + assert.throws(TypeError, () => { constructor.prototype.values.call(invalidReceiver); - }, TypeError, "Assert that values fails if this value is not a TypedArray"); + }, "Assert that values fails if this value is not a TypedArray"); }); } diff --git a/test/staging/sm/TypedArray/with-detached.js b/test/staging/sm/TypedArray/with-detached.js index b992f0ad9d..1450850192 100644 --- a/test/staging/sm/TypedArray/with-detached.js +++ b/test/staging/sm/TypedArray/with-detached.js @@ -14,5 +14,5 @@ var ta = new Int32Array([3, 2, 1]); $262.detachArrayBuffer(ta.buffer); -assertThrowsInstanceOf(() => ta.with(0, 0), TypeError); +assert.throws(TypeError, () => ta.with(0, 0)); diff --git a/test/staging/sm/TypedArray/with.js b/test/staging/sm/TypedArray/with.js index 3164657528..2dbfe2444a 100644 --- a/test/staging/sm/TypedArray/with.js +++ b/test/staging/sm/TypedArray/with.js @@ -24,7 +24,7 @@ let value = { let ta = new Int32Array(5); for (let index of indices) { - assertThrowsInstanceOf(() => ta.with(index, value), Err); + assert.throws(Err, () => ta.with(index, value), Err); } for (let index of indices) { @@ -37,6 +37,6 @@ for (let index of indices) { } }; - assertThrowsInstanceOf(() => ta.with(index, value), RangeError); + assert.throws(RangeError, () => ta.with(index, value)); }