fields-string.js (999B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 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);