Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Reflect / ownKeys / return-on-corresponding-order-large-index.js
blob70ea65de92f60917afc38cd7bfcda52aaa5379c6
1 // Copyright (C) 2018 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-ordinaryownpropertykeys
5 description: >
6   Returns keys in their corresponding order.
7 info: |
8   26.1.11 Reflect.ownKeys ( target )
10   ...
11   2. Let keys be target.[[OwnPropertyKeys]]().
12   3. ReturnIfAbrupt(keys).
13   4. Return CreateArrayFromList(keys).
15   9.1.12 [[OwnPropertyKeys]] ( )
17   1. Let keys be a new empty List.
18   2. For each own property key P of O that is an array index, in ascending
19   numeric index order
20     a. Add P as the last element of keys.
21   3. For each own property key P of O that is a String but is not an array
22   index, in property creation order
23     a. Add P as the last element of keys.
24   4. For each own property key P of O that is a Symbol, in property creation
25   order
26     a. Add P as the last element of keys.
27   5. Return keys.
28 features: [computed-property-names, Reflect, Symbol]
29 ---*/
31 var o1 = {
32   12345678900: true,
33   b: true,
34   1: true,
35   a: true,
36   [Number.MAX_SAFE_INTEGER]: true,
37   [Symbol.for('z')]: true,
38   12345678901: true,
39   4294967294: true,
40   4294967295: true,
43 var result = Reflect.ownKeys(o1);
45 assert.sameValue(result.length, 9);
46 assert.sameValue(result[0], '1');
47 assert.sameValue(result[1], '4294967294');
48 assert.sameValue(result[2], '12345678900');
49 assert.sameValue(result[3], 'b');
50 assert.sameValue(result[4], 'a');
51 assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
52 assert.sameValue(result[6], '12345678901');
53 assert.sameValue(result[7], '4294967295');
54 assert.sameValue(result[8], Symbol.for('z'));
56 var o2 = {};
58 o2[12345678900] = true;
59 o2.b = true;
60 o2[1] = true;
61 o2.a = true;
62 o2[Number.MAX_SAFE_INTEGER] = true;
63 o2[Symbol.for('z')] = true;
64 o2[12345678901] = true;
65 o2[4294967294] = true;
66 o2[4294967295] = true;
69 result = Reflect.ownKeys(o2);
71 assert.sameValue(result.length, 9);
72 assert.sameValue(result[0], '1');
73 assert.sameValue(result[1], '4294967294');
74 assert.sameValue(result[2], '12345678900');
75 assert.sameValue(result[3], 'b');
76 assert.sameValue(result[4], 'a');
77 assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
78 assert.sameValue(result[6], '12345678901');
79 assert.sameValue(result[7], '4294967295');
80 assert.sameValue(result[8], Symbol.for('z'));
82 reportCompare(0, 0);