Debian Codegraph @

js/src/tests/test262/language/statements/for-of/map-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 Map instance during traversal should not be visited.
7 es6id: 13.6.4
8 features: [Map]
9 ---*/
10
11 var map = new Map();
12 var iterationCount = 0;
13
14 map.set(0, 'a');
15 map.set(1, 'b');
16
17 for (var x of map) {
18 assert.sameValue(x[0], 0);
19 assert.sameValue(x[1], 'a');
20 map.delete(1);
21 iterationCount += 1;
22 }
23
24 assert.sameValue(iterationCount, 1);
25
26 reportCompare(0, 0);