From 3637be5ffc84c510455c3cea39d1ec8031711461 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Wed, 22 Sep 2021 22:27:09 -0400 Subject: [PATCH] Correct assertion messages and improve coverage 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 --- .../byteLength/BigInt/resizable-array-buffer-auto.js | 7 +++++++ .../prototype/length/BigInt/resizable-array-buffer-auto.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-auto.js index 717e40b0bac..3bf215b2d05 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-auto.js @@ -42,5 +42,12 @@ testWithBigIntTypedArrayConstructors(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/length/BigInt/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-auto.js index a1f191a103c..94dbad11cc8 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-auto.js @@ -42,5 +42,12 @@ testWithBigIntTypedArrayConstructors(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)"); });