summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Set-iterator-add-remove.js
blob: b0d3518dafece0e2514f3d5d1065c075e4f70237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Removing and re-adding entries while an iterator is live causes the iterator to visit them again.

var set = new Set(['a']);
var n = 5;
for (let v of set) {
    assertEq(v, 'a');
    if (n === 0)
        break;
    set.delete('a');
    set.add('a');
    n--;
}
assertEq(n, 0);