Temporal: Add test for Duration/p/toString() with total time units out of range (#4313)

This commit is contained in:
Tim Chevalier 2024-11-06 07:47:58 -08:00 committed by GitHub
parent 38d52c9a60
commit b2809feedf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 }));