Debian Codegraph @

js/src/tests/test262/language/statements/for-of/set-contract.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Entries removed from a Set instance during traversal should not be visited.
7 es6id: 13.6.4
8 features: [Set]
9 ---*/
10
11 var set = new Set();
12 var iterationCount = 0;
13
14 set.add(0);
15 set.add(1);
16
17 for (var x of set) {
18 assert.sameValue(x, 0);
19 set.delete(1);
20 iterationCount += 1;
21 }
22
23 assert.sameValue(iterationCount, 1);
24
25 reportCompare(0, 0);