From b2809feedf590dddfa5c4579e59722a30e110ed9 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 6 Nov 2024 07:47:58 -0800 Subject: [PATCH] Temporal: Add test for Duration/p/toString() with total time units out of range (#4313) --- .../total-of-duration-time-units-out-of-range.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/built-ins/Temporal/Duration/prototype/toString/total-of-duration-time-units-out-of-range.js diff --git a/test/built-ins/Temporal/Duration/prototype/toString/total-of-duration-time-units-out-of-range.js b/test/built-ins/Temporal/Duration/prototype/toString/total-of-duration-time-units-out-of-range.js new file mode 100644 index 0000000000..9e9c37fd36 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/toString/total-of-duration-time-units-out-of-range.js @@ -0,0 +1,13 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.tostring +description: Throws when rounding and total of duration time units is out of range. +features: [Temporal] +---*/ + +const duration = new Temporal.Duration(0, 0, 0, 1, 0, 0, 2**53 - 1 - (24*60*60), 0, 0, 999_999_999); + +assert.throws(RangeError, + () => duration.toString({ roundingMode: "ceil", fractionalSecondDigits: 7 }));