Debian Codegraph @

js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-bigint.js

raw
1 // Copyright (C) 2019 Leo Balter. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-object.create
6 description: >
7 The Properties argument is cast to an object if it's a BigInt value
8 info: |
9 Object.create ( O, Properties )
10
11 3. If Properties is not undefined, then
12 a. Return ? ObjectDefineProperties(obj, Properties).
13
14 Runtime Semantics: ObjectDefineProperties ( O, Properties )
15
16 2. Let props be ? ToObject(Properties).
17 3. Let keys be ? props.[[OwnPropertyKeys]]().
18 ...
19 // All enumerable keys are added to the created object.
20 features: [BigInt]
21 ---*/
22
23 var proto = {};
24
25 var obj;
26 obj = Object.create(proto, 1n);
27 assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is 1n: prototype is set');
28 assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is 1n: no keys set');
29 assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is 1n: no symbol keys set');
30
31 obj = undefined;
32 obj = Object.create(proto, 0n);
33 assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is 0n: prototype is set');
34 assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is 0n: no keys set');
35 assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is 0n: no symbol keys set');
36
37 reportCompare(0, 0);