Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/limits.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.plainyearmonth
7 description: Limits for the PlainYearMonth constructor.
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 assert.throws(RangeError, () => new Temporal.PlainYearMonth(-271821, 3), "min");
13 assert.throws(RangeError, () => new Temporal.PlainYearMonth(275760, 10), "max");
14 TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4),
15 -271821, 4, "M04", "min");
16 TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4, "iso8601", 18),
17 -271821, 4, "M04", "min with referenceISODay",
18 /* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 18);
19 TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9),
20 275760, 9, "M09", "max");
21 TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9, "iso8601", 14),
22 275760, 9, "M09", "max with referenceISODay",
23 /* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 14);
24
25 reportCompare(0, 0);