This adds copies of the tests added in the previous commit, to the
respective BigInt folders, editing them to use the testBigIntTypedArray
helper instead of the testTypedArray helper.
See: #3723
%TypedArray%.prototype.map's iteration count does not change even though the source view is resized during the iteration.
And since result is just returning index, then result array should be [0, 1, 2].
Note that this test currently unintentionally passes, because a
TypeError is thrown for failing to convert the undefined returned from
the getter to a BigInt. But since this test was intended to test
detaching, it's no longer valid and should still be removed.
See https://github.com/tc39/test262/pull/3465#issuecomment-1098388916
The Resizable ArrayBuffer proposal allows implementations to reject any
resize operation, so the tests must accommodate that possibility.
Mitigate the complexity this entails by minimizing branches and by
deferring assertions to locations with shallow call stacks.
This reverts commit b690cb67be, reversing
changes made to 50dd431dff. This is
necessary because the reverted changeset reduced coverage by an unknown
extent.
Prior to this commit, a test for %TypedArray%.prototype.copyWithin
provided a TypedArray instance as the first argument. That argument that
is interpreted as a number, so in relying on the conversion, the test
verified behavior beyond what it purported to test.
Simplify the test by using the desired number value directly.
Prior to this commit, a number of tests used non-BigInt values where
BigInt value are commonly used. Although this was technically
permissible to validate the behavior under test, the atypical usage
patterns tended to obscure the tests' purpose. Replace with more
appropriate values.
Prior to this commit, a test for %TypedArray%.prototype.copyWithin
provided a TypedArray instance as the first argument. That argument that
is interpreted as a number, so in relying on the conversion, the test
verified behavior beyond what it purported to test.
Simplify the test by using the desired number value directly, and extend
the tests for type coercion to cover object values.
Following a recent normative change to the Resizable ArrayBuffer
proposal [1], the term "out of bounds" no longer applies to
"length-tracking" TypedArrays whose underlying ArrayBuffer has been
resized to match their byte offset.
Reflect this in the tests by renaming the condition from "out of bounds"
to "on boundary" and by adding new assertions for true "out of bounds"
conditions.
[1] https://github.com/tc39/proposal-resizablearraybuffer/pull/70
Ensure that when the ArrayBuffer of a length-tracking TypedArray is
resized to the address matching the TypedArray's byte offset, the
TypedArray is *not* considered "out of bounds."
A recent normative change to the Resizable ArrayBuffer modified the
criteria for a TypedArray becoming "out of bounds." Following the
change, TypedArrays which track the length of their underlying
ArrayBuffer instance are no longer considered "out of bounds" when the
ArrayBuffer is resized such that its size matches the TypedArray's
offset exactly.
https://github.com/tc39/proposal-resizablearraybuffer/pull/70
The majority of this patch's changes extend coverage to include cases
for both "on boundary" and "out of bounds" without reflecting any new
semantics. Two changes describe observable differences in the new
version of the algorithm:
- out-of-bounds-when-species-retrieved-different-type.js
- out-of-bounds-when-species-retrieved-same-type.js
The tests for the "Array findFromLast" proposal were originally authored
based on related tests that had already been merged to the repository's
`main` branch [1]. While those new tests were under review, a number of
tests for the Resizable ArrayBuffer proposal were found to be incorrect
[2]. The problem was fixed for the tests in `main`, but because the
corresponding tests for "Array findFromLast" were not yet merged, the
error persisted there [3].
Apply the same correction to the new tests.
[1] https://github.com/tc39/test262/issues/3111
[2] https://github.com/tc39/test262/pull/3113
[3] https://github.com/tc39/test262/pull/3045
* ResizableArrayBuffer: TypedArray.prototype.set
* Resizable ArrayBuffer: TypedArray methods
The files in this patch are highly similar. Only the test for
`TypedArray.prototype.copyWithin` was written manually. The others were
generated from that test via the following script:
#!/bin/bash
set -eu
names_cb='
every
filter
find
findIndex
forEach
map
reduce
reduceRight
some
'
names_num='
at
fill
includes
indexOf
join
lastIndexOf
slice
'
names_none='
entries
values
keys
reverse
sort
toLocaleString
values
'
for name in $(printf "${names_cb} ${names_num} ${names_none}"); do
lower=$(echo ${name} | tr '[:upper:]' '[:lower:]')
if echo "$names_cb" | grep -xq $name; then
value='() => {}'
elif echo "$names_num" | grep -xq $name; then
value='0'
else
value=''
fi
if [[ "${name}" == 'at' ]]; then
features_addition='TypedArray.prototype.at, '
else
features_addition=''
fi
sed \
-e "s/copywithin/${lower}/g" \
-e "s/copyWithin/${name}/g" \
-e "s/${name}(.*);/${name}(${value});/g" \
-e "s/resizable-arraybuffer/${features_addition}resizable-arraybuffer/g" \
./test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js \
> ./test/built-ins/TypedArray/prototype/${name}/return-abrupt-from-this-out-of-bounds.js
done
1. test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js
It is not updated when a60a67ea88 is landed. This patch fixes it.
2. test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js
After detaching, BigInt64Array/BigUint64Array will produce undefined for indexed access. And
if `filter`'s callback says `true` for these results, we need to store `ToBigInt(undefined)`
to a newly resulted BigInt64Array/BigUint64Array and this will throw an error. But this test
assumed it does not throw. This patch fixed flag so that we do not throw that error while keeping
detached typed arrays tested.