mirror of
https://github.com/tc39/test262.git
synced 2025-09-24 02:28:05 +02:00
Replace assertThrowsInstanceOf with assert.throws in sm/Set
This commit is contained in:
parent
40b3946818
commit
2fe9977b83
@ -160,7 +160,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -185,7 +185,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -198,7 +198,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -211,7 +211,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -223,7 +223,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -234,7 +234,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.difference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.difference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -243,7 +243,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.difference([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.difference([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -274,7 +274,7 @@ assertThrowsInstanceOf(() => emptySet.difference([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.difference.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.difference.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't return the original Set object.
|
||||
|
@ -160,7 +160,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -185,7 +185,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -198,7 +198,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -211,7 +211,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -223,7 +223,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -234,7 +234,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.intersection(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.intersection(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -243,7 +243,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.intersection([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.intersection([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -274,7 +274,7 @@ assertThrowsInstanceOf(() => emptySet.intersection([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.intersection.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.intersection.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't return the original Set object.
|
||||
|
@ -145,7 +145,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -170,7 +170,7 @@ for (let values of [
|
||||
]);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => new Set([1]).isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => new Set([1]).isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -183,7 +183,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -196,7 +196,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -208,7 +208,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -219,7 +219,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isDisjointFrom(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isDisjointFrom(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -228,7 +228,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.isDisjointFrom([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isDisjointFrom([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -259,7 +259,7 @@ assertThrowsInstanceOf(() => emptySet.isDisjointFrom([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.isDisjointFrom.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.isDisjointFrom.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Calls |has| when the this-value has fewer keys.
|
||||
|
@ -118,7 +118,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSubsetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSubsetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -131,7 +131,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSubsetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSubsetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -143,7 +143,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSubsetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSubsetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -154,7 +154,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSubsetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSubsetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -163,7 +163,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.isSubsetOf([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSubsetOf([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -194,7 +194,7 @@ assertThrowsInstanceOf(() => emptySet.isSubsetOf([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.isSubsetOf.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.isSubsetOf.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't call |has| when this-value has more elements.
|
||||
|
@ -136,7 +136,7 @@ for (let values of [
|
||||
}, log);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -151,7 +151,7 @@ for (let values of [
|
||||
setLikeObj.keys = () => 123;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -164,7 +164,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -177,7 +177,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -189,7 +189,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -200,7 +200,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -209,7 +209,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.isSupersetOf([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.isSupersetOf([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -240,7 +240,7 @@ assertThrowsInstanceOf(() => emptySet.isSupersetOf([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.isSupersetOf.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.isSupersetOf.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't call |has| nor |keys| when this-value has fewer elements.
|
||||
|
@ -123,7 +123,7 @@ for (let values of [
|
||||
}, log);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -138,7 +138,7 @@ for (let values of [
|
||||
setLikeObj.keys = () => 123;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -151,7 +151,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -164,7 +164,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -176,7 +176,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -187,7 +187,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -196,7 +196,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.symmetricDifference([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.symmetricDifference([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -227,7 +227,7 @@ assertThrowsInstanceOf(() => emptySet.symmetricDifference([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.symmetricDifference.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.symmetricDifference.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't return the original Set object.
|
||||
|
@ -123,7 +123,7 @@ for (let values of [
|
||||
}, log);
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -138,7 +138,7 @@ for (let values of [
|
||||
setLikeObj.keys = () => 123;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -151,7 +151,7 @@ for (let values of [
|
||||
setLikeObj.keys = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -164,7 +164,7 @@ for (let values of [
|
||||
setLikeObj.has = nonCallable;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -176,7 +176,7 @@ for (let values of [
|
||||
sizeValue = NaN;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -187,7 +187,7 @@ for (let values of [
|
||||
sizeValue = undefined;
|
||||
|
||||
log.length = 0;
|
||||
assertThrowsInstanceOf(() => emptySet.union(setLike), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union(setLike));
|
||||
|
||||
assert.compareArray(log, [
|
||||
"[[get]]", "size",
|
||||
@ -196,7 +196,7 @@ for (let values of [
|
||||
}
|
||||
|
||||
// Doesn't accept Array as an input.
|
||||
assertThrowsInstanceOf(() => emptySet.union([]), TypeError);
|
||||
assert.throws(TypeError, () => emptySet.union([]));
|
||||
|
||||
// Works with Set subclasses.
|
||||
{
|
||||
@ -227,7 +227,7 @@ assertThrowsInstanceOf(() => emptySet.union([]), TypeError);
|
||||
for (let thisValue of [
|
||||
null, undefined, true, "", {}, new Map, new Proxy(new Set, {}),
|
||||
]) {
|
||||
assertThrowsInstanceOf(() => Set.prototype.union.call(thisValue, emptySet), TypeError);
|
||||
assert.throws(TypeError, () => Set.prototype.union.call(thisValue, emptySet));
|
||||
}
|
||||
|
||||
// Doesn't return the original Set object.
|
||||
|
Loading…
x
Reference in New Issue
Block a user