Debian Codegraph @

js/src/tests/test262/built-ins/Object/entries/order-after-define-property-with-function.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-object.entries
6 description: >
7 Property names are returned in ascending chronological order of creation
8 that is unaffected by [[DefineOwnProperty]].
9 info: |
10 Object.entries ( O )
11
12 [...]
13 2. Let nameList be ? EnumerableOwnPropertyNames(obj, key+value).
14 3. Return CreateArrayFromList(nameList).
15
16 EnumerableOwnPropertyNames ( O, kind )
17
18 [...]
19 2. Let ownKeys be ? O.[[OwnPropertyKeys]]().
20 [...]
21
22 OrdinaryOwnPropertyKeys ( O )
23
24 [...]
25 3. For each own property key P of O that is a String but is not an array index,
26 in ascending chronological order of property creation, do
27 a. Add P as the last element of keys.
28 [...]
29 5. Return keys.
30 features: [arrow-function]
31 includes: [compareArray.js]
32 ---*/
33
34 var fn = () => {};
35 fn.a = 1;
36 Object.defineProperty(fn, "name", {enumerable: true});
37 var fnKeys = Object.entries(fn).map(e => e[0]);
38 assert.compareArray(fnKeys, ["name", "a"]);
39
40 reportCompare(0, 0);