mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 23:14:47 +02:00
Test overflow 'constrain' in PlainDate#{add,subtract}.
This commit is contained in:
parent
a042241ed2
commit
00b9691218
15
test/built-ins/Temporal/PlainDate/prototype/add/overflow-constrain.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDate/prototype/add/overflow-constrain.js
vendored
Normal file
@ -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");
|
15
test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-constrain.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-constrain.js
vendored
Normal file
@ -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…
x
Reference in New Issue
Block a user