summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Map-iterator-add-2.js
blob: fce3dac6ed0c8b104580ade51732f3f52929165a (plain)
1
2
3
4
5
6
7
8
9
10
// A Map iterator does not iterate over new entries added after it throws StopIteration.

load(libdir + "iteration.js");

var map = new Map();
var iter0 = map[Symbol.iterator](), iter1 = map[Symbol.iterator]();
assertIteratorDone(iter0, undefined);  // closes iter0
map.set(1, 2);
assertIteratorDone(iter0, undefined);  // already closed
assertIteratorNext(iter1, [1, 2]);     // was not yet closed