From 1725372f00d108f6e0f14c4a74622bdbe65a5142 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Mon, 22 May 2023 09:34:15 -0600 Subject: [PATCH] https://github.com/tc39/proposal-iterator-helpers/pull/274 --- .../Iterator/prototype/drop/this-non-callable-next.js | 4 +++- .../Iterator/prototype/filter/this-non-callable-next.js | 4 +++- .../Iterator/prototype/flatMap/this-non-callable-next.js | 4 +++- .../Iterator/prototype/map/this-non-callable-next.js | 4 +++- .../Iterator/prototype/take/this-non-callable-next.js | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/built-ins/Iterator/prototype/drop/this-non-callable-next.js b/test/built-ins/Iterator/prototype/drop/this-non-callable-next.js index 91c00b593a..5d97e87ecd 100644 --- a/test/built-ins/Iterator/prototype/drop/this-non-callable-next.js +++ b/test/built-ins/Iterator/prototype/drop/this-non-callable-next.js @@ -12,6 +12,8 @@ info: | features: [iterator-helpers] flags: [] ---*/ +let iter = Iterator.prototype.drop.call({ next: 0 }, 1); + assert.throws(TypeError, function() { - Iterator.prototype.drop.call({ next: 0 }, 1); + iter.next(); }); diff --git a/test/built-ins/Iterator/prototype/filter/this-non-callable-next.js b/test/built-ins/Iterator/prototype/filter/this-non-callable-next.js index a6a7ca0e08..60fd47fd48 100644 --- a/test/built-ins/Iterator/prototype/filter/this-non-callable-next.js +++ b/test/built-ins/Iterator/prototype/filter/this-non-callable-next.js @@ -12,6 +12,8 @@ info: | features: [iterator-helpers] flags: [] ---*/ +let iter = Iterator.prototype.filter.call({ next: 0 }, () => true); + assert.throws(TypeError, function() { - Iterator.prototype.filter.call({ next: 0 }, () => true); + iter.next(); }); diff --git a/test/built-ins/Iterator/prototype/flatMap/this-non-callable-next.js b/test/built-ins/Iterator/prototype/flatMap/this-non-callable-next.js index e98000ff97..2a04205527 100644 --- a/test/built-ins/Iterator/prototype/flatMap/this-non-callable-next.js +++ b/test/built-ins/Iterator/prototype/flatMap/this-non-callable-next.js @@ -10,6 +10,8 @@ info: | features: [iterator-helpers] flags: [] ---*/ +let iter = Iterator.prototype.flatMap.call({ next: 0 }, () => []); + assert.throws(TypeError, function() { - Iterator.prototype.flatMap.call({ next: 0 }, () => []); + iter.next(); }); diff --git a/test/built-ins/Iterator/prototype/map/this-non-callable-next.js b/test/built-ins/Iterator/prototype/map/this-non-callable-next.js index c91eb8ef00..6509bc2585 100644 --- a/test/built-ins/Iterator/prototype/map/this-non-callable-next.js +++ b/test/built-ins/Iterator/prototype/map/this-non-callable-next.js @@ -10,6 +10,8 @@ info: | features: [iterator-helpers] flags: [] ---*/ +let iter = Iterator.prototype.map.call({ next: 0 }, () => 0); + assert.throws(TypeError, function() { - Iterator.prototype.map.call({ next: 0 }, () => 0); + iter.next(); }); diff --git a/test/built-ins/Iterator/prototype/take/this-non-callable-next.js b/test/built-ins/Iterator/prototype/take/this-non-callable-next.js index c923ff9d03..da9b60e213 100644 --- a/test/built-ins/Iterator/prototype/take/this-non-callable-next.js +++ b/test/built-ins/Iterator/prototype/take/this-non-callable-next.js @@ -12,6 +12,8 @@ info: | features: [iterator-helpers] flags: [] ---*/ +let iter = Iterator.prototype.take.call({ next: 0 }, 1); + assert.throws(TypeError, function() { - Iterator.prototype.take.call({ next: 0 }, 1); + iter.next(); });