diff --git a/test/staging/sm/expressions/destructuring-array-lexical.js b/test/staging/sm/expressions/destructuring-array-lexical.js index 710ec6d252..713aa8077a 100644 --- a/test/staging/sm/expressions/destructuring-array-lexical.js +++ b/test/staging/sm/expressions/destructuring-array-lexical.js @@ -14,8 +14,6 @@ var summary = "Array destructuring with accessing uninitialized lexical binding. print(BUGNUMBER + ": " + summary); -assertThrowsInstanceOf(() => { let y = [y] = []; }, - ReferenceError); -assertThrowsInstanceOf(() => { let y = [y] = [,]; }, - ReferenceError); +assert.throws(ReferenceError, () => { let y = [y] = []; }); +assert.throws(ReferenceError, () => { let y = [y] = [,]; }); diff --git a/test/staging/sm/expressions/exponentiation-unparenthesised-unary.js b/test/staging/sm/expressions/exponentiation-unparenthesised-unary.js index 666772c096..a64064f6fc 100644 --- a/test/staging/sm/expressions/exponentiation-unparenthesised-unary.js +++ b/test/staging/sm/expressions/exponentiation-unparenthesised-unary.js @@ -20,8 +20,8 @@ function assertNoError(f, msg) { } function assertSyntaxError(code) { - assertThrowsInstanceOf(function () { Function(code); }, SyntaxError, "Function:" + code); - assertThrowsInstanceOf(function () { AsyncFunction(code); }, SyntaxError, "AsyncFunction:" + code); + assert.throws(SyntaxError, function () { Function(code); }, "Function:" + code); + assert.throws(SyntaxError, function () { AsyncFunction(code); }, "AsyncFunction:" + code); } function assertNoSyntaxError(code) { diff --git a/test/staging/sm/expressions/inNotObjectError.js b/test/staging/sm/expressions/inNotObjectError.js index 9e21f12857..878c318600 100644 --- a/test/staging/sm/expressions/inNotObjectError.js +++ b/test/staging/sm/expressions/inNotObjectError.js @@ -21,21 +21,21 @@ assert.throws(TypeError, () => 'this is subString' in 'this is base'); assert.throws(TypeError, () => 'HEAD' + 'subString'.repeat(30000) in 'HEAD' + 'base'.repeat(30000)); // These test cases check if it does not crash and throws appropriate error. -assertThrowsInstanceOf(() => { 1 in 'hello' }, TypeError); -assertThrowsInstanceOf(() => { 'hello' in 1 }, TypeError); -assertThrowsInstanceOf(() => { 'hello' in null }, TypeError); -assertThrowsInstanceOf(() => { null in 'hello' }, TypeError); -assertThrowsInstanceOf(() => { null in null }, TypeError); -assertThrowsInstanceOf(() => { 'hello' in true }, TypeError); -assertThrowsInstanceOf(() => { false in 1.1 }, TypeError); -assertThrowsInstanceOf(() => { Symbol.iterator in undefined }, TypeError); -assertThrowsInstanceOf(() => { [] in undefined }, TypeError); -assertThrowsInstanceOf(() => { /a/ in 'hello' }, TypeError); +assert.throws(TypeError, () => { 1 in 'hello' }); +assert.throws(TypeError, () => { 'hello' in 1 }); +assert.throws(TypeError, () => { 'hello' in null }); +assert.throws(TypeError, () => { null in 'hello' }); +assert.throws(TypeError, () => { null in null }); +assert.throws(TypeError, () => { 'hello' in true }); +assert.throws(TypeError, () => { false in 1.1 }); +assert.throws(TypeError, () => { Symbol.iterator in undefined }); +assert.throws(TypeError, () => { [] in undefined }); +assert.throws(TypeError, () => { /a/ in 'hello' }); var str = 'hello'; -assertThrowsInstanceOf(() => { str in 'hello' }, TypeError); +assert.throws(TypeError, () => { str in 'hello' }); class A {}; -assertThrowsInstanceOf(() => { new A() in undefined }, TypeError); +assert.throws(TypeError, () => { new A() in undefined }); var a = new A(); a.b = 1.1; -assertThrowsInstanceOf(() => { a.b in 1.1 }, TypeError); +assert.throws(TypeError, () => { a.b in 1.1 }); diff --git a/test/staging/sm/expressions/optional-chain-tdz.js b/test/staging/sm/expressions/optional-chain-tdz.js index 864d15dcfe..1d4d77f8fa 100644 --- a/test/staging/sm/expressions/optional-chain-tdz.js +++ b/test/staging/sm/expressions/optional-chain-tdz.js @@ -13,25 +13,25 @@ esid: pending // TDZ for lexical |let| bindings with optional chaining. { - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const Null = null; Null?.[b]; b = 0; let b; - }, ReferenceError); + }); - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const Null = null; Null?.[b](); b = 0; let b; - }, ReferenceError); + }); - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const Null = null; delete Null?.[b]; b = 0; let b; - }, ReferenceError); + }); } diff --git a/test/staging/sm/expressions/short-circuit-compound-assignment-const.js b/test/staging/sm/expressions/short-circuit-compound-assignment-const.js index 62fd79ea0d..fa1fc7a4ab 100644 --- a/test/staging/sm/expressions/short-circuit-compound-assignment-const.js +++ b/test/staging/sm/expressions/short-circuit-compound-assignment-const.js @@ -23,7 +23,7 @@ function notEvaluated() { assert.sameValue(a, false); const b = true; - assertThrowsInstanceOf(() => { b &&= 1; }, TypeError); + assert.throws(TypeError, () => { b &&= 1; }); assert.sameValue(b, true); } @@ -37,7 +37,7 @@ function notEvaluated() { let g = function fn() { "use strict"; - assertThrowsInstanceOf(() => { fn &&= 1; }, TypeError); + assert.throws(TypeError, () => { fn &&= 1; }); assert.sameValue(fn, g); }; g(); @@ -50,7 +50,7 @@ function notEvaluated() { assert.sameValue(a, true); const b = false; - assertThrowsInstanceOf(() => { b ||= 0; }, TypeError); + assert.throws(TypeError, () => { b ||= 0; }); assert.sameValue(b, false); } @@ -77,7 +77,7 @@ function notEvaluated() { assert.sameValue(a, true); const b = null; - assertThrowsInstanceOf(() => { b ??= 0; }, TypeError); + assert.throws(TypeError, () => { b ??= 0; }); assert.sameValue(b, null); } diff --git a/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js b/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js index b3aa22d20c..0dac21eceb 100644 --- a/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js +++ b/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js @@ -13,53 +13,53 @@ esid: pending // TDZ for lexical |let| bindings. { - assertThrowsInstanceOf(() => { let a = (a &&= 0); }, ReferenceError); - assertThrowsInstanceOf(() => { let a = (a ||= 0); }, ReferenceError); - assertThrowsInstanceOf(() => { let a = (a ??= 0); }, ReferenceError); + assert.throws(ReferenceError, () => { let a = (a &&= 0); }); + assert.throws(ReferenceError, () => { let a = (a ||= 0); }); + assert.throws(ReferenceError, () => { let a = (a ??= 0); }); } // TDZ for lexical |const| bindings. { - assertThrowsInstanceOf(() => { const a = (a &&= 0); }, ReferenceError); - assertThrowsInstanceOf(() => { const a = (a ||= 0); }, ReferenceError); - assertThrowsInstanceOf(() => { const a = (a ??= 0); }, ReferenceError); + assert.throws(ReferenceError, () => { const a = (a &&= 0); }); + assert.throws(ReferenceError, () => { const a = (a ||= 0); }); + assert.throws(ReferenceError, () => { const a = (a ??= 0); }); } // TDZ for parameter expressions. { - assertThrowsInstanceOf((a = (b &&= 0), b) => {}, ReferenceError); - assertThrowsInstanceOf((a = (b ||= 0), b) => {}, ReferenceError); - assertThrowsInstanceOf((a = (b ??= 0), b) => {}, ReferenceError); + assert.throws(ReferenceError, (a = (b &&= 0), b) => {}); + assert.throws(ReferenceError, (a = (b ||= 0), b) => {}); + assert.throws(ReferenceError, (a = (b ??= 0), b) => {}); } // TDZ for |class| bindings. { - assertThrowsInstanceOf(() => { class a extends (a &&= 0) {} }, ReferenceError); - assertThrowsInstanceOf(() => { class a extends (a ||= 0) {} }, ReferenceError); - assertThrowsInstanceOf(() => { class a extends (a ??= 0) {} }, ReferenceError); + assert.throws(ReferenceError, () => { class a extends (a &&= 0) {} }); + assert.throws(ReferenceError, () => { class a extends (a ||= 0) {} }); + assert.throws(ReferenceError, () => { class a extends (a ??= 0) {} }); } // TDZ for lexical |let| bindings with conditional assignment. { - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const False = false; False &&= b; b = 2; let b; - }, ReferenceError); + }); - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const True = true; True ||= b; b = 2; let b; - }, ReferenceError); + }); - assertThrowsInstanceOf(() => { + assert.throws(ReferenceError, () => { const NonNull = {}; NonNull ??= b; b = 2; let b; - }, ReferenceError); + }); }