Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Map/newtarget.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 The new Map object's prototype is Map.prototype
7 info: |
8 Map ( [ iterable ] )
9
10 When the Map function is called with optional argument the following steps
11 are taken:
12
13 ...
14 2. Let map be OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%",
15 «‍[[MapData]]» ).
16 ...
17
18 ---*/
19
20 var m1 = new Map();
21
22 assert.sameValue(
23 Object.getPrototypeOf(m1),
24 Map.prototype,
25 "`Object.getPrototypeOf(m1)` returns `Map.prototype`"
26 );
27
28 var m2 = new Map([
29 [1, 1],
30 [2, 2]
31 ]);
32
33 assert.sameValue(
34 Object.getPrototypeOf(m2),
35 Map.prototype,
36 "`Object.getPrototypeOf(m2)` returns `Map.prototype`"
37 );