michael@0: // Removing and re-adding entries while an iterator is live causes the iterator to visit them again. michael@0: michael@0: var set = Set(['a']); michael@0: var n = 5; michael@0: for (let v of set) { michael@0: assertEq(v, 'a'); michael@0: if (n === 0) michael@0: break; michael@0: set.delete('a'); michael@0: set.add('a'); michael@0: n--; michael@0: } michael@0: assertEq(n, 0);