summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js
blob: 2a8e49d89b34d747ffbf1c6bc51e4ceb2a55c54c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// mapiter.next() returns an actual array.

load(libdir + "iteration.js");

var key = {};
var map = new Map([[key, 'value']]);
var entry = map[Symbol.iterator]().next().value;
assertEq(Array.isArray(entry), true);
assertEq(Object.getPrototypeOf(entry), Array.prototype);
assertEq(Object.isExtensible(entry), true);

assertEq(entry.length, 2);
var names = Object.getOwnPropertyNames(entry).sort();
assertEq(names.length, 3);
assertEq(names.join(","), "0,1,length");
assertEq(entry[0], key);
assertEq(entry[1], 'value');