Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainMonthDay/from/fields-string.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.from
7 description: Basic tests for PlainMonthDay.from(string).
8 includes: [compareArray.js, temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 for (const argument of TemporalHelpers.ISO.plainMonthDayStringsValid()) {
13 const plainMonthDay = Temporal.PlainMonthDay.from(argument);
14 assert.notSameValue(plainMonthDay, argument, `from ${argument} converts`);
15 TemporalHelpers.assertPlainMonthDay(plainMonthDay, "M10", 1, `from ${argument}`);
16 assert.sameValue(plainMonthDay.calendarId, "iso8601", `from ${argument} calendar`);
17 }
18
19 for (const arg of TemporalHelpers.ISO.plainMonthDayStringsInvalid()) {
20 assert.throws(RangeError, () => Temporal.PlainMonthDay.from(arg), `"${arg}" not a valid PlainMonthDay string`);
21 }
22
23 reportCompare(0, 0);