Replace assertThrowsInstanceOf with assert.throws in sm/destructuring

This commit is contained in:
André Bargull 2025-04-30 14:15:53 +02:00 committed by Philip Chimento
parent 2cf3004bab
commit 660d854ccf
4 changed files with 15 additions and 15 deletions

View File

@ -107,9 +107,9 @@ function test() {
} }
}; };
}; };
assertThrowsInstanceOf(function() { assert.throws(TypeError, function() {
var [] = iterable; var [] = iterable;
}, TypeError); });
assert.sameValue(returnCalled, ++returnCalledExpected); assert.sameValue(returnCalled, ++returnCalledExpected);
} }

View File

@ -30,10 +30,10 @@ esid: pending
({...[0].x} = {}); ({...[0].x} = {});
// Object literal with initializer shorthand in destructuring context. // Object literal with initializer shorthand in destructuring context.
assertThrowsInstanceOf(() => Function(`[{a = 0}.x] = [];`), SyntaxError); assert.throws(SyntaxError, () => Function(`[{a = 0}.x] = [];`));
assertThrowsInstanceOf(() => Function(`[...{a = 0}.x] = [];`), SyntaxError); assert.throws(SyntaxError, () => Function(`[...{a = 0}.x] = [];`));
assertThrowsInstanceOf(() => Function(`({a: {b = 0}.x} = {});`), SyntaxError); assert.throws(SyntaxError, () => Function(`({a: {b = 0}.x} = {});`));
assertThrowsInstanceOf(() => Function(`({...{b = 0}.x} = {});`), SyntaxError); assert.throws(SyntaxError, () => Function(`({...{b = 0}.x} = {});`));
// Object destructuring with "eval" or "arguments" shorthand in strict mode. // Object destructuring with "eval" or "arguments" shorthand in strict mode.
(function() { (function() {

View File

@ -10,10 +10,10 @@ description: |
esid: pending esid: pending
---*/ ---*/
function assertSyntaxError(code) { function assertSyntaxError(code) {
assertThrowsInstanceOf(function () { Function(code); }, SyntaxError, "Function:" + code); assert.throws(SyntaxError, function () { Function(code); }, "Function:" + code);
assertThrowsInstanceOf(function () { eval(code); }, SyntaxError, "eval:" + code); assert.throws(SyntaxError, function () { eval(code); }, "eval:" + code);
var ieval = eval; var ieval = eval;
assertThrowsInstanceOf(function () { ieval(code); }, SyntaxError, "indirect eval:" + code); assert.throws(SyntaxError, function () { ieval(code); }, "indirect eval:" + code);
} }
// |true && a| is constant-folded to |a|, ensure the destructuring assignment // |true && a| is constant-folded to |a|, ensure the destructuring assignment

View File

@ -32,14 +32,14 @@ for (let primitive of primitives) {
return primitive; return primitive;
} }
}; };
assertThrowsInstanceOf(() => { assert.throws(TypeError, () => {
let [] = obj; let [] = obj;
}, TypeError); });
assertThrowsInstanceOf(() => { assert.throws(TypeError, () => {
[] = obj; [] = obj;
}, TypeError); });
assertThrowsInstanceOf(() => { assert.throws(TypeError, () => {
f(obj); f(obj);
}, TypeError); });
} }