Test overflow 'reject' in PlainDate#{add,subtract}.

This commit is contained in:
Ms2ger 2022-01-24 11:04:23 +01:00 committed by Rick Waldron
parent ef0b1507fc
commit a042241ed2
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,11 @@
// 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: Throws with overflow reject
features: [Temporal]
---*/
const jan31 = Temporal.PlainDate.from("2020-01-31");
assert.throws(RangeError, () => jan31.add({ months: 1 }, { overflow: "reject" }));

View File

@ -0,0 +1,11 @@
// 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: Throws with overflow reject
features: [Temporal]
---*/
const mar31 = Temporal.PlainDate.from("2020-03-31");
assert.throws(RangeError, () => mar31.subtract({ months: 1 }, { overflow: "reject" }));