diff --git a/harness/compareArray.js b/harness/compareArray.js index 61aa696c52..2af35eeae3 100644 --- a/harness/compareArray.js +++ b/harness/compareArray.js @@ -45,6 +45,6 @@ assert.compareArray = function(actual, expected, message) { // The following prevents actual and expected from being iterated and evaluated // more than once unless absolutely necessary. if (!result) { - assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the the same contents. ${message}`); + assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the same contents. ${message}`); } }; diff --git a/test/built-ins/DisposableStack/prototype/Symbol.dispose.js b/test/built-ins/DisposableStack/prototype/Symbol.dispose.js index befbc6bbd5..4fa6ab42c8 100644 --- a/test/built-ins/DisposableStack/prototype/Symbol.dispose.js +++ b/test/built-ins/DisposableStack/prototype/Symbol.dispose.js @@ -15,7 +15,7 @@ features: [explicit-resource-management] assert.sameValue(DisposableStack.prototype[Symbol.dispose], DisposableStack.prototype.dispose); verifyProperty(DisposableStack.prototype, Symbol.dispose, { - enumerable: false; - writable: true; - configurable: true; + enumerable: false, + writable: true, + configurable: true }); diff --git a/test/built-ins/DisposableStack/prototype/disposed/getter.js b/test/built-ins/DisposableStack/prototype/disposed/getter.js index 1878bd1234..e0f2ace2e2 100644 --- a/test/built-ins/DisposableStack/prototype/disposed/getter.js +++ b/test/built-ins/DisposableStack/prototype/disposed/getter.js @@ -27,6 +27,6 @@ assert.sameValue( ); verifyProperty(DisposableStack.prototype, 'disposed', { - enumerable: false; - configurable: true; + enumerable: false, + configurable: true }); diff --git a/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js b/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js new file mode 100644 index 0000000000..e59d60dc1e --- /dev/null +++ b/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js @@ -0,0 +1,20 @@ +// Copyright (C) 2024 Tan Meng. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regexp.prototype-@@search +description: RegExp.prototype[@@search] behavior with 'v' flag +features: [Symbol.search, regexp-v-flag] +---*/ + +const text = '𠮷a𠮷b𠮷'; + +function doSearch(regex) { + return RegExp.prototype[Symbol.search].call(regex, text); +} + +assert.sameValue(doSearch(/a/), 2, "Basic search without v flag"); +assert.sameValue(doSearch(/a/v), 2, "Search with v flag"); +assert.sameValue(doSearch(/𠮷/), 0, "Search for surrogate pair without v flag"); +assert.sameValue(doSearch(/𠮷/v), 0, "Search for surrogate pair with v flag"); +assert.sameValue(doSearch(/\p{Script=Han}/v), 0, "Unicode property escapes with v flag"); +assert.sameValue(doSearch(/b./v), 5, "Dot with v flag"); diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-string-limits.js b/test/built-ins/Temporal/Duration/compare/relativeto-string-limits.js new file mode 100644 index 0000000000..7af8066ec5 --- /dev/null +++ b/test/built-ins/Temporal/Duration/compare/relativeto-string-limits.js @@ -0,0 +1,48 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Duration(); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const relativeTo of validStrings) { + Temporal.Duration.compare(instance, instance, { relativeTo }); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const relativeTo of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.Duration.compare(instance, instance, { relativeTo }), + `"${relativeTo}" is outside the representable range for a relativeTo parameter` + ); +} diff --git a/test/built-ins/Temporal/Duration/prototype/round/next-day-out-of-range.js b/test/built-ins/Temporal/Duration/prototype/round/next-day-out-of-range.js new file mode 100644 index 0000000000..0a41bc6084 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/round/next-day-out-of-range.js @@ -0,0 +1,18 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.hoursinday +description: > + Finding the boundary with the next day may throw if the instance is at the + upper edge of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Duration(); +const relativeTo = new Temporal.ZonedDateTime(86400_0000_0000_000_000_000n, "UTC"); +assert.throws( + RangeError, + () => instance.round({ largestUnit: "days", smallestUnit: "minutes", relativeTo }), + "Next day boundary is out of range" +); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-limits.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-limits.js new file mode 100644 index 0000000000..b9e94e9fad --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-limits.js @@ -0,0 +1,48 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Duration(); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const relativeTo of validStrings) { + instance.round({ smallestUnit: "minutes", relativeTo }); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const relativeTo of invalidStrings) { + assert.throws( + RangeError, + () => instance.round({ smallestUnit: "minutes", relativeTo }), + `"${relativeTo}" is outside the representable range for a relativeTo parameter` + ); +} diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-limits.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-limits.js new file mode 100644 index 0000000000..99e72e764c --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-limits.js @@ -0,0 +1,48 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.total +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Duration(); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const relativeTo of validStrings) { + instance.total({ unit: "minutes", relativeTo }); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const relativeTo of invalidStrings) { + assert.throws( + RangeError, + () => instance.total({ unit: "minutes", relativeTo }), + `"${relativeTo}" is outside the representable range for a relativeTo parameter` + ); +} diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-invalid.js b/test/built-ins/Temporal/Instant/compare/argument-string-invalid.js index 1687124307..403087ff63 100644 --- a/test/built-ins/Temporal/Instant/compare/argument-string-invalid.js +++ b/test/built-ins/Temporal/Instant/compare/argument-string-invalid.js @@ -35,6 +35,8 @@ const invalidStrings = [ "2020-01-01T001Z", "2020-01-01T01:001Z", "2020-01-01T01:01:001Z", + "2020-01-01T00:00-24:00", + "2020-01-01T00:00+24:00", // valid, but forms not supported in Temporal: "2020-W01-1T00:00Z", "2020-001T00:00Z", diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-limits.js b/test/built-ins/Temporal/Instant/compare/argument-string-limits.js new file mode 100644 index 0000000000..f8e09cb7e4 --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-limits.js @@ -0,0 +1,46 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Instant(0n); + +const validStrings = [ + "-271821-04-20T00:00Z", + "-271821-04-19T23:00-01:00", + "-271821-04-19T00:00:00.000000001-23:59:59.999999999", + "+275760-09-13T00:00Z", + "+275760-09-13T01:00+01:00", + "+275760-09-13T23:59:59.999999999+23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.Instant.compare(arg, instance); + Temporal.Instant.compare(instance, arg); +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z", + "-271821-04-19T23:00-00:59:59.999999999", + "-271821-04-19T00:00:00-23:59:59.999999999", + "+275760-09-13T00:00:00.000000001Z", + "+275760-09-13T01:00+00:59:59.999999999", + "+275760-09-14T00:00+23:59:59.999999999", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.Instant.compare(arg, instance), + `"${arg}" is outside the representable range of Instant (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.Instant.compare(instance, arg), + `"${arg}" is outside the representable range of Instant (second argument)` + ); +} diff --git a/test/built-ins/Temporal/Instant/compare/instant-string-limits.js b/test/built-ins/Temporal/Instant/compare/instant-string-limits.js deleted file mode 100644 index a664a3fcbf..0000000000 --- a/test/built-ins/Temporal/Instant/compare/instant-string-limits.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.instant.compare -description: String arguments at the limit of the representable range -features: [Temporal] ----*/ - -const minInstant = new Temporal.Instant(-86400_00000000_000_000_000n); -const maxInstant = new Temporal.Instant(86400_00000000_000_000_000n); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - assert.sameValue(Temporal.Instant.compare(str, minInstant), 0, `instant string ${str} should be valid (first argument)`); - assert.sameValue(Temporal.Instant.compare(minInstant, str), 0, `instant string ${str} should be valid (second argument)`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - assert.sameValue(Temporal.Instant.compare(str, maxInstant), 0, `instant string ${str} should be valid (first argument)`); - assert.sameValue(Temporal.Instant.compare(maxInstant, str), 0, `instant string ${str} should be valid (second argument)`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => Temporal.Instant.compare(str, minInstant), `instant string ${str} should not be valid (first argument)`); - assert.throws(RangeError, () => Temporal.Instant.compare(minInstant, str), `instant string ${str} should not be valid (second argument)`); -} diff --git a/test/built-ins/Temporal/Instant/from/argument-string-invalid.js b/test/built-ins/Temporal/Instant/from/argument-string-invalid.js index 8797b8ed01..967db6ae7c 100644 --- a/test/built-ins/Temporal/Instant/from/argument-string-invalid.js +++ b/test/built-ins/Temporal/Instant/from/argument-string-invalid.js @@ -35,6 +35,8 @@ const invalidStrings = [ "2020-01-01T001Z", "2020-01-01T01:001Z", "2020-01-01T01:01:001Z", + "2020-01-01T00:00-24:00", + "2020-01-01T00:00+24:00", // valid, but forms not supported in Temporal: "2020-W01-1T00:00Z", "2020-001T00:00Z", diff --git a/test/built-ins/Temporal/Instant/from/argument-string-limits.js b/test/built-ins/Temporal/Instant/from/argument-string-limits.js new file mode 100644 index 0000000000..95b967d754 --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-limits.js @@ -0,0 +1,38 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.from +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const validStrings = [ + "-271821-04-20T00:00Z", + "-271821-04-19T23:00-01:00", + "-271821-04-19T00:00:00.000000001-23:59:59.999999999", + "+275760-09-13T00:00Z", + "+275760-09-13T01:00+01:00", + "+275760-09-13T23:59:59.999999999+23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.Instant.from(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z", + "-271821-04-19T23:00-00:59:59.999999999", + "-271821-04-19T00:00:00-23:59:59.999999999", + "+275760-09-13T00:00:00.000000001Z", + "+275760-09-13T01:00+00:59:59.999999999", + "+275760-09-14T00:00+23:59:59.999999999", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.Instant.from(arg), + `"${arg}" is outside the representable range of Instant` + ); +} diff --git a/test/built-ins/Temporal/Instant/from/instant-string-limits.js b/test/built-ins/Temporal/Instant/from/instant-string-limits.js deleted file mode 100644 index 414c505aa4..0000000000 --- a/test/built-ins/Temporal/Instant/from/instant-string-limits.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.instant.from -description: String arguments at the limit of the representable range -features: [Temporal] ----*/ - -const minInstant = new Temporal.Instant(-86400_00000000_000_000_000n); -const maxInstant = new Temporal.Instant(86400_00000000_000_000_000n); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - assert.sameValue(Temporal.Instant.from(str).epochNanoseconds, minInstant.epochNanoseconds, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - assert.sameValue(Temporal.Instant.from(str).epochNanoseconds, maxInstant.epochNanoseconds, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => Temporal.Instant.from(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-invalid.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-invalid.js index 581de1c51b..2c1c372037 100644 --- a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-invalid.js +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-invalid.js @@ -35,6 +35,8 @@ const invalidStrings = [ "2020-01-01T001Z", "2020-01-01T01:001Z", "2020-01-01T01:01:001Z", + "2020-01-01T00:00-24:00", + "2020-01-01T00:00+24:00", // valid, but forms not supported in Temporal: "2020-W01-1T00:00Z", "2020-001T00:00Z", diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-limits.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-limits.js new file mode 100644 index 0000000000..a9b50709a3 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-limits.js @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.equals +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Instant(0n); + +const validStrings = [ + "-271821-04-20T00:00Z", + "-271821-04-19T23:00-01:00", + "-271821-04-19T00:00:00.000000001-23:59:59.999999999", + "+275760-09-13T00:00Z", + "+275760-09-13T01:00+01:00", + "+275760-09-13T23:59:59.999999999+23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.equals(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z", + "-271821-04-19T23:00-00:59:59.999999999", + "-271821-04-19T00:00:00-23:59:59.999999999", + "+275760-09-13T00:00:00.000000001Z", + "+275760-09-13T01:00+00:59:59.999999999", + "+275760-09-14T00:00+23:59:59.999999999", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.equals(arg), + `"${arg}" is outside the representable range of Instant` + ); +} diff --git a/test/built-ins/Temporal/Instant/prototype/equals/instant-string-limits.js b/test/built-ins/Temporal/Instant/prototype/equals/instant-string-limits.js deleted file mode 100644 index d64d14f1d3..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/equals/instant-string-limits.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.instant.prototype.equals -description: String arguments at the limit of the representable range -features: [Temporal] ----*/ - -const minInstant = new Temporal.Instant(-86400_00000000_000_000_000n); -const maxInstant = new Temporal.Instant(86400_00000000_000_000_000n); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - assert.sameValue(minInstant.equals(str), true, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - assert.sameValue(maxInstant.equals(str), true, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => minInstant.equals(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-invalid.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-invalid.js index 9ce112b73f..2f5aae257d 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/argument-string-invalid.js +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-invalid.js @@ -35,6 +35,8 @@ const invalidStrings = [ "2020-01-01T001Z", "2020-01-01T01:001Z", "2020-01-01T01:01:001Z", + "2020-01-01T00:00-24:00", + "2020-01-01T00:00+24:00", // valid, but forms not supported in Temporal: "2020-W01-1T00:00Z", "2020-001T00:00Z", diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-limits.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-limits.js new file mode 100644 index 0000000000..02f5070626 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-limits.js @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.since +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Instant(0n); + +const validStrings = [ + "-271821-04-20T00:00Z", + "-271821-04-19T23:00-01:00", + "-271821-04-19T00:00:00.000000001-23:59:59.999999999", + "+275760-09-13T00:00Z", + "+275760-09-13T01:00+01:00", + "+275760-09-13T23:59:59.999999999+23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.since(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z", + "-271821-04-19T23:00-00:59:59.999999999", + "-271821-04-19T00:00:00-23:59:59.999999999", + "+275760-09-13T00:00:00.000000001Z", + "+275760-09-13T01:00+00:59:59.999999999", + "+275760-09-14T00:00+23:59:59.999999999", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.since(arg), + `"${arg}" is outside the representable range of Instant` + ); +} diff --git a/test/built-ins/Temporal/Instant/prototype/since/instant-string-limits.js b/test/built-ins/Temporal/Instant/prototype/since/instant-string-limits.js deleted file mode 100644 index 8cedce299e..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/since/instant-string-limits.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.instant.prototype.since -description: String arguments at the limit of the representable range -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const minInstant = new Temporal.Instant(-86400_00000000_000_000_000n); -const maxInstant = new Temporal.Instant(86400_00000000_000_000_000n); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - TemporalHelpers.assertDuration(minInstant.since(str), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - TemporalHelpers.assertDuration(maxInstant.since(str), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => minInstant.since(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-invalid.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-invalid.js index 96585258d7..a83633d968 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/argument-string-invalid.js +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-invalid.js @@ -35,6 +35,8 @@ const invalidStrings = [ "2020-01-01T001Z", "2020-01-01T01:001Z", "2020-01-01T01:01:001Z", + "2020-01-01T00:00-24:00", + "2020-01-01T00:00+24:00", // valid, but forms not supported in Temporal: "2020-W01-1T00:00Z", "2020-001T00:00Z", diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-limits.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-limits.js new file mode 100644 index 0000000000..5e62dd0f32 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-limits.js @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.until +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.Instant(0n); + +const validStrings = [ + "-271821-04-20T00:00Z", + "-271821-04-19T23:00-01:00", + "-271821-04-19T00:00:00.000000001-23:59:59.999999999", + "+275760-09-13T00:00Z", + "+275760-09-13T01:00+01:00", + "+275760-09-13T23:59:59.999999999+23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.until(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z", + "-271821-04-19T23:00-00:59:59.999999999", + "-271821-04-19T00:00:00-23:59:59.999999999", + "+275760-09-13T00:00:00.000000001Z", + "+275760-09-13T01:00+00:59:59.999999999", + "+275760-09-14T00:00+23:59:59.999999999", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.until(arg), + `"${arg}" is outside the representable range of Instant` + ); +} diff --git a/test/built-ins/Temporal/Instant/prototype/until/instant-string-limits.js b/test/built-ins/Temporal/Instant/prototype/until/instant-string-limits.js deleted file mode 100644 index 0fb0902a9a..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/until/instant-string-limits.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.instant.prototype.until -description: String arguments at the limit of the representable range -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const minInstant = new Temporal.Instant(-86400_00000000_000_000_000n); -const maxInstant = new Temporal.Instant(86400_00000000_000_000_000n); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - TemporalHelpers.assertDuration(minInstant.until(str), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - TemporalHelpers.assertDuration(maxInstant.until(str), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => minInstant.until(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-limits.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-limits.js new file mode 100644 index 0000000000..258a6381b8 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-limits.js @@ -0,0 +1,42 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(1976, 11, 18); + +const validStrings = [ + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const arg of validStrings) { + Temporal.PlainDate.compare(arg, instance); + Temporal.PlainDate.compare(instance, arg); +} + +const invalidStrings = [ + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(arg, instance), + `"${arg}" is outside the representable range of PlainDate (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(instance, arg), + `"${arg}" is outside the representable range of PlainDate (second argument)` + ); +} diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-limits.js b/test/built-ins/Temporal/PlainDate/from/argument-string-limits.js new file mode 100644 index 0000000000..2e48b3de57 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-limits.js @@ -0,0 +1,34 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const validStrings = [ + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const arg of validStrings) { + Temporal.PlainDate.from(arg); +} + +const invalidStrings = [ + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(arg), + `"${arg}" is outside the representable range of PlainDate` + ); +} diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-limits.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-limits.js new file mode 100644 index 0000000000..4af9bcc2d2 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(2000, 5, 2); + +const validStrings = [ + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const arg of validStrings) { + instance.equals(arg); +} + +const invalidStrings = [ + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.equals(arg), + `"${arg}" is outside the representable range of PlainDate` + ); +} diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-limits.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-limits.js new file mode 100644 index 0000000000..1b2a00b00f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.since +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(2000, 5, 2); + +const validStrings = [ + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const arg of validStrings) { + instance.since(arg); +} + +const invalidStrings = [ + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.since(arg), + `"${arg}" is outside the representable range of PlainDate` + ); +} diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-limits.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-limits.js new file mode 100644 index 0000000000..e3ccbc4280 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.until +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(2000, 5, 2); + +const validStrings = [ + "-271821-04-19", + "-271821-04-19T01:00", + "+275760-09-13", + "+275760-09-13T23:00", +]; + +for (const arg of validStrings) { + instance.until(arg); +} + +const invalidStrings = [ + "-271821-04-18", + "-271821-04-18T23:00", + "+275760-09-14", + "+275760-09-14T01:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.until(arg), + `"${arg}" is outside the representable range of PlainDate` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-limits.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-limits.js new file mode 100644 index 0000000000..27f1c429e2 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-limits.js @@ -0,0 +1,42 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18); + +const validStrings = [ + "-271821-04-19T00:00:00.000000001", + "-271821-04-20", + "+275760-09-13", + "+275760-09-13T23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.PlainDateTime.compare(arg, instance); + Temporal.PlainDateTime.compare(instance, arg); +} + +const invalidStrings = [ + "-271821-04-19", + "-271821-04-19T00:00", + "+275760-09-14", + "+275760-09-14T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, instance), + `"${arg}" is outside the representable range of PlainDateTime (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(instance, arg), + `"${arg}" is outside the representable range of PlainDateTime (second argument)` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-limits.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-limits.js new file mode 100644 index 0000000000..27e0e38006 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-limits.js @@ -0,0 +1,34 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const validStrings = [ + "-271821-04-19T00:00:00.000000001", + "-271821-04-20", + "+275760-09-13", + "+275760-09-13T23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.PlainDateTime.from(arg); +} + +const invalidStrings = [ + "-271821-04-19", + "-271821-04-19T00:00", + "+275760-09-14", + "+275760-09-14T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(arg), + `"${arg}" is outside the representable range of PlainDateTime` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-limits.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-limits.js new file mode 100644 index 0000000000..b97fb81b70 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +const validStrings = [ + "-271821-04-19T00:00:00.000000001", + "-271821-04-20", + "+275760-09-13", + "+275760-09-13T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.equals(arg); +} + +const invalidStrings = [ + "-271821-04-19", + "-271821-04-19T00:00", + "+275760-09-14", + "+275760-09-14T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.equals(arg), + `"${arg}" is outside the representable range of PlainDateTime` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-limits.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-limits.js new file mode 100644 index 0000000000..d106122e34 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +const validStrings = [ + "-271821-04-19T00:00:00.000000001", + "-271821-04-20", + "+275760-09-13", + "+275760-09-13T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.since(arg); +} + +const invalidStrings = [ + "-271821-04-19", + "-271821-04-19T00:00", + "+275760-09-14", + "+275760-09-14T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.since(arg), + `"${arg}" is outside the representable range of PlainDateTime` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-limits.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-limits.js new file mode 100644 index 0000000000..658cb73255 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-limits.js @@ -0,0 +1,36 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +const validStrings = [ + "-271821-04-19T00:00:00.000000001", + "-271821-04-20", + "+275760-09-13", + "+275760-09-13T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.until(arg); +} + +const invalidStrings = [ + "-271821-04-19", + "-271821-04-19T00:00", + "+275760-09-14", + "+275760-09-14T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.until(arg), + `"${arg}" is outside the representable range of PlainDateTime` + ); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-limits.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-limits.js new file mode 100644 index 0000000000..027757e2bd --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-limits.js @@ -0,0 +1,45 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2019, 6); + +const validStrings = [ + "-271821-04", + "-271821-04-01", + "-271821-04-01T00:00", + "+275760-09", + "+275760-09-30", + "+275760-09-30T23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.PlainYearMonth.compare(arg, instance); + Temporal.PlainYearMonth.compare(instance, arg); +} + +const invalidStrings = [ + "-271821-03-31", + "-271821-03-31T23:59:59.999999999", + "+275760-10", + "+275760-10-01", + "+275760-10-01T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(arg, instance), + `"${arg}" is outside the representable range of PlainYearMonth (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(instance, arg), + `"${arg}" is outside the representable range of PlainYearMonth (second argument)` + ); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-limits.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-limits.js new file mode 100644 index 0000000000..d06ed173c2 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-limits.js @@ -0,0 +1,37 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const validStrings = [ + "-271821-04", + "-271821-04-01", + "-271821-04-01T00:00", + "+275760-09", + "+275760-09-30", + "+275760-09-30T23:59:59.999999999", +]; + +for (const arg of validStrings) { + Temporal.PlainYearMonth.from(arg); +} + +const invalidStrings = [ + "-271821-03-31", + "-271821-03-31T23:59:59.999999999", + "+275760-10", + "+275760-10-01", + "+275760-10-01T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(arg), + `"${arg}" is outside the representable range of PlainYearMonth` + ); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-limits.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-limits.js new file mode 100644 index 0000000000..215fe85f88 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-limits.js @@ -0,0 +1,39 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2019, 12); + +const validStrings = [ + "-271821-04", + "-271821-04-01", + "-271821-04-01T00:00", + "+275760-09", + "+275760-09-30", + "+275760-09-30T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.equals(arg); +} + +const invalidStrings = [ + "-271821-03-31", + "-271821-03-31T23:59:59.999999999", + "+275760-10", + "+275760-10-01", + "+275760-10-01T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.equals(arg), + `"${arg}" is outside the representable range of PlainYearMonth` + ); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-limits.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-limits.js new file mode 100644 index 0000000000..8ebeaf1364 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-limits.js @@ -0,0 +1,45 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(1970, 1); + +// Note, these limits are different than other PlainYearMonth conversions +// because the difference is taken between the first days of the two months, so +// the first day of the month of the argument must be within the representable +// range + +const validStrings = [ + "-271821-05", + "-271821-05-01", + "-271821-05-01T00:00", + "+275760-09", + "+275760-09-30", + "+275760-09-30T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.since(arg); +} + +const invalidStrings = [ + "-271821-04", + "-271821-04-30", + "-271821-04-30T23:59:59.999999999", + "+275760-10", + "+275760-10-01", + "+275760-10-01T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.since(arg), + `"${arg}" is outside the representable range of PlainYearMonth` + ); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-limits.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-limits.js new file mode 100644 index 0000000000..b80b0f04e7 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-limits.js @@ -0,0 +1,45 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(1970, 1); + +// Note, these limits are different than other PlainYearMonth conversions +// because the difference is taken between the first days of the two months, so +// the first day of the month of the argument must be within the representable +// range + +const validStrings = [ + "-271821-05", + "-271821-05-01", + "-271821-05-01T00:00", + "+275760-09", + "+275760-09-30", + "+275760-09-30T23:59:59.999999999", +]; + +for (const arg of validStrings) { + instance.until(arg); +} + +const invalidStrings = [ + "-271821-04", + "-271821-04-30", + "-271821-04-30T23:59:59.999999999", + "+275760-10", + "+275760-10-01", + "+275760-10-01T00:00", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.until(arg), + `"${arg}" is outside the representable range of PlainYearMonth` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-limits.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-limits.js new file mode 100644 index 0000000000..b847d38e68 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-limits.js @@ -0,0 +1,46 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(0n, "UTC"); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +for (const arg of validStrings) { + Temporal.ZonedDateTime.compare(arg, instance); + Temporal.ZonedDateTime.compare(instance, arg); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(arg, instance), + `"${arg}" is outside the representable range of ZonedDateTime (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(instance, arg), + `"${arg}" is outside the representable range of ZonedDateTime (second argument)` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-limits.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-limits.js new file mode 100644 index 0000000000..9e37f111aa --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-limits.js @@ -0,0 +1,78 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +// offset: "use" takes the exact time with the given UTC offset, and so doesn't +// need to compute the UTC epoch nanoseconds at the wall-clock time. +// offset: "ignore" takes the UTC offset from the time zone, which in the case +// of an offset time zone also doesn't need to compute the UTC epoch nanoseconds +// at the wall-clock time. + +const validStringsForOffsetUseIgnore = [ + "-271821-04-20T00:00Z[UTC]", + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +for (const offset of ["use", "ignore"]) { + for (const arg of validStringsForOffsetUseIgnore) { + Temporal.ZonedDateTime.from(arg, { offset: "use" }); + } +} + +// Other values for offset need to compute the UTC epoch nanoseconds at the +// wall-clock time, so that can't be outside the representable range even if +// the signified exact time is inside. + +const validStringsForOffsetPreferReject = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +const invalidStringsForOffsetPreferReject = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:00:01-23:59[-23:59]", +]; + +for (const offset of ["prefer", "reject"]) { + for (const arg of validStringsForOffsetPreferReject) { + Temporal.ZonedDateTime.from(arg, { offset }); + } + + for (const arg of invalidStringsForOffsetPreferReject) { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg, { offset }), + `wall-clock time of "${arg}" is outside the representable range of ZonedDateTime (offset=${offset})` + ); + } +} + +const invalidStrings = [ + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", +]; + +for (const offset of ["use", "ignore", "prefer", "reject"]) { + for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg, { offset }), + `"${arg}" is outside the representable range of ZonedDateTime (offset=${offset})` + ); + } +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-limits.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-limits.js new file mode 100644 index 0000000000..c6a3002195 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-limits.js @@ -0,0 +1,40 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(0n, "UTC"); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +for (const arg of validStrings) { + instance.equals(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.equals(arg), + `"${arg}" is outside the representable range of ZonedDateTime` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/next-day-out-of-range.js b/test/built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/next-day-out-of-range.js new file mode 100644 index 0000000000..5ecc9cee17 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/next-day-out-of-range.js @@ -0,0 +1,13 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.hoursinday +description: > + Finding the boundary with the next day may throw if the instance is at the + upper edge of the representable range +features: [Temporal] +---*/ + +const z = new Temporal.ZonedDateTime(86400_0000_0000_000_000_000n, "UTC"); +assert.throws(RangeError, () => z.hoursInDay, "Next day boundary is out of range"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/round/day-rounding-out-of-range.js b/test/built-ins/Temporal/ZonedDateTime/prototype/round/day-rounding-out-of-range.js new file mode 100644 index 0000000000..c6861e757f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/round/day-rounding-out-of-range.js @@ -0,0 +1,13 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.round +description: > + Finding the upper bound for day rounding may fail if the instance is at the + upper edge of the representable range +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(86400_0000_0000_000_000_000n, "UTC"); +assert.throws(RangeError, () => instance.round({ smallestUnit: 'day' }), "Upper bound for rounding is out of range"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-limits.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-limits.js new file mode 100644 index 0000000000..9675ada1ef --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-limits.js @@ -0,0 +1,41 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const timeZone = "UTC"; +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +for (const arg of validStrings) { + instance.since(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.since(arg), + `"${arg}" is outside the representable range of ZonedDateTime` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-limits.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-limits.js new file mode 100644 index 0000000000..57f74dec4f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-limits.js @@ -0,0 +1,41 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: ISO strings at the edges of the representable range +features: [Temporal] +---*/ + +const timeZone = "UTC"; +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const validStrings = [ + "-271821-04-20T00:00Z[UTC]", + "+275760-09-13T00:00Z[UTC]", + "+275760-09-13T01:00+01:00[+01:00]", + "+275760-09-13T23:59+23:59[+23:59]", +]; + +for (const arg of validStrings) { + instance.until(arg); +} + +const invalidStrings = [ + "-271821-04-19T23:00-01:00[-01:00]", + "-271821-04-19T00:01-23:59[-23:59]", + "-271821-04-19T23:59:59.999999999Z[UTC]", + "-271821-04-19T23:00-00:59[-00:59]", + "-271821-04-19T00:00:00-23:59[-23:59]", + "+275760-09-13T00:00:00.000000001Z[UTC]", + "+275760-09-13T01:00+00:59[+00:59]", + "+275760-09-14T00:00+23:59[+23:59]", +]; + +for (const arg of invalidStrings) { + assert.throws( + RangeError, + () => instance.until(arg), + `"${arg}" is outside the representable range of ZonedDateTime` + ); +} diff --git a/test/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js index d6586ee659..7549a7dc63 100644 --- a/test/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js index cd222cd88d..4ff8b83c8f 100644 --- a/test/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 3bf215b2d0..b0136eadb1 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 @@ -37,6 +37,13 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(array.byteLength, expected, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + expected = BPE; + } catch (_) {} + + assert.sameValue(array.byteLength, expected, "following shrink (partial element)"); + try { ab.resize(BPE); expected = 0; diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-fixed.js index 6479069aba..50876536cd 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = BPE * 2; 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 21ea9650d7..ff52a012e8 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 @@ -37,6 +37,13 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(array.byteLength, expected, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + expected = BPE; + } catch (_) {} + + assert.sameValue(array.byteLength, expected, "following shrink (partial element)"); + try { ab.resize(BPE); expected = 0; diff --git a/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-fixed.js index 275b7b5606..7f612dc422 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = BPE * 2; diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-auto.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-auto.js index a38c163e7a..08cc15cbfd 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-auto.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-auto.js @@ -34,6 +34,12 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(array.byteOffset, BPE, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + } catch (_) {} + + assert.sameValue(array.byteOffset, BPE, "following shrink (partial element)"); + try { ab.resize(BPE); } catch (_) {} diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-fixed.js index 7af5fed068..1972c4b7b3 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = BPE; 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 bc71db907f..e8aa74c007 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,6 +34,12 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(array.byteOffset, BPE, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + } catch (_) {} + + assert.sameValue(array.byteOffset, BPE, "following shrink (partial element)"); + try { ab.resize(BPE); } catch (_) {} diff --git a/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-fixed.js index e3fa1bd6b9..9a9161686c 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = BPE; diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-this-out-of-bounds.js index 281b5fe6d2..12e79ef3fc 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js index 6e9bd2929d..cab2f56819 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-abrupt-from-this-out-of-bounds.js index 3e56399c13..1bf20c4973 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/entries/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/entries/return-abrupt-from-this-out-of-bounds.js index 748b217d50..12666642aa 100644 --- a/test/built-ins/TypedArray/prototype/entries/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/entries/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/every/BigInt/return-abrupt-from-this-out-of-bounds.js index 86733a56cc..aec5a1d7e8 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/every/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/every/return-abrupt-from-this-out-of-bounds.js index f634a0bc29..da5f281786 100644 --- a/test/built-ins/TypedArray/prototype/every/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/every/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-this-out-of-bounds.js index c105efb4b5..2264138548 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js index b0a7d7c30d..1604aadd4e 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/filter/BigInt/return-abrupt-from-this-out-of-bounds.js index 4891766e60..490e8e1ad5 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/filter/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/filter/return-abrupt-from-this-out-of-bounds.js index 499bfdbbcc..0655bdabeb 100644 --- a/test/built-ins/TypedArray/prototype/filter/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/filter/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-this-out-of-bounds.js index 41d2dbbf57..d600fdba1a 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-this-out-of-bounds.js index 97bf64febb..821607f192 100644 --- a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-this-out-of-bounds.js index 7431c2af26..baa8df142d 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-this-out-of-bounds.js index dfa5aa24d2..1a21e024c2 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-this-out-of-bounds.js index b468b62ee4..6fcbcaa15f 100644 --- a/test/built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findLast/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findLast/return-abrupt-from-this-out-of-bounds.js index 97f1f02077..5dc3aee8fa 100644 --- a/test/built-ins/TypedArray/prototype/findLast/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findLast/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-this-out-of-bounds.js index 927efcf5d7..3a1119f6dd 100644 --- a/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-this-out-of-bounds.js index c4eb50ee12..b2f3c11f05 100644 --- a/test/built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/return-abrupt-from-this-out-of-bounds.js index 25d6647938..90b49a5f74 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/forEach/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/forEach/return-abrupt-from-this-out-of-bounds.js index ab01f64940..970aba1a54 100644 --- a/test/built-ins/TypedArray/prototype/forEach/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/forEach/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 c25e4dfaab..1d67537390 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 @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/includes/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/includes/return-abrupt-from-this-out-of-bounds.js index 884717ddc6..ef72514b70 100644 --- a/test/built-ins/TypedArray/prototype/includes/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/includes/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 c7494e4765..0b6a3389e0 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 @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/indexOf/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/indexOf/return-abrupt-from-this-out-of-bounds.js index 147964ce1c..9d656680cd 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/indexOf/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 0bce064301..feffc7f086 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 @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/join/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/join/return-abrupt-from-this-out-of-bounds.js index e561f8e3d2..15de78e0d8 100644 --- a/test/built-ins/TypedArray/prototype/join/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/join/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/keys/BigInt/return-abrupt-from-this-out-of-bounds.js index cd9d237609..5109017fa1 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/keys/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/keys/return-abrupt-from-this-out-of-bounds.js index dbb4acce07..8a4c95cdda 100644 --- a/test/built-ins/TypedArray/prototype/keys/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/keys/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 2382f444a3..226fa80b2f 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 @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/lastIndexOf/return-abrupt-from-this-out-of-bounds.js index a731bd403b..e6cb1264fc 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. 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 94dbad11cc..0ba617826a 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 @@ -37,6 +37,13 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(array.length, expected, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + expected = 1; + } catch (_) {} + + assert.sameValue(array.length, expected, "following shrink (partial element)"); + try { ab.resize(BPE); expected = 0; diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-fixed.js index 77cf35ccf2..de7d730623 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = 2; 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 a894a5898f..3e240f3237 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 @@ -37,6 +37,13 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(array.length, expected, "following shrink (within bounds)"); + try { + ab.resize(BPE * 3 - 1); + expected = 1; + } catch (_) {} + + assert.sameValue(array.length, expected, "following shrink (partial element)"); + try { ab.resize(BPE); expected = 0; diff --git a/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-fixed.js b/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-fixed.js index 4c0714223f..43d7c835cf 100644 --- a/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-fixed.js +++ b/test/built-ins/TypedArray/prototype/length/resizable-array-buffer-fixed.js @@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) { var expected; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); expected = 0; } catch (_) { expected = 2; 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 73c880fbfe..5bb06dda12 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 @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/map/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/map/return-abrupt-from-this-out-of-bounds.js index 3eda7c6b0b..f1afe9521b 100644 --- a/test/built-ins/TypedArray/prototype/map/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/map/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-abrupt-from-this-out-of-bounds.js index beeddc1b53..077b54cfa2 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reduce/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reduce/return-abrupt-from-this-out-of-bounds.js index c273af402c..3c0d872c23 100644 --- a/test/built-ins/TypedArray/prototype/reduce/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reduce/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-abrupt-from-this-out-of-bounds.js index 0cf00b3c5e..6c6bc72426 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reduceRight/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reduceRight/return-abrupt-from-this-out-of-bounds.js index b6b2075266..3ba3a6c89e 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/return-abrupt-from-this-out-of-bounds.js index 884c548e55..ec55d9ffbe 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/reverse/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/reverse/return-abrupt-from-this-out-of-bounds.js index 0090372e96..1bf8d67fa0 100644 --- a/test/built-ins/TypedArray/prototype/reverse/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/reverse/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-this-out-of-bounds.js index 7b572c6687..cd4099312c 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/slice/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/slice/return-abrupt-from-this-out-of-bounds.js index ef331ac718..276bedee52 100644 --- a/test/built-ins/TypedArray/prototype/slice/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/slice/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/some/BigInt/return-abrupt-from-this-out-of-bounds.js index 52bdaa60b3..19d8b6f723 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/some/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/some/return-abrupt-from-this-out-of-bounds.js index c36e9071e0..bb5ba9550b 100644 --- a/test/built-ins/TypedArray/prototype/some/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/some/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/sort/BigInt/return-abrupt-from-this-out-of-bounds.js index 7e12d3da2d..d59651389f 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/sort/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/sort/return-abrupt-from-this-out-of-bounds.js index f4843fddae..732bce9f58 100644 --- a/test/built-ins/TypedArray/prototype/sort/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/sort/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-this-out-of-bounds.js index 79cd14013d..1f229df564 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js index 4e28e28083..7a45f2f443 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/values/BigInt/return-abrupt-from-this-out-of-bounds.js index b199f30375..6ad023c23b 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js b/test/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js index 0ff26bc4e9..654535d707 100644 --- a/test/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js +++ b/test/built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(TA => { var expectedError; try { - ab.resize(BPE * 2); + ab.resize(BPE * 3 - 1); // If the preceding "resize" operation is successful, the typed array will // be out out of bounds, so the subsequent prototype method should produce // a TypeError due to the semantics of ValidateTypedArray. diff --git a/test/harness/compare-array-arguments.js b/test/harness/compare-array-arguments.js index 597efa0564..ccecdd743e 100644 --- a/test/harness/compare-array-arguments.js +++ b/test/harness/compare-array-arguments.js @@ -28,11 +28,11 @@ function f() { checkFormatOfAssertionMessage(() => { assert.compareArray(arguments, [], 'arguments and []'); - }, 'Expected [0, a, undefined] and [] to have the same contents. arguments and []'); + }, 'Actual [0, a, undefined] and expected [] should have the same contents. arguments and []'); checkFormatOfAssertionMessage(() => { assert.compareArray([], arguments, '[] and arguments'); - }, 'Expected [] and [0, a, undefined] to have the same contents. [] and arguments'); + }, 'Actual [] and expected [0, a, undefined] should have the same contents. [] and arguments'); } f(...fixture); diff --git a/test/harness/compare-array-arraylike.js b/test/harness/compare-array-arraylike.js index 8318e5ff51..826e6acac0 100644 --- a/test/harness/compare-array-arraylike.js +++ b/test/harness/compare-array-arraylike.js @@ -27,8 +27,8 @@ assert.compareArray([0, 'a', undefined], fixture); checkFormatOfAssertionMessage(() => { assert.compareArray(fixture, [], 'fixture and []'); -}, 'Expected [0, a, undefined] and [] to have the same contents. fixture and []'); +}, 'Actual [0, a, undefined] and expected [] should have the same contents. fixture and []'); checkFormatOfAssertionMessage(() => { assert.compareArray([], fixture, '[] and fixture'); -}, 'Expected [] and [0, a, undefined] to have the same contents. [] and fixture'); +}, 'Actual [] and expected [0, a, undefined] should have the same contents. [] and fixture'); diff --git a/test/harness/compare-array-falsy-arguments.js b/test/harness/compare-array-falsy-arguments.js index ad16a49a8e..1b17976401 100644 --- a/test/harness/compare-array-falsy-arguments.js +++ b/test/harness/compare-array-falsy-arguments.js @@ -20,9 +20,9 @@ function assertThrows(func, errorMessage) { assert(caught, `Expected ${func} to throw, but it didn't.`); } -assertThrows(() => assert.compareArray(), "First argument shouldn't be nullish. "); -assertThrows(() => assert.compareArray(null, []), "First argument shouldn't be nullish. "); -assertThrows(() => assert.compareArray(null, [], "foo"), "First argument shouldn't be nullish. foo"); +assertThrows(() => assert.compareArray(), "Actual argument shouldn't be nullish. "); +assertThrows(() => assert.compareArray(null, []), "Actual argument shouldn't be nullish. "); +assertThrows(() => assert.compareArray(null, [], "foo"), "Actual argument shouldn't be nullish. foo"); -assertThrows(() => assert.compareArray([]), "Second argument shouldn't be nullish. "); -assertThrows(() => assert.compareArray([], undefined, "foo"), "Second argument shouldn't be nullish. foo"); +assertThrows(() => assert.compareArray([]), "Expected argument shouldn't be nullish. "); +assertThrows(() => assert.compareArray([], undefined, "foo"), "Expected argument shouldn't be nullish. foo");