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;
}, TypeError);
});
assert.sameValue(returnCalled, ++returnCalledExpected);
}

View File

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

View File

@ -10,10 +10,10 @@ description: |
esid: pending
---*/
function assertSyntaxError(code) {
assertThrowsInstanceOf(function () { Function(code); }, SyntaxError, "Function:" + code);
assertThrowsInstanceOf(function () { eval(code); }, SyntaxError, "eval:" + code);
assert.throws(SyntaxError, function () { Function(code); }, "Function:" + code);
assert.throws(SyntaxError, function () { eval(code); }, "eval:" + code);
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

View File

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