blob: b5198ed64abd69362f6813f6ef2f74d6aa726fdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// A Set iterator does not visit entries removed by clear().
load(libdir + "iteration.js");
var s = new Set();
var it = s[Symbol.iterator]();
s.clear();
assertIteratorDone(it, undefined);
s = new Set(["a", "b", "c", "d"]);
it = s[Symbol.iterator]();
assertIteratorNext(it, "a");
s.clear();
assertIteratorDone(it, undefined);
var log = "";
s = new Set(["a", "b", "c", "d"]);
for (var v of s) {
log += v;
if (v == "b")
s.clear();
}
assertEq(log, "ab");
|