diff options
Diffstat (limited to 'js/src/tests/non262/Iterator/prototype/lazy-methods-iterator-returns-done-generator-finishes.js')
-rw-r--r-- | js/src/tests/non262/Iterator/prototype/lazy-methods-iterator-returns-done-generator-finishes.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/lazy-methods-iterator-returns-done-generator-finishes.js b/js/src/tests/non262/Iterator/prototype/lazy-methods-iterator-returns-done-generator-finishes.js new file mode 100644 index 0000000000..f1d5bb4c38 --- /dev/null +++ b/js/src/tests/non262/Iterator/prototype/lazy-methods-iterator-returns-done-generator-finishes.js @@ -0,0 +1,26 @@ +// |reftest| skip-if(!this.hasOwnProperty('Iterator')) + +class TestIterator extends Iterator { + next() { + return {done: true, value: 'value'}; + } +} + +const methods = [ + iter => iter.map(x => x), + iter => iter.filter(x => true), + iter => iter.take(1), + iter => iter.drop(0), + iter => iter.flatMap(x => [x]), +]; + +for (const method of methods) { + const iterator = method(new TestIterator()); + const result = iterator.next(); + assertEq(result.done, true); + assertEq(result.value, undefined); +} + +if (typeof reportCompare == 'function') + reportCompare(0, 0); + |