mirror of
https://github.com/tc39/test262.git
synced 2025-11-18 04:39:44 +01:00
Temporal: Add ISO8601 PlainDate.p.with leap year test
This was not particularly well covered in the existing tests.
This commit is contained in:
parent
d12966d207
commit
8d2fba2d16
24
test/built-ins/Temporal/PlainDate/prototype/with/leap-year.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDate/prototype/with/leap-year.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.with
|
||||
description: Check constraining days when year changes
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
|
||||
const leapDay = new Temporal.PlainDate(2016, 2, 29);
|
||||
const options = { overflow: "reject" };
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
leapDay.with({ year: 2012 }, options),
|
||||
2012, 2, "M02", 29, "day not constrained when moving to another leap year");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
leapDay.with({ year: 2018 }),
|
||||
2018, 2, "M02", 28, "day constrained when moving to a common year");
|
||||
|
||||
assert.throws(RangeError, function () {
|
||||
leapDay.with({ year: 2018 }, options);
|
||||
}, "reject when moving to a common year");
|
||||
Loading…
x
Reference in New Issue
Block a user