From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../Array/prototype/pop/clamps-to-integer-limit.js | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Array/prototype/pop/clamps-to-integer-limit.js (limited to 'js/src/tests/test262/built-ins/Array/prototype/pop/clamps-to-integer-limit.js') diff --git a/js/src/tests/test262/built-ins/Array/prototype/pop/clamps-to-integer-limit.js b/js/src/tests/test262/built-ins/Array/prototype/pop/clamps-to-integer-limit.js new file mode 100644 index 0000000000..4f0b10b147 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/prototype/pop/clamps-to-integer-limit.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.pop +description: > + Length values exceeding 2^53-1 are clamped to 2^53-1. +info: | + 1. ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... + 4. Else len > 0, + a. Let newLen be len-1. + ... + e. Perform ? Set(O, "length", newLen, true). + ... +features: [exponentiation] +---*/ + +var arrayLike = {}; + +arrayLike.length = 2 ** 53 - 1; +Array.prototype.pop.call(arrayLike); +assert.sameValue(arrayLike.length, 2 ** 53 - 2, "Length is 2**53 - 1"); + +arrayLike.length = 2 ** 53; +Array.prototype.pop.call(arrayLike); +assert.sameValue(arrayLike.length, 2 ** 53 - 2, "Length is 2**53"); + +arrayLike.length = 2 ** 53 + 2; +Array.prototype.pop.call(arrayLike); +assert.sameValue(arrayLike.length, 2 ** 53 - 2, "Length is 2**53 + 2"); + +arrayLike.length = Infinity; +Array.prototype.pop.call(arrayLike); +assert.sameValue(arrayLike.length, 2 ** 53 - 2, "Length is Infinity"); + +reportCompare(0, 0); -- cgit v1.2.3