diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js b/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js new file mode 100644 index 0000000000..5b44173c28 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js @@ -0,0 +1,48 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.tostring +description: Verify that undefined options are handled correctly. +features: [Temporal] +---*/ + +const calendar = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "custom", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; +const date1 = new Temporal.PlainDate(2000, 5, 2); +const date2 = new Temporal.PlainDate(2000, 5, 2, calendar); + +[ + [date1, "2000-05-02"], + [date2, "2000-05-02[u-ca=custom]"], +].forEach(([date, expected]) => { + const explicit = date.toString(undefined); + assert.sameValue(explicit, expected, "default calendarName option is auto"); + + const implicit = date.toString(); + assert.sameValue(implicit, expected, "default calendarName option is auto"); +}); + +reportCompare(0, 0); |