From a94b3bf431eb41cf6c07d03456e81dae4e48f31d Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 31 May 2018 17:03:47 -0400 Subject: [PATCH] Reflect.ownKeys: order with large integer "index" keys --- ...turn-on-corresponding-order-large-index.js | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 test/built-ins/Reflect/ownKeys/return-on-corresponding-order-large-index.js diff --git a/test/built-ins/Reflect/ownKeys/return-on-corresponding-order-large-index.js b/test/built-ins/Reflect/ownKeys/return-on-corresponding-order-large-index.js new file mode 100644 index 0000000000..802646d13b --- /dev/null +++ b/test/built-ins/Reflect/ownKeys/return-on-corresponding-order-large-index.js @@ -0,0 +1,72 @@ +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-ordinaryownpropertykeys +description: > + Returns keys in their corresponding order. +info: | + 26.1.11 Reflect.ownKeys ( target ) + + ... + 2. Let keys be target.[[OwnPropertyKeys]](). + 3. ReturnIfAbrupt(keys). + 4. Return CreateArrayFromList(keys). + + 9.1.12 [[OwnPropertyKeys]] ( ) + + 1. Let keys be a new empty List. + 2. For each own property key P of O that is an integer index, in ascending + numeric index order + a. Add P as the last element of keys. + 3. For each own property key P of O that is a String but is not an integer + index, in property creation order + a. Add P as the last element of keys. + 4. For each own property key P of O that is a Symbol, in property creation + order + a. Add P as the last element of keys. + 5. Return keys. +features: [Reflect,Symbol] +---*/ + +var o1 = { + 12345678900: true, + b: true, + 1: true, + a: true, + [Number.MAX_SAFE_INTEGER]: true, + [Symbol.for('z')]: true, + 12345678901: true, +}; + +var result = Reflect.ownKeys(o1); + +assert.sameValue(result.length, 7); +assert.sameValue(result[0], '1'); +assert.sameValue(result[1], '12345678900'); +assert.sameValue(result[2], '12345678901'); +assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER)); +assert.sameValue(result[4], 'b'); +assert.sameValue(result[5], 'a'); +assert.sameValue(result[6], Symbol.for('z')); + +var o2 = {}; + +o2[12345678900] = true; +o2.b = true; +o2[1] = true; +o2.a = true; +o2[Number.MAX_SAFE_INTEGER] = true; +o2[Symbol.for('z')] = true; +o2[12345678901] = true; + + +result = Reflect.ownKeys(o2); + +assert.sameValue(result.length, 7); +assert.sameValue(result[0], '1'); +assert.sameValue(result[1], '12345678900'); +assert.sameValue(result[2], '12345678901'); +assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER)); +assert.sameValue(result[4], 'b'); +assert.sameValue(result[5], 'a'); +assert.sameValue(result[6], Symbol.for('z'));