Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainMonthDay / prototype / toString / calendarname-wrong-type.js
blob6a0f7edf80e89771acd96dd6e9c64c12256989df
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.
5 /*---
6 esid: sec-temporal.plainmonthday.protoype.tostring
7 description: Type conversions for calendarName option
8 info: |
9     sec-getoption step 9.a:
10       a. Set _value_ to ? ToString(_value_).
11     sec-temporal-toshowcalendaroption step 1:
12       1. Return ? GetOption(_normalizedOptions_, *"calendarName"*, « *"string"* », « *"auto"*, *"always"*, *"never"*, *"critical"* », *"auto"*).
13     sec-temporal.plainmonthday.protoype.tostring step 4:
14       4. Let _showCalendar_ be ? ToShowCalendarOption(_options_).
15 includes: [compareArray.js, temporalHelpers.js]
16 features: [Temporal]
17 ---*/
19 const calendar = {
20   id: "custom",
21   dateAdd() {},
22   dateFromFields() {},
23   dateUntil() {},
24   day() {},
25   dayOfWeek() {},
26   dayOfYear() {},
27   daysInMonth() {},
28   daysInWeek() {},
29   daysInYear() {},
30   fields() {},
31   inLeapYear() {},
32   mergeFields() {},
33   month() {},
34   monthCode() {},
35   monthDayFromFields() {},
36   monthsInYear() {},
37   weekOfYear() {},
38   year() {},
39   yearMonthFromFields() {},
40   yearOfWeek() {},
42 const monthday = new Temporal.PlainMonthDay(5, 2, calendar);
44 TemporalHelpers.checkStringOptionWrongType("calendarName", "auto",
45   (calendarName) => monthday.toString({ calendarName }),
46   (result, descr) => assert.sameValue(result, "1972-05-02[u-ca=custom]", descr),
49 reportCompare(0, 0);