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

load(libdir + "iteration.js");

var set = new Set();
var iter0 = set[Symbol.iterator](), iter1 = set[Symbol.iterator]();
assertIteratorDone(iter0, undefined);  // closes iter0
set.add("x");
assertIteratorDone(iter0, undefined);  // already closed
assertIteratorNext(iter1, "x");  // was not yet closed