From de6583d61d2f95a5186c24c15ef5166e0dff3d00 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Thu, 23 Sep 2021 19:59:44 -0400 Subject: [PATCH] Use BigInt values idiomatically 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. --- .../BigInt/return-abrupt-from-this-out-of-bounds.js | 6 +++--- .../indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js | 6 +++--- .../join/BigInt/return-abrupt-from-this-out-of-bounds.js | 6 +++--- .../BigInt/return-abrupt-from-this-out-of-bounds.js | 6 +++--- .../map/BigInt/return-abrupt-from-this-out-of-bounds.js | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-from-this-out-of-bounds.js index a76b0a8958..c25e4dfaab 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -29,14 +29,14 @@ testWithBigIntTypedArrayConstructors(TA => { } catch (_) {} // no error following grow: - array.includes(0); + array.includes(0n); try { ab.resize(BPE * 3); } catch (_) {} // no error following shrink (within bounds): - array.includes(0); + array.includes(0n); var expectedError; try { @@ -53,7 +53,7 @@ testWithBigIntTypedArrayConstructors(TA => { } assert.throws(expectedError, () => { - array.includes(0); + array.includes(0n); throw new Test262Error('includes completed successfully'); }); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js index 078955e783..c7494e4765 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -29,14 +29,14 @@ testWithBigIntTypedArrayConstructors(TA => { } catch (_) {} // no error following grow: - array.indexOf(0); + array.indexOf(0n); try { ab.resize(BPE * 3); } catch (_) {} // no error following shrink (within bounds): - array.indexOf(0); + array.indexOf(0n); var expectedError; try { @@ -53,7 +53,7 @@ testWithBigIntTypedArrayConstructors(TA => { } assert.throws(expectedError, () => { - array.indexOf(0); + array.indexOf(0n); throw new Test262Error('indexOf completed successfully'); }); }); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-this-out-of-bounds.js index 15ed9ed763..0bce064301 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -29,14 +29,14 @@ testWithBigIntTypedArrayConstructors(TA => { } catch (_) {} // no error following grow: - array.join(0); + array.join(','); try { ab.resize(BPE * 3); } catch (_) {} // no error following shrink (within bounds): - array.join(0); + array.join(','); var expectedError; try { @@ -53,7 +53,7 @@ testWithBigIntTypedArrayConstructors(TA => { } assert.throws(expectedError, () => { - array.join(0); + array.join(','); throw new Test262Error('join completed successfully'); }); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-from-this-out-of-bounds.js index 839780b06f..2382f444a3 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -29,14 +29,14 @@ testWithBigIntTypedArrayConstructors(TA => { } catch (_) {} // no error following grow: - array.lastIndexOf(0); + array.lastIndexOf(0n); try { ab.resize(BPE * 3); } catch (_) {} // no error following shrink (within bounds): - array.lastIndexOf(0); + array.lastIndexOf(0n); var expectedError; try { @@ -53,7 +53,7 @@ testWithBigIntTypedArrayConstructors(TA => { } assert.throws(expectedError, () => { - array.lastIndexOf(0); + array.lastIndexOf(0n); throw new Test262Error('lastIndexOf completed successfully'); }); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-abrupt-from-this-out-of-bounds.js index 94e0090933..73c880fbfe 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -29,14 +29,14 @@ testWithBigIntTypedArrayConstructors(TA => { } catch (_) {} // no error following grow: - array.map(() => {}); + array.map(() => 0n); try { ab.resize(BPE * 3); } catch (_) {} // no error following shrink (within bounds): - array.map(() => {}); + array.map(() => 0n); var expectedError; try { @@ -53,7 +53,7 @@ testWithBigIntTypedArrayConstructors(TA => { } assert.throws(expectedError, () => { - array.map(() => {}); + array.map(() => 0n); throw new Test262Error('map completed successfully'); }); });