Debian Codegraph @

js/src/tests/test262/built-ins/Object/fromEntries/to-property-key.js

raw
1 // Copyright (C) 2018 Kevin Gibbons. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Coerces keys to strings using ToPropertyKey.
6 esid: sec-object.fromentries
7 features: [Symbol.toPrimitive, Object.fromEntries]
8 ---*/
9
10 var key = {
11 [Symbol.toPrimitive]: function(hint) {
12 assert.sameValue(hint, 'string');
13 return 'key';
14 },
15 };
16 var result = Object.fromEntries([[key, 'value']]);
17 assert.sameValue(result.key, 'value');
18
19 reportCompare(0, 0);