diff options
Diffstat (limited to 'js/src/tests/non262/AsyncIterator/prototype/toArray/next-throws.js')
-rw-r--r-- | js/src/tests/non262/AsyncIterator/prototype/toArray/next-throws.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/toArray/next-throws.js b/js/src/tests/non262/AsyncIterator/prototype/toArray/next-throws.js new file mode 100644 index 0000000000..d998f83e83 --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/toArray/next-throws.js @@ -0,0 +1,23 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) + +class TestIterator extends AsyncIterator { + next() { + throw new Error(); + } + + closed = false; + return() { + this.closed = true; + } +} + +const iter = new TestIterator(); + +assertEq(iter.closed, false); +iter.toArray().then(() => assertEq(true, false, 'expected error'), err => { + assertEq(err instanceof Error, true); + assertEq(iter.closed, false); +}); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); |