From a042241ed2f5e98f64805132a1aa80a879f7cf07 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 24 Jan 2022 11:04:23 +0100 Subject: [PATCH] Test overflow 'reject' in PlainDate#{add,subtract}. --- .../PlainDate/prototype/add/overflow-reject.js | 11 +++++++++++ .../PlainDate/prototype/subtract/overflow-reject.js | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/built-ins/Temporal/PlainDate/prototype/add/overflow-reject.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-reject.js diff --git a/test/built-ins/Temporal/PlainDate/prototype/add/overflow-reject.js b/test/built-ins/Temporal/PlainDate/prototype/add/overflow-reject.js new file mode 100644 index 0000000000..ac5e336824 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/add/overflow-reject.js @@ -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" })); diff --git a/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-reject.js b/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-reject.js new file mode 100644 index 0000000000..656ecf7341 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-reject.js @@ -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" }));