From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../filter/BigInt/callbackfn-called-before-ctor.js | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 js/src/tests/test262/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js') diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js new file mode 100644 index 0000000000..af35a1f777 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: callbackfn is called for each item before TypedArraySpeciesCreate +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var length = 42; + var sample = new TA(length); + var calls = 0; + var before = false; + + sample.constructor = {}; + Object.defineProperty(sample, "constructor", { + get: function() { + before = calls === length; + } + }); + + sample.filter(function() { + calls++; + }); + + assert.sameValue(calls, 42, "callbackfn called for each item"); + assert.sameValue(before, true, "all callbackfn called before"); +}); + +reportCompare(0, 0); -- cgit v1.2.3