Merge branch 'main' into regex-v-flag-follow-up

This commit is contained in:
Ioanna M Dimitriou H 2024-10-04 18:33:01 +02:00 committed by GitHub
commit 1332b14d69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
110 changed files with 1358 additions and 301 deletions

View File

@ -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}`);
}
};

View File

@ -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
});

View File

@ -27,6 +27,6 @@ assert.sameValue(
);
verifyProperty(DisposableStack.prototype, 'disposed', {
enumerable: false;
configurable: true;
enumerable: false,
configurable: true
});

View File

@ -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");

View File

@ -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`
);
}

View File

@ -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"
);

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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",

View File

@ -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)`
);
}

View File

@ -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)`);
}

View File

@ -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",

View File

@ -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`
);
}

View File

@ -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`);
}

View File

@ -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",

View File

@ -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`
);
}

View File

@ -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`);
}

View File

@ -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",

View File

@ -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`
);
}

View File

@ -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`);
}

View File

@ -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",

View File

@ -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`
);
}

View File

@ -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`);
}

View File

@ -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)`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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)`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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)`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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)`
);
}

View File

@ -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})`
);
}
}

View File

@ -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`
);
}

View File

@ -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");

View File

@ -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");

View File

@ -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`
);
}

View File

@ -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`
);
}

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 (_) {}

View File

@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
var expected;
try {
ab.resize(BPE * 2);
ab.resize(BPE * 3 - 1);
expected = 0;
} catch (_) {
expected = BPE;

View File

@ -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 (_) {}

View File

@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) {
var expected;
try {
ab.resize(BPE * 2);
ab.resize(BPE * 3 - 1);
expected = 0;
} catch (_) {
expected = BPE;

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
var expected;
try {
ab.resize(BPE * 2);
ab.resize(BPE * 3 - 1);
expected = 0;
} catch (_) {
expected = 2;

View File

@ -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;

View File

@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) {
var expected;
try {
ab.resize(BPE * 2);
ab.resize(BPE * 3 - 1);
expected = 0;
} catch (_) {
expected = 2;

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

Some files were not shown because too many files have changed in this diff Show More