mirror of https://github.com/tc39/test262.git
Add additional tests for out-of-range date-times
- https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414066610 - https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414065876 - https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414067272
This commit is contained in:
parent
0de91996e7
commit
584048ed08
|
@ -0,0 +1,20 @@
|
|||
// 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: RangeError thrown if adding the duration to the relativeTo date would result in anout-of-range date-time
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let duration1 = Temporal.Duration.from({
|
||||
years: 1,
|
||||
seconds: 2**53 - 1,
|
||||
});
|
||||
let duration2 = Temporal.Duration.from({
|
||||
years: 2,
|
||||
});
|
||||
let relativeTo = new Temporal.PlainDate(2000, 1, 1);
|
||||
|
||||
assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, { relativeTo }));
|
||||
assert.throws(RangeError, () => Temporal.Duration.compare(duration2, duration1, { relativeTo }));
|
|
@ -0,0 +1,16 @@
|
|||
// 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: RangeError thrown if adding the duration to the relativeTo date would result in anout-of-range date-time
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let duration = Temporal.Duration.from({
|
||||
years: 1,
|
||||
seconds: 2**53 - 1,
|
||||
});
|
||||
let relativeTo = new Temporal.PlainDate(2000, 1, 1);
|
||||
|
||||
assert.throws(RangeError, () => duration.total({ relativeTo, unit: "days" }));
|
Loading…
Reference in New Issue