Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainMonthDay/basic.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) 2021 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.plainmonthday
7 description: Basic tests for the PlainMonthDay constructor.
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const leapDay = new Temporal.PlainMonthDay(2, 29);
13 TemporalHelpers.assertPlainMonthDay(leapDay, "M02", 29, "leap day is supported");
14 assert.sameValue(leapDay.calendarId, "iso8601", "leap day calendar");
15
16 const beforeEpoch = new Temporal.PlainMonthDay(12, 2, "iso8601", 1920);
17 TemporalHelpers.assertPlainMonthDay(beforeEpoch, "M12", 2, "reference year before epoch", 1920);
18 assert.sameValue(beforeEpoch.calendarId, "iso8601", "reference year before epoch calendar");
19
20 const afterEpoch = new Temporal.PlainMonthDay(1, 7, "iso8601", 1980);
21 TemporalHelpers.assertPlainMonthDay(afterEpoch, "M01", 7, "reference year after epoch", 1980);
22 assert.sameValue(afterEpoch.calendarId, "iso8601", "reference year after epoch calendar");
23
24 reportCompare(0, 0);