From e44e4bbc1ae54ba297e22da5776499def4050fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 30 Apr 2025 14:15:51 +0200 Subject: [PATCH] Replace assertThrowsInstanceOf with assert.throws in sm/Iterator --- .../constructor-throw-when-called-directly.js | 2 +- .../Iterator/constructor-throw-without-new.js | 2 +- .../from/iterator-not-callable-throws.js | 10 ++--- .../staging/sm/Iterator/from/modify-return.js | 2 +- .../sm/Iterator/from/o-not-object-throws.js | 10 ++--- .../from/wrap-functions-on-other-global.js | 2 +- .../wrap-method-with-non-wrap-this-throws.js | 42 +++++++++---------- .../every/check-fn-after-getting-iterator.js | 2 +- .../every/error-from-correct-realm.js | 6 +-- .../prototype/every/fn-not-callable-throws.js | 16 +++---- .../every/fn-throws-close-iterator.js | 2 +- .../every/next-throws-iterator-not-closed.js | 2 +- .../every/this-not-iterator-throws.js | 6 +-- .../every/value-throws-iterator-not-closed.js | 2 +- .../find/check-fn-after-getting-iterator.js | 2 +- .../find/error-from-correct-realm.js | 6 +-- .../prototype/find/fn-not-callable-throws.js | 16 +++---- .../find/fn-throws-close-iterator.js | 2 +- .../find/next-throws-iterator-not-closed.js | 2 +- .../find/this-not-iterator-throws.js | 6 +-- .../find/value-throws-iterator-not-closed.js | 2 +- ...ose-iterator-when-inner-complete-throws.js | 2 +- .../close-iterator-when-inner-next-throws.js | 2 +- .../close-iterator-when-inner-value-throws.js | 2 +- .../flatMap/throw-when-inner-not-iterable.js | 2 +- .../check-fn-after-getting-iterator.js | 2 +- .../forEach/error-from-correct-realm.js | 6 +-- .../forEach/fn-not-callable-throws.js | 16 +++---- .../forEach/fn-throws-close-iterator.js | 2 +- .../next-throws-iterator-not-closed.js | 2 +- .../forEach/this-not-iterator-throws.js | 6 +-- .../value-throws-iterator-not-closed.js | 2 +- ...rator-methods-throw-on-iterator-helpers.js | 6 +-- ...ator-helper-methods-throw-on-generators.js | 6 +-- ...-methods-iterator-closed-on-call-throws.js | 2 +- ...hods-iterator-not-closed-on-next-throws.js | 2 +- ...ods-iterator-not-closed-on-value-throws.js | 2 +- ...lazy-methods-reentry-not-close-iterator.js | 2 +- ...y-methods-throw-eagerly-on-non-callable.js | 28 ++++++------- ...y-methods-throw-eagerly-on-non-iterator.js | 12 +++--- .../lazy-methods-throw-next-done-throws.js | 2 +- .../lazy-methods-throw-next-not-object.js | 2 +- .../lazy-methods-throw-on-reentry.js | 2 +- .../Iterator/prototype/map/clobber-symbol.js | 2 +- .../map/mapper-not-callable-throw.js | 28 ++++++------- .../map/reenter-map-generator-from-mapper.js | 2 +- .../prototype/map/this-not-iterator-throw.js | 12 +++--- .../throw-when-iterator-returns-non-object.js | 12 +++--- .../reduce/check-fn-after-getting-iterator.js | 2 +- ...y-iterator-without-initial-value-throws.js | 2 +- .../reduce/error-from-correct-realm.js | 6 +-- .../iterator-next-return-non-object-throws.js | 12 +++--- .../reduce/next-throws-iterator-not-closed.js | 2 +- .../reduce/reducer-not-callable-throws.js | 16 +++---- .../reduce/reducer-throws-iterator-closed.js | 2 +- .../reduce/this-not-iterator-throws.js | 6 +-- .../value-throws-iterator-not-closed.js | 2 +- .../some/check-fn-after-getting-iterator.js | 2 +- .../some/error-from-correct-realm.js | 6 +-- .../prototype/some/fn-not-callable-throws.js | 16 +++---- .../some/fn-throws-close-iterator.js | 2 +- .../some/next-throws-iterator-not-closed.js | 2 +- .../some/this-not-iterator-throws.js | 6 +-- .../some/value-throws-iterator-not-closed.js | 2 +- .../take-drop-throw-eagerly-on-negative.js | 8 ++-- .../take-drop-throw-eagerly-on-non-integer.js | 6 +-- .../Iterator/prototype/toArray/next-throws.js | 2 +- .../toArray/this-not-iterator-throws.js | 6 +-- .../value-throws-iterator-not-closed.js | 2 +- 69 files changed, 209 insertions(+), 209 deletions(-) diff --git a/test/staging/sm/Iterator/constructor-throw-when-called-directly.js b/test/staging/sm/Iterator/constructor-throw-when-called-directly.js index c52ac7e788..580cf81c9e 100644 --- a/test/staging/sm/Iterator/constructor-throw-when-called-directly.js +++ b/test/staging/sm/Iterator/constructor-throw-when-called-directly.js @@ -15,5 +15,5 @@ description: | pending esid: pending ---*/ -assertThrowsInstanceOf(() => new Iterator(), TypeError); +assert.throws(TypeError, () => new Iterator()); diff --git a/test/staging/sm/Iterator/constructor-throw-without-new.js b/test/staging/sm/Iterator/constructor-throw-without-new.js index a531e2e79a..f733d0f849 100644 --- a/test/staging/sm/Iterator/constructor-throw-without-new.js +++ b/test/staging/sm/Iterator/constructor-throw-without-new.js @@ -15,5 +15,5 @@ description: | pending esid: pending ---*/ -assertThrowsInstanceOf(() => Iterator(), TypeError); +assert.throws(TypeError, () => Iterator()); diff --git a/test/staging/sm/Iterator/from/iterator-not-callable-throws.js b/test/staging/sm/Iterator/from/iterator-not-callable-throws.js index d46a9594e5..81f8ee53b1 100644 --- a/test/staging/sm/Iterator/from/iterator-not-callable-throws.js +++ b/test/staging/sm/Iterator/from/iterator-not-callable-throws.js @@ -15,9 +15,9 @@ description: | pending esid: pending ---*/ -assertThrowsInstanceOf(() => Iterator.from({ [Symbol.iterator]: 0 }), TypeError); -assertThrowsInstanceOf(() => Iterator.from({ [Symbol.iterator]: false }), TypeError); -assertThrowsInstanceOf(() => Iterator.from({ [Symbol.iterator]: "" }), TypeError); -assertThrowsInstanceOf(() => Iterator.from({ [Symbol.iterator]: {} }), TypeError); -assertThrowsInstanceOf(() => Iterator.from({ [Symbol.iterator]: Symbol('') }), TypeError); +assert.throws(TypeError, () => Iterator.from({ [Symbol.iterator]: 0 })); +assert.throws(TypeError, () => Iterator.from({ [Symbol.iterator]: false })); +assert.throws(TypeError, () => Iterator.from({ [Symbol.iterator]: "" })); +assert.throws(TypeError, () => Iterator.from({ [Symbol.iterator]: {} })); +assert.throws(TypeError, () => Iterator.from({ [Symbol.iterator]: Symbol('') })); diff --git a/test/staging/sm/Iterator/from/modify-return.js b/test/staging/sm/Iterator/from/modify-return.js index a34156c8e9..de0d0718ad 100644 --- a/test/staging/sm/Iterator/from/modify-return.js +++ b/test/staging/sm/Iterator/from/modify-return.js @@ -25,7 +25,7 @@ assert.sameValue(done, true); assert.sameValue(value, "old return"); iter.return = () => { throw new Error(); }; -assertThrowsInstanceOf(() => wrap.return(), Error); +assert.throws(Error, () => wrap.return()); iter.return = null; let nullResult = wrap.return("return argument ignored"); diff --git a/test/staging/sm/Iterator/from/o-not-object-throws.js b/test/staging/sm/Iterator/from/o-not-object-throws.js index 4fef612194..9f71d87676 100644 --- a/test/staging/sm/Iterator/from/o-not-object-throws.js +++ b/test/staging/sm/Iterator/from/o-not-object-throws.js @@ -15,9 +15,9 @@ description: | pending esid: pending ---*/ -assertThrowsInstanceOf(() => Iterator.from(undefined), TypeError); -assertThrowsInstanceOf(() => Iterator.from(null), TypeError); -assertThrowsInstanceOf(() => Iterator.from(0), TypeError); -assertThrowsInstanceOf(() => Iterator.from(false), TypeError); -assertThrowsInstanceOf(() => Iterator.from(Symbol('')), TypeError); +assert.throws(TypeError, () => Iterator.from(undefined)); +assert.throws(TypeError, () => Iterator.from(null)); +assert.throws(TypeError, () => Iterator.from(0)); +assert.throws(TypeError, () => Iterator.from(false)); +assert.throws(TypeError, () => Iterator.from(Symbol(''))); diff --git a/test/staging/sm/Iterator/from/wrap-functions-on-other-global.js b/test/staging/sm/Iterator/from/wrap-functions-on-other-global.js index bac8f49466..4f17a15190 100644 --- a/test/staging/sm/Iterator/from/wrap-functions-on-other-global.js +++ b/test/staging/sm/Iterator/from/wrap-functions-on-other-global.js @@ -35,5 +35,5 @@ const otherWrap = otherGlobal.Iterator.from(iter); checkIterResult(thisWrap.next.call(otherWrap), false, 0); checkIterResult(thisWrap.next.call(otherWrap, 'value'), false, 0); -assertThrowsInstanceOf(thisWrap.return.bind(otherWrap), TestError); +assert.throws(TestError, thisWrap.return.bind(otherWrap)); diff --git a/test/staging/sm/Iterator/from/wrap-method-with-non-wrap-this-throws.js b/test/staging/sm/Iterator/from/wrap-method-with-non-wrap-this-throws.js index bd32b9d357..424b9d8c90 100644 --- a/test/staging/sm/Iterator/from/wrap-method-with-non-wrap-this-throws.js +++ b/test/staging/sm/Iterator/from/wrap-method-with-non-wrap-this-throws.js @@ -26,29 +26,29 @@ class TestIterator { } const nextMethod = Iterator.from(new TestIterator()).next; -assertThrowsInstanceOf(() => nextMethod.call(undefined), TypeError); -assertThrowsInstanceOf(() => nextMethod.call(null), TypeError); -assertThrowsInstanceOf(() => nextMethod.call(0), TypeError); -assertThrowsInstanceOf(() => nextMethod.call(false), TypeError); -assertThrowsInstanceOf(() => nextMethod.call('test'), TypeError); -assertThrowsInstanceOf(() => nextMethod.call(Object(1)), TypeError); -assertThrowsInstanceOf(() => nextMethod.call({}), TypeError); +assert.throws(TypeError, () => nextMethod.call(undefined)); +assert.throws(TypeError, () => nextMethod.call(null)); +assert.throws(TypeError, () => nextMethod.call(0)); +assert.throws(TypeError, () => nextMethod.call(false)); +assert.throws(TypeError, () => nextMethod.call('test')); +assert.throws(TypeError, () => nextMethod.call(Object(1))); +assert.throws(TypeError, () => nextMethod.call({})); const returnMethod = Iterator.from(new TestIterator()).next; -assertThrowsInstanceOf(() => returnMethod.call(undefined), TypeError); -assertThrowsInstanceOf(() => returnMethod.call(null), TypeError); -assertThrowsInstanceOf(() => returnMethod.call(0), TypeError); -assertThrowsInstanceOf(() => returnMethod.call(false), TypeError); -assertThrowsInstanceOf(() => returnMethod.call('test'), TypeError); -assertThrowsInstanceOf(() => returnMethod.call(Object(1)), TypeError); -assertThrowsInstanceOf(() => returnMethod.call({}), TypeError); +assert.throws(TypeError, () => returnMethod.call(undefined)); +assert.throws(TypeError, () => returnMethod.call(null)); +assert.throws(TypeError, () => returnMethod.call(0)); +assert.throws(TypeError, () => returnMethod.call(false)); +assert.throws(TypeError, () => returnMethod.call('test')); +assert.throws(TypeError, () => returnMethod.call(Object(1))); +assert.throws(TypeError, () => returnMethod.call({})); const throwMethod = Iterator.from(new TestIterator()).next; -assertThrowsInstanceOf(() => throwMethod.call(undefined), TypeError); -assertThrowsInstanceOf(() => throwMethod.call(null), TypeError); -assertThrowsInstanceOf(() => throwMethod.call(0), TypeError); -assertThrowsInstanceOf(() => throwMethod.call(false), TypeError); -assertThrowsInstanceOf(() => throwMethod.call('test'), TypeError); -assertThrowsInstanceOf(() => throwMethod.call(Object(1)), TypeError); -assertThrowsInstanceOf(() => throwMethod.call({}), TypeError); +assert.throws(TypeError, () => throwMethod.call(undefined)); +assert.throws(TypeError, () => throwMethod.call(null)); +assert.throws(TypeError, () => throwMethod.call(0)); +assert.throws(TypeError, () => throwMethod.call(false)); +assert.throws(TypeError, () => throwMethod.call('test')); +assert.throws(TypeError, () => throwMethod.call(Object(1))); +assert.throws(TypeError, () => throwMethod.call({})); diff --git a/test/staging/sm/Iterator/prototype/every/check-fn-after-getting-iterator.js b/test/staging/sm/Iterator/prototype/every/check-fn-after-getting-iterator.js index 77a2730cdb..e1a6387c6b 100644 --- a/test/staging/sm/Iterator/prototype/every/check-fn-after-getting-iterator.js +++ b/test/staging/sm/Iterator/prototype/every/check-fn-after-getting-iterator.js @@ -28,7 +28,7 @@ class TestIterator extends Iterator { } const iter = new Proxy(new TestIterator(), handlerProxy); -assertThrowsInstanceOf(() => iter.every(1), TypeError); +assert.throws(TypeError, () => iter.every(1)); assert.compareArray( log, diff --git a/test/staging/sm/Iterator/prototype/every/error-from-correct-realm.js b/test/staging/sm/Iterator/prototype/every/error-from-correct-realm.js index c160cebdf7..b7b9b03761 100644 --- a/test/staging/sm/Iterator/prototype/every/error-from-correct-realm.js +++ b/test/staging/sm/Iterator/prototype/every/error-from-correct-realm.js @@ -19,10 +19,10 @@ assert.sameValue(TypeError !== otherGlobal.TypeError, true); const iter = [].values(); -assertThrowsInstanceOf(() => iter.every(), TypeError); -assertThrowsInstanceOf( - otherGlobal.Iterator.prototype.every.bind(iter), +assert.throws(TypeError, () => iter.every()); +assert.throws( otherGlobal.TypeError, + otherGlobal.Iterator.prototype.every.bind(iter), 'TypeError comes from the realm of the method.', ); diff --git a/test/staging/sm/Iterator/prototype/every/fn-not-callable-throws.js b/test/staging/sm/Iterator/prototype/every/fn-not-callable-throws.js index def0ce55c8..f243cfa523 100644 --- a/test/staging/sm/Iterator/prototype/every/fn-not-callable-throws.js +++ b/test/staging/sm/Iterator/prototype/every/fn-not-callable-throws.js @@ -16,12 +16,12 @@ esid: pending const iter = [].values(); -assertThrowsInstanceOf(() => iter.every(), TypeError); -assertThrowsInstanceOf(() => iter.every(undefined), TypeError); -assertThrowsInstanceOf(() => iter.every(null), TypeError); -assertThrowsInstanceOf(() => iter.every(0), TypeError); -assertThrowsInstanceOf(() => iter.every(false), TypeError); -assertThrowsInstanceOf(() => iter.every(''), TypeError); -assertThrowsInstanceOf(() => iter.every(Symbol('')), TypeError); -assertThrowsInstanceOf(() => iter.every({}), TypeError); +assert.throws(TypeError, () => iter.every()); +assert.throws(TypeError, () => iter.every(undefined)); +assert.throws(TypeError, () => iter.every(null)); +assert.throws(TypeError, () => iter.every(0)); +assert.throws(TypeError, () => iter.every(false)); +assert.throws(TypeError, () => iter.every('')); +assert.throws(TypeError, () => iter.every(Symbol(''))); +assert.throws(TypeError, () => iter.every({})); diff --git a/test/staging/sm/Iterator/prototype/every/fn-throws-close-iterator.js b/test/staging/sm/Iterator/prototype/every/fn-throws-close-iterator.js index 797575b1b0..5086b96ed9 100644 --- a/test/staging/sm/Iterator/prototype/every/fn-throws-close-iterator.js +++ b/test/staging/sm/Iterator/prototype/every/fn-throws-close-iterator.js @@ -29,6 +29,6 @@ const fn = () => { throw new Error(); }; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.every(fn), Error); +assert.throws(Error, () => iter.every(fn)); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/every/next-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/every/next-throws-iterator-not-closed.js index 125948f1f9..1876b0661b 100644 --- a/test/staging/sm/Iterator/prototype/every/next-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/every/next-throws-iterator-not-closed.js @@ -29,6 +29,6 @@ const fn = () => {}; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.every(fn), Error); +assert.throws(Error, () => iter.every(fn)); assert.sameValue(iter.closed, false); diff --git a/test/staging/sm/Iterator/prototype/every/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/every/this-not-iterator-throws.js index 090d3c5f28..3dee10e211 100644 --- a/test/staging/sm/Iterator/prototype/every/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/every/this-not-iterator-throws.js @@ -15,7 +15,7 @@ esid: pending ---*/ const fn = x => x; -assertThrowsInstanceOf(Iterator.prototype.every.bind(undefined, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.every.bind({}, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.every.bind({next: 0}, fn), TypeError); +assert.throws(TypeError, Iterator.prototype.every.bind(undefined, fn)); +assert.throws(TypeError, Iterator.prototype.every.bind({}, fn)); +assert.throws(TypeError, Iterator.prototype.every.bind({next: 0}, fn)); diff --git a/test/staging/sm/Iterator/prototype/every/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/every/value-throws-iterator-not-closed.js index 4298709478..3754e8bb1e 100644 --- a/test/staging/sm/Iterator/prototype/every/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/every/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.every(x => x), TestError); +assert.throws(TestError, () => iterator.every(x => x)); assert.sameValue(iterator.closed, false, 'iterator remains unclosed'); diff --git a/test/staging/sm/Iterator/prototype/find/check-fn-after-getting-iterator.js b/test/staging/sm/Iterator/prototype/find/check-fn-after-getting-iterator.js index fbb4818e88..408fa85df5 100644 --- a/test/staging/sm/Iterator/prototype/find/check-fn-after-getting-iterator.js +++ b/test/staging/sm/Iterator/prototype/find/check-fn-after-getting-iterator.js @@ -28,7 +28,7 @@ class TestIterator extends Iterator { } const iter = new Proxy(new TestIterator(), handlerProxy); -assertThrowsInstanceOf(() => iter.find(1), TypeError); +assert.throws(TypeError, () => iter.find(1)); assert.compareArray( log, diff --git a/test/staging/sm/Iterator/prototype/find/error-from-correct-realm.js b/test/staging/sm/Iterator/prototype/find/error-from-correct-realm.js index 992a7d1fb6..5926af39e8 100644 --- a/test/staging/sm/Iterator/prototype/find/error-from-correct-realm.js +++ b/test/staging/sm/Iterator/prototype/find/error-from-correct-realm.js @@ -19,10 +19,10 @@ assert.sameValue(TypeError !== otherGlobal.TypeError, true); const iter = [].values(); -assertThrowsInstanceOf(() => iter.find(), TypeError); -assertThrowsInstanceOf( - otherGlobal.Iterator.prototype.find.bind(iter), +assert.throws(TypeError, () => iter.find()); +assert.throws( otherGlobal.TypeError, + otherGlobal.Iterator.prototype.find.bind(iter), 'TypeError comes from the realm of the method.', ); diff --git a/test/staging/sm/Iterator/prototype/find/fn-not-callable-throws.js b/test/staging/sm/Iterator/prototype/find/fn-not-callable-throws.js index 8f8efcb01f..0eefe85e14 100644 --- a/test/staging/sm/Iterator/prototype/find/fn-not-callable-throws.js +++ b/test/staging/sm/Iterator/prototype/find/fn-not-callable-throws.js @@ -16,12 +16,12 @@ esid: pending const iter = [].values(); -assertThrowsInstanceOf(() => iter.find(), TypeError); -assertThrowsInstanceOf(() => iter.find(undefined), TypeError); -assertThrowsInstanceOf(() => iter.find(null), TypeError); -assertThrowsInstanceOf(() => iter.find(0), TypeError); -assertThrowsInstanceOf(() => iter.find(false), TypeError); -assertThrowsInstanceOf(() => iter.find(''), TypeError); -assertThrowsInstanceOf(() => iter.find(Symbol('')), TypeError); -assertThrowsInstanceOf(() => iter.find({}), TypeError); +assert.throws(TypeError, () => iter.find()); +assert.throws(TypeError, () => iter.find(undefined)); +assert.throws(TypeError, () => iter.find(null)); +assert.throws(TypeError, () => iter.find(0)); +assert.throws(TypeError, () => iter.find(false)); +assert.throws(TypeError, () => iter.find('')); +assert.throws(TypeError, () => iter.find(Symbol(''))); +assert.throws(TypeError, () => iter.find({})); diff --git a/test/staging/sm/Iterator/prototype/find/fn-throws-close-iterator.js b/test/staging/sm/Iterator/prototype/find/fn-throws-close-iterator.js index 6dd9b4fe60..91407ef1c9 100644 --- a/test/staging/sm/Iterator/prototype/find/fn-throws-close-iterator.js +++ b/test/staging/sm/Iterator/prototype/find/fn-throws-close-iterator.js @@ -29,6 +29,6 @@ const fn = (value) => { throw new Error(); }; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.find(fn), Error); +assert.throws(Error, () => iter.find(fn)); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/find/next-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/find/next-throws-iterator-not-closed.js index 8e5f9fa652..e3ecf0e490 100644 --- a/test/staging/sm/Iterator/prototype/find/next-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/find/next-throws-iterator-not-closed.js @@ -29,6 +29,6 @@ const fn = x => x; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.find(fn), Error); +assert.throws(Error, () => iter.find(fn)); assert.sameValue(iter.closed, false); diff --git a/test/staging/sm/Iterator/prototype/find/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/find/this-not-iterator-throws.js index d7d3cdf73d..3a09ac219e 100644 --- a/test/staging/sm/Iterator/prototype/find/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/find/this-not-iterator-throws.js @@ -15,7 +15,7 @@ esid: pending ---*/ const fn = x => x; -assertThrowsInstanceOf(Iterator.prototype.find.bind(undefined, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.find.bind({}, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.find.bind({next: 0}, fn), TypeError); +assert.throws(TypeError, Iterator.prototype.find.bind(undefined, fn)); +assert.throws(TypeError, Iterator.prototype.find.bind({}, fn)); +assert.throws(TypeError, Iterator.prototype.find.bind({next: 0}, fn)); diff --git a/test/staging/sm/Iterator/prototype/find/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/find/value-throws-iterator-not-closed.js index 4958570e22..524e6b9deb 100644 --- a/test/staging/sm/Iterator/prototype/find/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/find/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.find(x => x), TestError); +assert.throws(TestError, () => iterator.find(x => x)); assert.sameValue(iterator.closed, false, 'iterator remains unclosed'); diff --git a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-complete-throws.js b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-complete-throws.js index 35a176ebca..8c00704816 100644 --- a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-complete-throws.js +++ b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-complete-throws.js @@ -44,6 +44,6 @@ const iter = new TestIterator(); const mapped = iter.flatMap(x => new InnerIterator()); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => mapped.next(), TestError); +assert.throws(TestError, () => mapped.next()); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-next-throws.js b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-next-throws.js index 0eea13097c..9c921b85a8 100644 --- a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-next-throws.js +++ b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-next-throws.js @@ -40,6 +40,6 @@ const iter = new TestIterator(); const mapped = iter.flatMap(x => new InnerIterator()); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => mapped.next(), TestError); +assert.throws(TestError, () => mapped.next()); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-value-throws.js b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-value-throws.js index 67b47c574e..4ef3b3c9ce 100644 --- a/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-value-throws.js +++ b/test/staging/sm/Iterator/prototype/flatMap/close-iterator-when-inner-value-throws.js @@ -47,6 +47,6 @@ const iter = new TestIterator(); const mapped = iter.flatMap(x => new InnerIterator()); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => mapped.next(), TestError); +assert.throws(TestError, () => mapped.next()); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/flatMap/throw-when-inner-not-iterable.js b/test/staging/sm/Iterator/prototype/flatMap/throw-when-inner-not-iterable.js index 40b97235c9..90cf94b78f 100644 --- a/test/staging/sm/Iterator/prototype/flatMap/throw-when-inner-not-iterable.js +++ b/test/staging/sm/Iterator/prototype/flatMap/throw-when-inner-not-iterable.js @@ -50,7 +50,7 @@ for (const value of nonIterables) { const mapped = iter.flatMap(x => value); assert.sameValue(iter.closed, false); - assertThrowsInstanceOf(() => mapped.next(), TypeError); + assert.throws(TypeError, () => mapped.next()); assert.sameValue(iter.closed, true); } diff --git a/test/staging/sm/Iterator/prototype/forEach/check-fn-after-getting-iterator.js b/test/staging/sm/Iterator/prototype/forEach/check-fn-after-getting-iterator.js index 914ef36254..7fbd6826e9 100644 --- a/test/staging/sm/Iterator/prototype/forEach/check-fn-after-getting-iterator.js +++ b/test/staging/sm/Iterator/prototype/forEach/check-fn-after-getting-iterator.js @@ -28,7 +28,7 @@ class TestIterator extends Iterator { } const iter = new Proxy(new TestIterator(), handlerProxy); -assertThrowsInstanceOf(() => iter.forEach(1), TypeError); +assert.throws(TypeError, () => iter.forEach(1)); assert.compareArray( log, diff --git a/test/staging/sm/Iterator/prototype/forEach/error-from-correct-realm.js b/test/staging/sm/Iterator/prototype/forEach/error-from-correct-realm.js index d8bd026979..19b769dc69 100644 --- a/test/staging/sm/Iterator/prototype/forEach/error-from-correct-realm.js +++ b/test/staging/sm/Iterator/prototype/forEach/error-from-correct-realm.js @@ -19,10 +19,10 @@ assert.sameValue(TypeError !== otherGlobal.TypeError, true); const iter = [].values(); -assertThrowsInstanceOf(() => iter.forEach(), TypeError); -assertThrowsInstanceOf( - otherGlobal.Iterator.prototype.forEach.bind(iter), +assert.throws(TypeError, () => iter.forEach(), TypeError); +assert.throws( otherGlobal.TypeError, + otherGlobal.Iterator.prototype.forEach.bind(iter), 'TypeError comes from the realm of the method.', ); diff --git a/test/staging/sm/Iterator/prototype/forEach/fn-not-callable-throws.js b/test/staging/sm/Iterator/prototype/forEach/fn-not-callable-throws.js index 3267b07877..828dc1923e 100644 --- a/test/staging/sm/Iterator/prototype/forEach/fn-not-callable-throws.js +++ b/test/staging/sm/Iterator/prototype/forEach/fn-not-callable-throws.js @@ -16,12 +16,12 @@ esid: pending const iter = [].values(); -assertThrowsInstanceOf(() => iter.forEach(), TypeError); -assertThrowsInstanceOf(() => iter.forEach(undefined), TypeError); -assertThrowsInstanceOf(() => iter.forEach(null), TypeError); -assertThrowsInstanceOf(() => iter.forEach(0), TypeError); -assertThrowsInstanceOf(() => iter.forEach(false), TypeError); -assertThrowsInstanceOf(() => iter.forEach(''), TypeError); -assertThrowsInstanceOf(() => iter.forEach(Symbol('')), TypeError); -assertThrowsInstanceOf(() => iter.forEach({}), TypeError); +assert.throws(TypeError, () => iter.forEach()); +assert.throws(TypeError, () => iter.forEach(undefined)); +assert.throws(TypeError, () => iter.forEach(null)); +assert.throws(TypeError, () => iter.forEach(0)); +assert.throws(TypeError, () => iter.forEach(false)); +assert.throws(TypeError, () => iter.forEach('')); +assert.throws(TypeError, () => iter.forEach(Symbol(''))); +assert.throws(TypeError, () => iter.forEach({})); diff --git a/test/staging/sm/Iterator/prototype/forEach/fn-throws-close-iterator.js b/test/staging/sm/Iterator/prototype/forEach/fn-throws-close-iterator.js index 543afaf1f2..e6ced06102 100644 --- a/test/staging/sm/Iterator/prototype/forEach/fn-throws-close-iterator.js +++ b/test/staging/sm/Iterator/prototype/forEach/fn-throws-close-iterator.js @@ -29,6 +29,6 @@ const fn = () => { throw new Error(); }; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.forEach(fn), Error); +assert.throws(Error, () => iter.forEach(fn)); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/forEach/next-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/forEach/next-throws-iterator-not-closed.js index dce94b4bfb..8af8a03281 100644 --- a/test/staging/sm/Iterator/prototype/forEach/next-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/forEach/next-throws-iterator-not-closed.js @@ -29,6 +29,6 @@ const fn = () => {}; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.forEach(fn), Error); +assert.throws(Error, () => iter.forEach(fn)); assert.sameValue(iter.closed, false); diff --git a/test/staging/sm/Iterator/prototype/forEach/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/forEach/this-not-iterator-throws.js index 64f6a57d92..8ea6abee14 100644 --- a/test/staging/sm/Iterator/prototype/forEach/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/forEach/this-not-iterator-throws.js @@ -15,7 +15,7 @@ esid: pending ---*/ const fn = x => x; -assertThrowsInstanceOf(Iterator.prototype.forEach.bind(undefined, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.forEach.bind({}, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.forEach.bind({next: 0}, fn), TypeError); +assert.throws(TypeError, Iterator.prototype.forEach.bind(undefined, fn)); +assert.throws(TypeError, Iterator.prototype.forEach.bind({}, fn)); +assert.throws(TypeError, Iterator.prototype.forEach.bind({next: 0}, fn)); diff --git a/test/staging/sm/Iterator/prototype/forEach/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/forEach/value-throws-iterator-not-closed.js index d6634a9829..4e57237822 100644 --- a/test/staging/sm/Iterator/prototype/forEach/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/forEach/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.forEach(x => x), TestError); +assert.throws(TestError, () => iterator.forEach(x => x)); assert.sameValue(iterator.closed, false, 'iterator remains unclosed'); diff --git a/test/staging/sm/Iterator/prototype/generator-methods-throw-on-iterator-helpers.js b/test/staging/sm/Iterator/prototype/generator-methods-throw-on-iterator-helpers.js index 8b7b05a7b0..7486511e89 100644 --- a/test/staging/sm/Iterator/prototype/generator-methods-throw-on-iterator-helpers.js +++ b/test/staging/sm/Iterator/prototype/generator-methods-throw-on-iterator-helpers.js @@ -20,7 +20,7 @@ const generatorProto = Object.getPrototypeOf( const iteratorHelper = [0].values().map(x => x); -assertThrowsInstanceOf(() => generatorProto.next.call(iteratorHelper), TypeError); -assertThrowsInstanceOf(() => generatorProto.return.call(iteratorHelper), TypeError); -assertThrowsInstanceOf(() => generatorProto.throw.call(iteratorHelper), TypeError); +assert.throws(TypeError, () => generatorProto.next.call(iteratorHelper)); +assert.throws(TypeError, () => generatorProto.return.call(iteratorHelper)); +assert.throws(TypeError, () => generatorProto.throw.call(iteratorHelper)); diff --git a/test/staging/sm/Iterator/prototype/iterator-helper-methods-throw-on-generators.js b/test/staging/sm/Iterator/prototype/iterator-helper-methods-throw-on-generators.js index 3b91defdf9..9040f457e4 100644 --- a/test/staging/sm/Iterator/prototype/iterator-helper-methods-throw-on-generators.js +++ b/test/staging/sm/Iterator/prototype/iterator-helper-methods-throw-on-generators.js @@ -18,7 +18,7 @@ function *gen() { yield 1; } -assertThrowsInstanceOf(() => iteratorHelperProto.next.call(gen()), TypeError); -assertThrowsInstanceOf(() => iteratorHelperProto.return.call(gen()), TypeError); -assertThrowsInstanceOf(() => iteratorHelperProto.throw.call(gen()), TypeError); +assert.throws(TypeError, () => iteratorHelperProto.next.call(gen())); +assert.throws(TypeError, () => iteratorHelperProto.return.call(gen())); +assert.throws(TypeError, () => iteratorHelperProto.throw.call(gen())); diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-closed-on-call-throws.js b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-closed-on-call-throws.js index 7e3d72bdbb..f74a6821bd 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-closed-on-call-throws.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-closed-on-call-throws.js @@ -41,7 +41,7 @@ const methods = [ for (const method of methods) { const iter = new TestIterator(); assert.sameValue(iter.closed, false); - assertThrowsInstanceOf(() => method(iter).next(), TestError); + assert.throws(TestError, () => method(iter).next()); assert.sameValue(iter.closed, true); } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-next-throws.js b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-next-throws.js index 792fce1f1e..8593d27418 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-next-throws.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-next-throws.js @@ -41,7 +41,7 @@ const methods = [ for (const method of methods) { assert.sameValue(iterator.closed, false); - assertThrowsInstanceOf(() => method(iterator).next(), TestError); + assert.throws(TestError, () => method(iterator).next()); assert.sameValue(iterator.closed, false); } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-value-throws.js b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-value-throws.js index 9ec39e11ad..7904390657 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-value-throws.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-iterator-not-closed-on-value-throws.js @@ -45,7 +45,7 @@ const methods = [ for (const method of methods) { assert.sameValue(iterator.closed, false); - assertThrowsInstanceOf(() => method(iterator).next(), TestError); + assert.throws(TestError, () => method(iterator).next()); assert.sameValue(iterator.closed, false); } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-reentry-not-close-iterator.js b/test/staging/sm/Iterator/prototype/lazy-methods-reentry-not-close-iterator.js index c4084f024d..2b50ec5adb 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-reentry-not-close-iterator.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-reentry-not-close-iterator.js @@ -27,7 +27,7 @@ for (const method of methods) { if (x == 2) { // Reenter the currently running generator. reentered = true; - assertThrowsInstanceOf(() => iterHelper.next(), TypeError); + assert.throws(TypeError, () => iterHelper.next()); } return method[1](x); }); diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-callable.js b/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-callable.js index 105c632255..d3c6ff4ed4 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-callable.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-callable.js @@ -23,20 +23,20 @@ const methods = [ ]; for (const method of methods) { - assertThrowsInstanceOf(() => method(Iterator.prototype, 0), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, false), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, undefined), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, null), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, ''), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, Symbol('')), TypeError); - assertThrowsInstanceOf(() => method(Iterator.prototype, {}), TypeError); + assert.throws(TypeError, () => method(Iterator.prototype, 0)); + assert.throws(TypeError, () => method(Iterator.prototype, false)); + assert.throws(TypeError, () => method(Iterator.prototype, undefined)); + assert.throws(TypeError, () => method(Iterator.prototype, null)); + assert.throws(TypeError, () => method(Iterator.prototype, '')); + assert.throws(TypeError, () => method(Iterator.prototype, Symbol(''))); + assert.throws(TypeError, () => method(Iterator.prototype, {})); - assertThrowsInstanceOf(() => method([].values(), 0), TypeError); - assertThrowsInstanceOf(() => method([].values(), false), TypeError); - assertThrowsInstanceOf(() => method([].values(), undefined), TypeError); - assertThrowsInstanceOf(() => method([].values(), null), TypeError); - assertThrowsInstanceOf(() => method([].values(), ''), TypeError); - assertThrowsInstanceOf(() => method([].values(), Symbol('')), TypeError); - assertThrowsInstanceOf(() => method([].values(), {}), TypeError); + assert.throws(TypeError, () => method([].values(), 0)); + assert.throws(TypeError, () => method([].values(), false)); + assert.throws(TypeError, () => method([].values(), undefined)); + assert.throws(TypeError, () => method([].values(), null)); + assert.throws(TypeError, () => method([].values(), '')); + assert.throws(TypeError, () => method([].values(), Symbol(''))); + assert.throws(TypeError, () => method([].values(), {})); } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-iterator.js b/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-iterator.js index b48bf14c0f..350a1936e4 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-iterator.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-throw-eagerly-on-non-iterator.js @@ -25,12 +25,12 @@ const methods = [ ]; for (const method of methods) { - assertThrowsInstanceOf(method(undefined), TypeError); - assertThrowsInstanceOf(method(null), TypeError); - assertThrowsInstanceOf(method(0), TypeError); - assertThrowsInstanceOf(method(false), TypeError); - assertThrowsInstanceOf(method(''), TypeError); - assertThrowsInstanceOf(method(Symbol('')), TypeError); + assert.throws(TypeError, method(undefined)); + assert.throws(TypeError, method(null)); + assert.throws(TypeError, method(0)); + assert.throws(TypeError, method(false)); + assert.throws(TypeError, method('')); + assert.throws(TypeError, method(Symbol(''))); // No error here. method({}); diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-done-throws.js b/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-done-throws.js index 39906c077b..19bf225ab3 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-done-throws.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-done-throws.js @@ -44,7 +44,7 @@ const methods = [ for (const method of methods) { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false); - assertThrowsInstanceOf(() => method(iterator).next(), TestError); + assert.throws(TestError, () => method(iterator).next()); assert.sameValue(iterator.closed, false); } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-not-object.js b/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-not-object.js index 6a1eaa09e8..81806f23f0 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-not-object.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-throw-next-not-object.js @@ -40,7 +40,7 @@ for (const method of methods) { for (const value of [undefined, null, 0, false, '', Symbol('')]) { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false); - assertThrowsInstanceOf(() => method(iterator).next(value), TypeError); + assert.throws(TypeError, () => method(iterator).next(value)); assert.sameValue(iterator.closed, false); } } diff --git a/test/staging/sm/Iterator/prototype/lazy-methods-throw-on-reentry.js b/test/staging/sm/Iterator/prototype/lazy-methods-throw-on-reentry.js index 10293fb264..4cfc4a7506 100644 --- a/test/staging/sm/Iterator/prototype/lazy-methods-throw-on-reentry.js +++ b/test/staging/sm/Iterator/prototype/lazy-methods-throw-on-reentry.js @@ -23,6 +23,6 @@ for (const method of methods) { const iterMethod = method(iter); let iterHelper; iterHelper = iterMethod.call(iter, x => iterHelper.next()); - assertThrowsInstanceOf(() => iterHelper.next(), TypeError); + assert.throws(TypeError, () => iterHelper.next()); } diff --git a/test/staging/sm/Iterator/prototype/map/clobber-symbol.js b/test/staging/sm/Iterator/prototype/map/clobber-symbol.js index c16f8044a6..157959daf5 100644 --- a/test/staging/sm/Iterator/prototype/map/clobber-symbol.js +++ b/test/staging/sm/Iterator/prototype/map/clobber-symbol.js @@ -16,7 +16,7 @@ info: | Iterator is not enabled unconditionally ---*/ Symbol = undefined; -assertThrowsInstanceOf(() => Symbol.iterator, TypeError); +assert.throws(TypeError, () => Symbol.iterator); const iterator = [0].values(); assert.sameValue( diff --git a/test/staging/sm/Iterator/prototype/map/mapper-not-callable-throw.js b/test/staging/sm/Iterator/prototype/map/mapper-not-callable-throw.js index a0418e53a8..fc45af6515 100644 --- a/test/staging/sm/Iterator/prototype/map/mapper-not-callable-throw.js +++ b/test/staging/sm/Iterator/prototype/map/mapper-not-callable-throw.js @@ -13,24 +13,24 @@ flags: ---*/ // -assertThrowsInstanceOf(() => Iterator.prototype.map(undefined), TypeError); -assertThrowsInstanceOf(() => [].values().map(undefined), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map(undefined)); +assert.throws(TypeError, () => [].values().map(undefined)); -assertThrowsInstanceOf(() => Iterator.prototype.map(null), TypeError); -assertThrowsInstanceOf(() => [].values().map(null), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map(null)); +assert.throws(TypeError, () => [].values().map(null)); -assertThrowsInstanceOf(() => Iterator.prototype.map(0), TypeError); -assertThrowsInstanceOf(() => [].values().map(0), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map(0)); +assert.throws(TypeError, () => [].values().map(0)); -assertThrowsInstanceOf(() => Iterator.prototype.map(false), TypeError); -assertThrowsInstanceOf(() => [].values().map(false), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map(false)); +assert.throws(TypeError, () => [].values().map(false)); -assertThrowsInstanceOf(() => Iterator.prototype.map({}), TypeError); -assertThrowsInstanceOf(() => [].values().map({}), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map({})); +assert.throws(TypeError, () => [].values().map({})); -assertThrowsInstanceOf(() => Iterator.prototype.map(''), TypeError); -assertThrowsInstanceOf(() => [].values().map(''), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map('')); +assert.throws(TypeError, () => [].values().map('')); -assertThrowsInstanceOf(() => Iterator.prototype.map(Symbol('')), TypeError); -assertThrowsInstanceOf(() => [].values().map(Symbol('')), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map(Symbol(''))); +assert.throws(TypeError, () => [].values().map(Symbol(''))); diff --git a/test/staging/sm/Iterator/prototype/map/reenter-map-generator-from-mapper.js b/test/staging/sm/Iterator/prototype/map/reenter-map-generator-from-mapper.js index 4786ef5a0b..d9b1a74629 100644 --- a/test/staging/sm/Iterator/prototype/map/reenter-map-generator-from-mapper.js +++ b/test/staging/sm/Iterator/prototype/map/reenter-map-generator-from-mapper.js @@ -21,5 +21,5 @@ function mapper(x) { } iterator = [0].values().map(mapper); -assertThrowsInstanceOf(iterator.next, TypeError); +assert.throws(TypeError, iterator.next); diff --git a/test/staging/sm/Iterator/prototype/map/this-not-iterator-throw.js b/test/staging/sm/Iterator/prototype/map/this-not-iterator-throw.js index 413c2d2182..97c516096a 100644 --- a/test/staging/sm/Iterator/prototype/map/this-not-iterator-throw.js +++ b/test/staging/sm/Iterator/prototype/map/this-not-iterator-throw.js @@ -15,10 +15,10 @@ flags: const mapper = (x) => x; -assertThrowsInstanceOf(() => Iterator.prototype.map.call(undefined, mapper), TypeError); -assertThrowsInstanceOf(() => Iterator.prototype.map.call(null, mapper), TypeError); -assertThrowsInstanceOf(() => Iterator.prototype.map.call(0, mapper), TypeError); -assertThrowsInstanceOf(() => Iterator.prototype.map.call(false, mapper), TypeError); -assertThrowsInstanceOf(() => Iterator.prototype.map.call('', mapper), TypeError); -assertThrowsInstanceOf(() => Iterator.prototype.map.call(new Symbol(''), mapper), TypeError); +assert.throws(TypeError, () => Iterator.prototype.map.call(undefined, mapper)); +assert.throws(TypeError, () => Iterator.prototype.map.call(null, mapper)); +assert.throws(TypeError, () => Iterator.prototype.map.call(0, mapper)); +assert.throws(TypeError, () => Iterator.prototype.map.call(false, mapper)); +assert.throws(TypeError, () => Iterator.prototype.map.call('', mapper)); +assert.throws(TypeError, () => Iterator.prototype.map.call(new Symbol(''), mapper)); diff --git a/test/staging/sm/Iterator/prototype/map/throw-when-iterator-returns-non-object.js b/test/staging/sm/Iterator/prototype/map/throw-when-iterator-returns-non-object.js index 4881326170..bd98bcd6b6 100644 --- a/test/staging/sm/Iterator/prototype/map/throw-when-iterator-returns-non-object.js +++ b/test/staging/sm/Iterator/prototype/map/throw-when-iterator-returns-non-object.js @@ -18,10 +18,10 @@ const iterator = returnValue => Object.setPrototypeOf({ }, Iterator.prototype); const mapper = x => x; -assertThrowsInstanceOf(() => iterator(undefined).map(mapper).next(), TypeError); -assertThrowsInstanceOf(() => iterator(null).map(mapper).next(), TypeError); -assertThrowsInstanceOf(() => iterator(0).map(mapper).next(), TypeError); -assertThrowsInstanceOf(() => iterator(false).map(mapper).next(), TypeError); -assertThrowsInstanceOf(() => iterator('').map(mapper).next(), TypeError); -assertThrowsInstanceOf(() => iterator(Symbol()).map(mapper).next(), TypeError); +assert.throws(TypeError, () => iterator(undefined).map(mapper).next()); +assert.throws(TypeError, () => iterator(null).map(mapper).next()); +assert.throws(TypeError, () => iterator(0).map(mapper).next()); +assert.throws(TypeError, () => iterator(false).map(mapper).next()); +assert.throws(TypeError, () => iterator('').map(mapper).next()); +assert.throws(TypeError, () => iterator(Symbol()).map(mapper).next()); diff --git a/test/staging/sm/Iterator/prototype/reduce/check-fn-after-getting-iterator.js b/test/staging/sm/Iterator/prototype/reduce/check-fn-after-getting-iterator.js index bb4d8e3e35..0e1ae555cb 100644 --- a/test/staging/sm/Iterator/prototype/reduce/check-fn-after-getting-iterator.js +++ b/test/staging/sm/Iterator/prototype/reduce/check-fn-after-getting-iterator.js @@ -28,7 +28,7 @@ class TestIterator extends Iterator { } const iter = new Proxy(new TestIterator(), handlerProxy); -assertThrowsInstanceOf(() => iter.reduce(1), TypeError); +assert.throws(TypeError, () => iter.reduce(1)); assert.compareArray( log, diff --git a/test/staging/sm/Iterator/prototype/reduce/empty-iterator-without-initial-value-throws.js b/test/staging/sm/Iterator/prototype/reduce/empty-iterator-without-initial-value-throws.js index 2e83f766fe..7c3e5a04bf 100644 --- a/test/staging/sm/Iterator/prototype/reduce/empty-iterator-without-initial-value-throws.js +++ b/test/staging/sm/Iterator/prototype/reduce/empty-iterator-without-initial-value-throws.js @@ -15,5 +15,5 @@ esid: pending ---*/ const iter = [].values(); -assertThrowsInstanceOf(() => iter.reduce((x, y) => x + y), TypeError); +assert.throws(TypeError, () => iter.reduce((x, y) => x + y)); diff --git a/test/staging/sm/Iterator/prototype/reduce/error-from-correct-realm.js b/test/staging/sm/Iterator/prototype/reduce/error-from-correct-realm.js index ebd46caf96..fd97e9b199 100644 --- a/test/staging/sm/Iterator/prototype/reduce/error-from-correct-realm.js +++ b/test/staging/sm/Iterator/prototype/reduce/error-from-correct-realm.js @@ -19,10 +19,10 @@ assert.sameValue(TypeError !== otherGlobal.TypeError, true); const iter = [].values(); -assertThrowsInstanceOf(() => iter.reduce(), TypeError); -assertThrowsInstanceOf( - otherGlobal.Iterator.prototype.reduce.bind(iter), +assert.throws(TypeError, () => iter.reduce(), TypeError); +assert.throws( otherGlobal.TypeError, + otherGlobal.Iterator.prototype.reduce.bind(iter), 'TypeError comes from the realm of the method.', ); diff --git a/test/staging/sm/Iterator/prototype/reduce/iterator-next-return-non-object-throws.js b/test/staging/sm/Iterator/prototype/reduce/iterator-next-return-non-object-throws.js index 04488da40d..a33ee5962b 100644 --- a/test/staging/sm/Iterator/prototype/reduce/iterator-next-return-non-object-throws.js +++ b/test/staging/sm/Iterator/prototype/reduce/iterator-next-return-non-object-throws.js @@ -28,15 +28,15 @@ class TestIterator extends Iterator { const sum = (x, y) => x + y; let iter = new TestIterator(undefined); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); iter = new TestIterator(null); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); iter = new TestIterator(0); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); iter = new TestIterator(false); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); iter = new TestIterator(''); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); iter = new TestIterator(Symbol('')); -assertThrowsInstanceOf(() => iter.reduce(sum), TypeError); +assert.throws(TypeError, () => iter.reduce(sum)); diff --git a/test/staging/sm/Iterator/prototype/reduce/next-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/reduce/next-throws-iterator-not-closed.js index b165c22f04..74266322ea 100644 --- a/test/staging/sm/Iterator/prototype/reduce/next-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/reduce/next-throws-iterator-not-closed.js @@ -29,6 +29,6 @@ const sum = (x, y) => x + y; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.reduce(sum), Error); +assert.throws(Error, () => iter.reduce(sum)); assert.sameValue(iter.closed, false); diff --git a/test/staging/sm/Iterator/prototype/reduce/reducer-not-callable-throws.js b/test/staging/sm/Iterator/prototype/reduce/reducer-not-callable-throws.js index 5e455b7d11..435e12de67 100644 --- a/test/staging/sm/Iterator/prototype/reduce/reducer-not-callable-throws.js +++ b/test/staging/sm/Iterator/prototype/reduce/reducer-not-callable-throws.js @@ -21,12 +21,12 @@ class TestIterator extends Iterator { } const iter = new TestIterator(); -assertThrowsInstanceOf(() => iter.reduce(), TypeError); -assertThrowsInstanceOf(() => iter.reduce(undefined), TypeError); -assertThrowsInstanceOf(() => iter.reduce(null), TypeError); -assertThrowsInstanceOf(() => iter.reduce(0), TypeError); -assertThrowsInstanceOf(() => iter.reduce(false), TypeError); -assertThrowsInstanceOf(() => iter.reduce(''), TypeError); -assertThrowsInstanceOf(() => iter.reduce(Symbol('')), TypeError); -assertThrowsInstanceOf(() => iter.reduce({}), TypeError); +assert.throws(TypeError, () => iter.reduce()); +assert.throws(TypeError, () => iter.reduce(undefined)); +assert.throws(TypeError, () => iter.reduce(null)); +assert.throws(TypeError, () => iter.reduce(0)); +assert.throws(TypeError, () => iter.reduce(false)); +assert.throws(TypeError, () => iter.reduce('')); +assert.throws(TypeError, () => iter.reduce(Symbol(''))); +assert.throws(TypeError, () => iter.reduce({})); diff --git a/test/staging/sm/Iterator/prototype/reduce/reducer-throws-iterator-closed.js b/test/staging/sm/Iterator/prototype/reduce/reducer-throws-iterator-closed.js index 686b4b8c21..eb58a36d68 100644 --- a/test/staging/sm/Iterator/prototype/reduce/reducer-throws-iterator-closed.js +++ b/test/staging/sm/Iterator/prototype/reduce/reducer-throws-iterator-closed.js @@ -29,6 +29,6 @@ const reducer = (x, y) => { throw new Error(); }; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.reduce(reducer), Error); +assert.throws(Error, () => iter.reduce(reducer)); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/reduce/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/reduce/this-not-iterator-throws.js index 1f6c3905e4..6ec4e41b5d 100644 --- a/test/staging/sm/Iterator/prototype/reduce/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/reduce/this-not-iterator-throws.js @@ -15,7 +15,7 @@ esid: pending ---*/ const sum = (x, y) => x + y; -assertThrowsInstanceOf(Iterator.prototype.reduce.bind(undefined, sum), TypeError); -assertThrowsInstanceOf(Iterator.prototype.reduce.bind({}, sum), TypeError); -assertThrowsInstanceOf(Iterator.prototype.reduce.bind({next: 0}, sum), TypeError); +assert.throws(TypeError, Iterator.prototype.reduce.bind(undefined, sum)); +assert.throws(TypeError, Iterator.prototype.reduce.bind({}, sum)); +assert.throws(TypeError, Iterator.prototype.reduce.bind({next: 0}, sum)); diff --git a/test/staging/sm/Iterator/prototype/reduce/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/reduce/value-throws-iterator-not-closed.js index 313bd2610a..739241d054 100644 --- a/test/staging/sm/Iterator/prototype/reduce/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/reduce/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.reduce((x, y) => x + y, 0), TestError); +assert.throws(TestError, () => iterator.reduce((x, y) => x + y, 0)); assert.sameValue(iterator.closed, false, 'iterator remains unclosed'); diff --git a/test/staging/sm/Iterator/prototype/some/check-fn-after-getting-iterator.js b/test/staging/sm/Iterator/prototype/some/check-fn-after-getting-iterator.js index 7517f8576b..71a634733a 100644 --- a/test/staging/sm/Iterator/prototype/some/check-fn-after-getting-iterator.js +++ b/test/staging/sm/Iterator/prototype/some/check-fn-after-getting-iterator.js @@ -28,7 +28,7 @@ class TestIterator extends Iterator { } const iter = new Proxy(new TestIterator(), handlerProxy); -assertThrowsInstanceOf(() => iter.some(1), TypeError); +assert.throws(TypeError, () => iter.some(1)); assert.compareArray( log, diff --git a/test/staging/sm/Iterator/prototype/some/error-from-correct-realm.js b/test/staging/sm/Iterator/prototype/some/error-from-correct-realm.js index 99a9f7a725..0289b360a0 100644 --- a/test/staging/sm/Iterator/prototype/some/error-from-correct-realm.js +++ b/test/staging/sm/Iterator/prototype/some/error-from-correct-realm.js @@ -19,10 +19,10 @@ assert.sameValue(TypeError !== otherGlobal.TypeError, true); const iter = [].values(); -assertThrowsInstanceOf(() => iter.some(), TypeError); -assertThrowsInstanceOf( +assert.throws(TypeError, () => iter.some()); +assert.throws( + otherGlobal.TypeError, otherGlobal.Iterator.prototype.some.bind(iter), - otherGlobal.TypeError, 'TypeError comes from the realm of the method.', ); diff --git a/test/staging/sm/Iterator/prototype/some/fn-not-callable-throws.js b/test/staging/sm/Iterator/prototype/some/fn-not-callable-throws.js index d0cb823e37..7184b5bf19 100644 --- a/test/staging/sm/Iterator/prototype/some/fn-not-callable-throws.js +++ b/test/staging/sm/Iterator/prototype/some/fn-not-callable-throws.js @@ -16,12 +16,12 @@ esid: pending const iter = [].values(); -assertThrowsInstanceOf(() => iter.some(), TypeError); -assertThrowsInstanceOf(() => iter.some(undefined), TypeError); -assertThrowsInstanceOf(() => iter.some(null), TypeError); -assertThrowsInstanceOf(() => iter.some(0), TypeError); -assertThrowsInstanceOf(() => iter.some(false), TypeError); -assertThrowsInstanceOf(() => iter.some(''), TypeError); -assertThrowsInstanceOf(() => iter.some(Symbol('')), TypeError); -assertThrowsInstanceOf(() => iter.some({}), TypeError); +assert.throws(TypeError, () => iter.some()); +assert.throws(TypeError, () => iter.some(undefined)); +assert.throws(TypeError, () => iter.some(null)); +assert.throws(TypeError, () => iter.some(0)); +assert.throws(TypeError, () => iter.some(false)); +assert.throws(TypeError, () => iter.some('')); +assert.throws(TypeError, () => iter.some(Symbol(''))); +assert.throws(TypeError, () => iter.some({})); diff --git a/test/staging/sm/Iterator/prototype/some/fn-throws-close-iterator.js b/test/staging/sm/Iterator/prototype/some/fn-throws-close-iterator.js index dee824b69d..c88ac4f4df 100644 --- a/test/staging/sm/Iterator/prototype/some/fn-throws-close-iterator.js +++ b/test/staging/sm/Iterator/prototype/some/fn-throws-close-iterator.js @@ -29,6 +29,6 @@ const fn = () => { throw new Error(); }; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.some(fn), Error); +assert.throws(Error, () => iter.some(fn)); assert.sameValue(iter.closed, true); diff --git a/test/staging/sm/Iterator/prototype/some/next-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/some/next-throws-iterator-not-closed.js index 14c15f53a0..3fe6387229 100644 --- a/test/staging/sm/Iterator/prototype/some/next-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/some/next-throws-iterator-not-closed.js @@ -29,6 +29,6 @@ const fn = () => {}; const iter = new TestIterator(); assert.sameValue(iter.closed, false); -assertThrowsInstanceOf(() => iter.some(fn), Error); +assert.throws(Error, () => iter.some(fn)); assert.sameValue(iter.closed, false); diff --git a/test/staging/sm/Iterator/prototype/some/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/some/this-not-iterator-throws.js index b47dbbb9cb..b59c4946fa 100644 --- a/test/staging/sm/Iterator/prototype/some/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/some/this-not-iterator-throws.js @@ -15,7 +15,7 @@ esid: pending ---*/ const fn = x => x; -assertThrowsInstanceOf(Iterator.prototype.some.bind(undefined, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.some.bind({}, fn), TypeError); -assertThrowsInstanceOf(Iterator.prototype.some.bind({next: 0}, fn), TypeError); +assert.throws(TypeError, Iterator.prototype.some.bind(undefined, fn)); +assert.throws(TypeError, Iterator.prototype.some.bind({}, fn)); +assert.throws(TypeError, Iterator.prototype.some.bind({next: 0}, fn)); diff --git a/test/staging/sm/Iterator/prototype/some/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/some/value-throws-iterator-not-closed.js index fc4150ef7e..2370cf2576 100644 --- a/test/staging/sm/Iterator/prototype/some/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/some/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.some(x => x), TestError); +assert.throws(TestError, () => iterator.some(x => x)); assert.sameValue(iterator.closed, false, 'iterator remains unclosed'); diff --git a/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-negative.js b/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-negative.js index 2c3aca0282..c8312e35ac 100644 --- a/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-negative.js +++ b/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-negative.js @@ -23,10 +23,10 @@ const methods = [ ]; for (const method of methods) { - assertThrowsInstanceOf(() => method(-1), RangeError); - assertThrowsInstanceOf(() => method(-Infinity), RangeError); - assertThrowsInstanceOf(() => method(NaN), RangeError); - assertThrowsInstanceOf(() => method(-NaN), RangeError); + assert.throws(RangeError, () => method(-1)); + assert.throws(RangeError, () => method(-Infinity)); + assert.throws(RangeError, () => method(NaN)); + assert.throws(RangeError, () => method(-NaN)); method(-0); method(-0.9); diff --git a/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-non-integer.js b/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-non-integer.js index da950694c3..07aaee8018 100644 --- a/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-non-integer.js +++ b/test/staging/sm/Iterator/prototype/take-drop-throw-eagerly-on-non-integer.js @@ -29,8 +29,8 @@ const objectWithToPrimitive = { }; for (const method of methods) { - assertThrowsInstanceOf(() => method(0n), TypeError); - assertThrowsInstanceOf(() => method(Symbol('')), TypeError); - assertThrowsInstanceOf(() => method(objectWithToPrimitive), TypeError); + assert.throws(TypeError, () => method(0n)); + assert.throws(TypeError, () => method(Symbol(''))); + assert.throws(TypeError, () => method(objectWithToPrimitive)); } diff --git a/test/staging/sm/Iterator/prototype/toArray/next-throws.js b/test/staging/sm/Iterator/prototype/toArray/next-throws.js index ed2e192218..b167f7635c 100644 --- a/test/staging/sm/Iterator/prototype/toArray/next-throws.js +++ b/test/staging/sm/Iterator/prototype/toArray/next-throws.js @@ -22,5 +22,5 @@ class TestIterator extends Iterator { const iter = new TestIterator(); -assertThrowsInstanceOf(() => iter.toArray(), Error); +assert.throws(Error, () => iter.toArray()); diff --git a/test/staging/sm/Iterator/prototype/toArray/this-not-iterator-throws.js b/test/staging/sm/Iterator/prototype/toArray/this-not-iterator-throws.js index 5524007f2f..00b37605d7 100644 --- a/test/staging/sm/Iterator/prototype/toArray/this-not-iterator-throws.js +++ b/test/staging/sm/Iterator/prototype/toArray/this-not-iterator-throws.js @@ -14,7 +14,7 @@ description: | esid: pending ---*/ -assertThrowsInstanceOf(Iterator.prototype.toArray.bind(undefined), TypeError); -assertThrowsInstanceOf(Iterator.prototype.toArray.bind({}), TypeError); -assertThrowsInstanceOf(Iterator.prototype.toArray.bind({next: 0}), TypeError); +assert.throws(TypeError, Iterator.prototype.toArray.bind(undefined)); +assert.throws(TypeError, Iterator.prototype.toArray.bind({})); +assert.throws(TypeError, Iterator.prototype.toArray.bind({next: 0})); diff --git a/test/staging/sm/Iterator/prototype/toArray/value-throws-iterator-not-closed.js b/test/staging/sm/Iterator/prototype/toArray/value-throws-iterator-not-closed.js index c86999cfac..1d7ba79216 100644 --- a/test/staging/sm/Iterator/prototype/toArray/value-throws-iterator-not-closed.js +++ b/test/staging/sm/Iterator/prototype/toArray/value-throws-iterator-not-closed.js @@ -32,6 +32,6 @@ class TestIterator extends Iterator { const iterator = new TestIterator(); assert.sameValue(iterator.closed, false, 'iterator starts unclosed'); -assertThrowsInstanceOf(() => iterator.toArray(), TestError); +assert.throws(TestError, () => iterator.toArray()); assert.sameValue(iterator.closed, false, 'iterator remains unclosed');