Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Map/map-iterable-empty-does-not-call-set.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 es6id: 23.1.1.1
5 description: >
6 A Map constructed with an empty iterable argument does not call set.
7 info: |
8 Map ( [ iterable ] )
9
10 When the Map function is called with optional argument the following steps are
11 taken:
12
13 ...
14 8. If iter is undefined, return map.
15 9. Repeat
16 a. Let next be IteratorStep(iter).
17 b. ReturnIfAbrupt(next).
18 c. If next is false, return map.
19 ---*/
20
21 var set = Map.prototype.set;
22 var counter = 0;
23
24 Map.prototype.set = function(value) {
25 counter++;
26 set.call(this, value);
27 };
28
29 new Map([]);
30
31 assert.sameValue(counter, 0, '`Map.prototype.set` was not called.');