mirror of https://github.com/tc39/test262.git
Test overflow 'constrain' in PlainDate#{add,subtract}.
This commit is contained in:
parent
a042241ed2
commit
00b9691218
|
@ -0,0 +1,15 @@
|
|||
// 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.plaindate.prototype.add
|
||||
description: Constrains with overflow constrain
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const jan31 = Temporal.PlainDate.from("2020-01-31");
|
||||
TemporalHelpers.assertPlainDate(jan31.add({ months: 1 }),
|
||||
2020, 2, "M02", 29, "implicit");
|
||||
TemporalHelpers.assertPlainDate(jan31.add({ months: 1 }, { overflow: "constrain" }),
|
||||
2020, 2, "M02", 29, "explicit");
|
|
@ -0,0 +1,15 @@
|
|||
// 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.plaindate.prototype.subtract
|
||||
description: Constrains with overflow constrain
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const mar31 = Temporal.PlainDate.from("2020-03-31");
|
||||
TemporalHelpers.assertPlainDate(mar31.subtract({ months: 1 }),
|
||||
2020, 2, "M02", 29, "implicit");
|
||||
TemporalHelpers.assertPlainDate(mar31.subtract({ months: 1 }, { overflow: "constrain" }),
|
||||
2020, 2, "M02", 29, "explicit");
|
Loading…
Reference in New Issue