Remove assertThrowsInstanceOfWithMessageContains

This commit is contained in:
André Bargull 2025-04-30 14:15:40 +02:00 committed by Philip Chimento
parent 8e9f51e944
commit b5f946440f
3 changed files with 7 additions and 18 deletions

View File

@ -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);
}
}
})();

View File

@ -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"
);

View File

@ -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);