diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/non262/AsyncIterator/prototype/toArray/toArray.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/toArray/toArray.js b/js/src/tests/non262/AsyncIterator/prototype/toArray/toArray.js new file mode 100644 index 0000000000..0a91e4d95d --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/toArray/toArray.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) + +async function* gen() { + yield 1; + yield 2; + yield 3; +} +assertEq(Array.isArray(gen()), false); + +gen().toArray().then(array => { + assertEq(Array.isArray(array), true); + assertEq(array.length, 3); + + const expected = [1, 2, 3]; + for (const item of array) { + const expect = expected.shift(); + assertEq(item, expect); + } +}); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); |