summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/prototype/toArray/toArray.js
blob: 29c99525fbcf830a707917a8cc52f701b8f06afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);