mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
Remove the existing "instant-string-limits.js" that only applied to APIs where ToTemporalInstant was called. Add "argument-string-limits.js" tests everywhere ISO strings are converted. Related to tc39/proposal-temporal#2985
35 lines
783 B
JavaScript
35 lines
783 B
JavaScript
// 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`
|
|
);
|
|
}
|