From b5f946440fc9d76143e4ac9033cd33d9b72d9f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 30 Apr 2025 14:15:40 +0200 Subject: [PATCH] Remove assertThrowsInstanceOfWithMessageContains --- harness/sm/non262-shell.js | 8 +------- .../sm/AsyncGenerators/for-await-of-error.js | 13 ++++--------- .../sm/generators/yield-star-iterator-close.js | 4 ++-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/harness/sm/non262-shell.js b/harness/sm/non262-shell.js index 18c8818087..9e5584df8f 100644 --- a/harness/sm/non262-shell.js +++ b/harness/sm/non262-shell.js @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*--- -defines: [assertThrowsValue, assertThrownErrorContains, assertThrowsInstanceOfWithMessageCheck, assertThrowsInstanceOf, assertThrowsInstanceOfWithMessage, assertThrowsInstanceOfWithMessageContains, assertDeepEq] +defines: [assertThrowsValue, assertThrownErrorContains, assertThrowsInstanceOfWithMessageCheck, assertThrowsInstanceOf, assertThrowsInstanceOfWithMessage] allow_unused: True ---*/ @@ -77,10 +77,4 @@ allow_unused: True } } - if (typeof globalThis.assertThrowsInstanceOfWithMessageContains === 'undefined') { - globalThis.assertThrowsInstanceOfWithMessageContains = function assertThrowsInstanceOfWithMessageContains(f, ctor, substr, msg) { - assertThrowsInstanceOfWithMessageCheck(f, ctor, message => message.indexOf(substr) !== -1, msg); - } - } - })(); diff --git a/test/staging/sm/AsyncGenerators/for-await-of-error.js b/test/staging/sm/AsyncGenerators/for-await-of-error.js index f3814c9866..384d8ff46c 100644 --- a/test/staging/sm/AsyncGenerators/for-await-of-error.js +++ b/test/staging/sm/AsyncGenerators/for-await-of-error.js @@ -2,9 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262.js, sm/non262-shell.js] -flags: - - noStrict description: | pending esid: pending @@ -12,18 +9,16 @@ esid: pending var BUGNUMBER = 1391519; var summary = "for-await-of outside of async function should provide better error"; -print(BUGNUMBER + ": " + summary); - -assertThrowsInstanceOfWithMessageContains( - () => eval("for await (let x of []) {}"), +assert.throws( SyntaxError, + () => eval("for await (let x of []) {}"), "for await (... of ...) is only valid in" ); // Extra `await` shouldn't throw that error. -assertThrowsInstanceOfWithMessageContains( - () => eval("async function f() { for await await (let x of []) {} }"), +assert.throws( SyntaxError, + () => eval("async function f() { for await await (let x of []) {} }"), "missing ( after for" ); diff --git a/test/staging/sm/generators/yield-star-iterator-close.js b/test/staging/sm/generators/yield-star-iterator-close.js index a5b30426d6..089c706327 100644 --- a/test/staging/sm/generators/yield-star-iterator-close.js +++ b/test/staging/sm/generators/yield-star-iterator-close.js @@ -125,9 +125,9 @@ function test() { // IteratorClose expects iter.return to return an Object. var g6 = y(); g6.next(); - assertThrowsInstanceOfWithMessageContains( - () => g6.throw("foo"), + assert.throws( TypeError, + () => g6.throw("foo"), "non-object" ); assert.sameValue(returnCalled, ++returnCalledExpected);