From 27162904a72b559799d391fe4d90ae2805755788 Mon Sep 17 00:00:00 2001 From: Alexey Shvayka Date: Mon, 24 Feb 2020 10:07:22 +0200 Subject: [PATCH] Add Array#fill test --- .../fill/length-near-integer-limit.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/built-ins/Array/prototype/fill/length-near-integer-limit.js diff --git a/test/built-ins/Array/prototype/fill/length-near-integer-limit.js b/test/built-ins/Array/prototype/fill/length-near-integer-limit.js new file mode 100644 index 0000000000..7de15e10cf --- /dev/null +++ b/test/built-ins/Array/prototype/fill/length-near-integer-limit.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.fill +description: > + Elements are filled in an array-like object + whose "length" property is near the integer limit. +info: | + Array.prototype.fill ( value [ , start [ , end ] ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? LengthOfArrayLike(O). + [...] + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + [...] +---*/ + +var value = {}; +var startIndex = Number.MAX_SAFE_INTEGER - 3; +var arrayLike = { + length: Number.MAX_SAFE_INTEGER, +}; + +Array.prototype.fill.call(arrayLike, value, startIndex, startIndex + 3); + +assert.sameValue(arrayLike[startIndex], value); +assert.sameValue(arrayLike[startIndex + 1], value); +assert.sameValue(arrayLike[startIndex + 2], value);