summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/fromEntries/to-property-key.js
blob: 539e0528489f56d1d06619b032891dad240d953b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2018 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Coerces keys to strings using ToPropertyKey.
esid: sec-object.fromentries
features: [Symbol.toPrimitive, Object.fromEntries]
---*/

var key = {
  [Symbol.toPrimitive]: function(hint) {
    assert.sameValue(hint, 'string');
    return 'key';
  },
};
var result = Object.fromEntries([[key, 'value']]);
assert.sameValue(result.key, 'value');

reportCompare(0, 0);