diff options
Diffstat (limited to 'js/src/tests/non262/Iterator/prototype/toArray/toArray.js')
-rw-r--r-- | js/src/tests/non262/Iterator/prototype/toArray/toArray.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/src/tests/non262/Iterator/prototype/toArray/toArray.js b/js/src/tests/non262/Iterator/prototype/toArray/toArray.js new file mode 100644 index 0000000000..29c99525fb --- /dev/null +++ b/js/src/tests/non262/Iterator/prototype/toArray/toArray.js @@ -0,0 +1,17 @@ +// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally + +const iter = [1, 2, 3].values(); +assertEq(Array.isArray(iter), false); + +const array = iter.toArray(); +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); |