diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js b/js/src/tests/test262/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js new file mode 100644 index 0000000000..84832a5aae --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js @@ -0,0 +1,50 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// 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.plainmonthday.prototype.tostring +description: > + If calendarName is "calendar", the calendar ID should be included and prefixed + with "!". +features: [Temporal] +---*/ + +const calendarMethods = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; + +const tests = [ + [[], "1972-05-02[!u-ca=iso8601]", "built-in ISO"], + [[{ id: "custom", ...calendarMethods }], "1972-05-02[!u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1972-05-02[!u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1972-05-02[!u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1972-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"], +]; + +for (const [args, expected, description] of tests) { + const monthday = new Temporal.PlainMonthDay(5, 2, ...args); + const result = monthday.toString({ calendarName: "critical" }); + assert.sameValue(result, expected, `${description} calendar for calendarName = critical`); +} + +reportCompare(0, 0); |