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 --- ...buffer-during-fromIndex-returns-single-comma.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 js/src/tests/test262/built-ins/TypedArray/prototype/join/BigInt/detached-buffer-during-fromIndex-returns-single-comma.js (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/join/BigInt/detached-buffer-during-fromIndex-returns-single-comma.js') diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/join/BigInt/detached-buffer-during-fromIndex-returns-single-comma.js b/js/src/tests/test262/built-ins/TypedArray/prototype/join/BigInt/detached-buffer-during-fromIndex-returns-single-comma.js new file mode 100644 index 0000000000..d5d51beb51 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/join/BigInt/detached-buffer-during-fromIndex-returns-single-comma.js @@ -0,0 +1,44 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Returns single separator if buffer is detached after ValidateTypedArray +info: | + %TypedArray%.prototype.join ( separator ) + + The interpretation and use of the arguments of %TypedArray%.prototype.join are the same as for Array.prototype.join as defined in 22.1.3.15. + + When the join method is called with one argument separator, the following steps are taken: + + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If separator is undefined, let sep be the single-element String ",". + Else, let sep be ? ToString(separator). + Let R be the empty String. + Let k be 0. + Repeat, while k < len, + If k > 0, set R to the string-concatenation of R and sep. + Let element be ! Get(O, ! ToString(𝔽(k))). + If element is undefined or null, let next be the empty String; otherwise, let next be ! ToString(element). + Set R to the string-concatenation of R and next. + Set k to k + 1. + Return R. + +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + const sample = new TA([1n,2n,3n]); + const separator = { + toString() { + $DETACHBUFFER(sample.buffer); + return ','; + } + }; + + assert.sameValue(sample.join(separator), ',,'); +}); + +reportCompare(0, 0); -- cgit v1.2.3