summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js b/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js
new file mode 100644
index 0000000000..0c77b349f1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js
@@ -0,0 +1,48 @@
+// |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.plaindate.prototype.tostring
+description: If calendarName is "never", the calendar ID should be omitted.
+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 = [
+ [[], "2000-05-02", "built-in ISO"],
+ [[{ id: "custom", ...calendarMethods }], "2000-05-02", "custom"],
+ [[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"],
+ [[{ id: "ISO8601", ...calendarMethods }], "2000-05-02", "custom with caps id"],
+ [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02", "custom with dotless i id"],
+];
+
+for (const [args, expected, description] of tests) {
+ const date = new Temporal.PlainDate(2000, 5, 2, ...args);
+ const result = date.toString({ calendarName: "never" });
+ assert.sameValue(result, expected, `${description} calendar for calendarName = never`);
+}
+
+reportCompare(0, 0);