Skip to content

Commit

Permalink
Correct assertion messages and improve coverage
Browse files Browse the repository at this point in the history
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] tc39/proposal-resizablearraybuffer#70
  • Loading branch information
jugglinmike authored and rwaldron committed Sep 23, 2021
1 parent 1b72bcd commit e6b6451
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
});
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
});

0 comments on commit e6b6451

Please sign in to comment.