mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Test limits in PlainYearMonth.from.
This commit is contained in:
parent
f857cf9968
commit
20329ef359
25
test/built-ins/Temporal/PlainYearMonth/from/limits.js
Normal file
25
test/built-ins/Temporal/PlainYearMonth/from/limits.js
Normal file
@ -0,0 +1,25 @@
|
||||
// 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.plainyearmonth.from
|
||||
description: PlainYearMonth.from enforces the supported range
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
["reject", "constrain"].forEach((overflow) => {
|
||||
[{ year: -271821, month: 3 }, { year: 275760, month: 10 }, "-271821-03", "+275760-10"].forEach((value) => {
|
||||
assert.throws(RangeError, () => Temporal.PlainYearMonth.from(value, { overflow }),
|
||||
`${JSON.stringify(value)} with ${overflow}`);
|
||||
});
|
||||
});
|
||||
|
||||
TemporalHelpers.assertPlainYearMonth(Temporal.PlainYearMonth.from({ year: -271821, month: 4 }),
|
||||
-271821, 4, "M04", "min object");
|
||||
TemporalHelpers.assertPlainYearMonth(Temporal.PlainYearMonth.from({ year: 275760, month: 9 }),
|
||||
275760, 9, "M09", "max object");
|
||||
TemporalHelpers.assertPlainYearMonth(Temporal.PlainYearMonth.from("-271821-04"),
|
||||
-271821, 4, "M04", "min string");
|
||||
TemporalHelpers.assertPlainYearMonth(Temporal.PlainYearMonth.from("+275760-09"),
|
||||
275760, 9, "M09", "max string");
|
Loading…
x
Reference in New Issue
Block a user