diff --git a/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-auto.js index d50b9cbe95..21ea9650d7 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-auto.js @@ -42,5 +42,12 @@ testWithTypedArrayConstructors(function(TA) { expected = 0; } catch (_) {} + assert.sameValue(array.byteLength, expected, "following shrink (on boundary)"); + + try { + ab.resize(0); + expected = 0; + } catch (_) {} + assert.sameValue(array.byteLength, expected, "following shrink (out of bounds)"); }); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-auto.js index 261328fb95..364e17ad4c 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-auto.js @@ -34,13 +34,18 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(array.byteOffset, BPE, "following shrink (within bounds)"); - var expected; + var expected = BPE; try { ab.resize(BPE); expected = 0; - } catch (_) { - expected = BPE; - } + } catch (_) {} + + assert.sameValue(array.byteOffset, expected, "following shrink (on boundary)"); + + try { + ab.resize(0); + expected = 0; + } catch (_) {} assert.sameValue(array.byteOffset, expected, "following shrink (out of bounds)"); }); diff --git a/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-auto.js index 77e1263a5c..a894a5898f 100644 --- a/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-auto.js @@ -42,5 +42,12 @@ testWithTypedArrayConstructors(function(TA) { expected = 0; } catch (_) {} + assert.sameValue(array.length, expected, "following shrink (on boundary)"); + + try { + ab.resize(0); + expected = 0; + } catch (_) {} + assert.sameValue(array.length, expected, "following shrink (out of bounds)"); }); diff --git a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js index d6bcdac56a..0aba12fc80 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js +++ b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js @@ -57,13 +57,22 @@ testWithTypedArrayConstructors(function(TA) { assert(compareArray(new TargetCtor(source), expected), 'following shrink (within bounds)'); + onGetSpecies = function() { + try { + ab.resize(BPE); + expected = []; + } catch (_) {} + }; + + assert(compareArray(new TargetCtor(source), expected), 'following shrink (on boundary)'); + // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. var expectedError; var actualError; onGetSpecies = function() { try { - ab.resize(BPE); + ab.resize(0); expectedError = TypeError; } catch (_) { expectedError = Test262Error; diff --git a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js index 4e2b9f3ceb..c633ba0696 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js +++ b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js @@ -57,13 +57,22 @@ testWithTypedArrayConstructors(function(TA) { assert(compareArray(new TA(source), expected), 'following shrink (within bounds)'); + onGetSpecies = function() { + try { + ab.resize(BPE); + expected = []; + } catch (_) {} + }; + + assert(compareArray(new TA(source), expected), 'following shrink (on boundary)'); + // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. var expectedError; var actualError; onGetSpecies = function() { try { - ab.resize(BPE); + ab.resize(0); expectedError = TypeError; } catch (_) { expectedError = Test262Error; diff --git a/test/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js b/test/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js index 4d0200d273..0fbc6d5910 100644 --- a/test/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js @@ -50,5 +50,12 @@ testWithTypedArrayConstructors(function(TA) { expected = "false,false,false,false,false"; } catch (_) {} + assert.sameValue(inspect(array), expected, "following shrink (on boundary)"); + + try { + ab.resize(0); + expected = "false,false,false,false,false"; + } catch (_) {} + assert.sameValue(inspect(array), expected, "following shrink (out of bounds)"); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-auto.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-auto.js index fb4ff1222c..abb0836ea1 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-auto.js @@ -52,6 +52,15 @@ testWithTypedArrayConstructors(function(TA) { expected = ""; } catch (_) {} + assert.sameValue( + Reflect.ownKeys(array).join(","), expected, "following shrink (on boundary)" + ); + + try { + ab.resize(0); + expected = ""; + } catch (_) {} + assert.sameValue( Reflect.ownKeys(array).join(","), expected, "following shrink (out of bounds)" );