From 33865c5339c62c2878e5e8fa0d4804999bb4a3fe Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 27 Jan 2023 18:30:11 -0800 Subject: [PATCH] Validate required methods of Temporal Calendar protocol Checking whether an object implements the Calendar protocol is now done by means of HasProperty operations for each of the required methods unless the object already has the Calendar brand. Discussion: https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753 Corresponding normative PR: https://github.com/tc39/proposal-temporal/pull/2485 --- harness/temporalHelpers.js | 66 +++++++++++++++++-- .../Temporal/Calendar/from/calendar-object.js | 28 +++++++- .../Calendar/from/calendar-wrong-type.js | 4 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/dateAdd/order-of-operations.js | 23 ++++++- ...rgument-propertybag-calendar-wrong-type.js | 6 +- .../dateUntil/order-of-operations.js | 46 ++++++++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../Duration/compare/order-of-operations.js | 42 ++++++++++++ .../prototype/add/order-of-operations.js | 42 ++++++++++++ ...ativeto-propertybag-calendar-wrong-type.js | 4 +- .../prototype/round/order-of-operations.js | 42 ++++++++++++ ...ativeto-propertybag-calendar-wrong-type.js | 4 +- .../prototype/subtract/order-of-operations.js | 42 ++++++++++++ ...ativeto-propertybag-calendar-wrong-type.js | 4 +- .../prototype/total/order-of-operations.js | 42 ++++++++++++ ...ativeto-propertybag-calendar-wrong-type.js | 4 +- .../toZonedDateTime/calendar-wrong-type.js | 4 +- .../Now/plainDate/calendar-wrong-type.js | 4 +- .../Now/plainDateTime/calendar-function.js | 21 ++++++ .../Now/plainDateTime/calendar-object.js | 25 ++++++- .../Now/plainDateTime/calendar-wrong-type.js | 4 +- .../Now/zonedDateTime/calendar-function.js | 21 ++++++ .../Now/zonedDateTime/calendar-object.js | 25 ++++++- .../Now/zonedDateTime/calendar-wrong-type.js | 4 +- .../Temporal/PlainDate/calendar-wrong-type.js | 3 + ...rgument-propertybag-calendar-wrong-type.js | 6 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../PlainDate/from/order-of-operations.js | 21 ++++++ .../prototype/equals/argument-object-valid.js | 24 ++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/equals/argument-string.js | 24 ++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/since/calendar-mismatch.js | 48 +++++++++++++- .../prototype/since/order-of-operations.js | 21 ++++++ .../prototype/toString/calendar-tostring.js | 22 ++++++- .../prototype/toString/calendarname-always.js | 31 +++++++-- .../prototype/toString/calendarname-auto.js | 31 +++++++-- .../toString/calendarname-critical.js | 31 +++++++-- .../prototype/toString/calendarname-never.js | 31 +++++++-- .../toString/calendarname-undefined.js | 31 +++++++-- .../toString/calendarname-wrong-type.js | 20 ++++++ .../prototype/toString/options-undefined.js | 20 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/until/calendar-mismatch.js | 48 +++++++++++++- .../prototype/until/order-of-operations.js | 21 ++++++ .../withCalendar/calendar-case-insensitive.js | 24 ++++++- .../prototype/withCalendar/calendar-number.js | 24 ++++++- .../calendar-string-leap-second.js | 24 ++++++- .../prototype/withCalendar/calendar-string.js | 24 ++++++- .../withCalendar/calendar-temporal-object.js | 24 ++++++- .../withCalendar/calendar-wrong-type.js | 28 +++++++- .../withCalendar/subclassing-ignored.js | 17 +++++ .../PlainDateTime/calendar-wrong-type.js | 3 + ...rgument-propertybag-calendar-wrong-type.js | 6 +- .../PlainDateTime/compare/calendar-ignored.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../PlainDateTime/from/order-of-operations.js | 23 ++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/equals/calendar-checked.js | 63 +++++++++++++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../since/different-calendars-throws.js | 24 ++++++- .../prototype/since/order-of-operations.js | 21 ++++++ .../prototype/toString/calendar-tostring.js | 22 ++++++- .../prototype/toString/calendarname-always.js | 31 +++++++-- .../prototype/toString/calendarname-auto.js | 31 +++++++-- .../toString/calendarname-critical.js | 31 +++++++-- .../prototype/toString/calendarname-never.js | 31 +++++++-- .../toString/calendarname-undefined.js | 31 +++++++-- .../toString/calendarname-wrong-type.js | 20 ++++++ .../prototype/toString/options-undefined.js | 20 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../until/different-calendars-throws.js | 24 ++++++- .../prototype/until/order-of-operations.js | 21 ++++++ .../prototype/withCalendar/argument-string.js | 23 ++++++- .../withCalendar/calendar-case-insensitive.js | 24 ++++++- .../prototype/withCalendar/calendar-number.js | 24 ++++++- .../calendar-string-leap-second.js | 24 ++++++- .../prototype/withCalendar/calendar-string.js | 24 ++++++- .../withCalendar/calendar-temporal-object.js | 24 ++++++- .../withCalendar/calendar-wrong-type.js | 28 +++++++- .../withCalendar/subclassing-ignored.js | 17 +++++ .../argument-plaindate-calendar-noniso.js | 18 ++++- .../argument-plaindate-calendar-same-id.js | 40 ++++++++++- ...argument-plaindate-calendar-same-object.js | 18 ++++- .../argument-plaindate-calendar.js | 18 ++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../argument-string-iso-calendar.js | 18 ++++- .../non-compatible-calendars-throw.js | 25 +++++++ .../PlainMonthDay/calendar-wrong-type.js | 3 + ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../PlainMonthDay/from/order-of-operations.js | 21 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/equals/calendars.js | 23 ++++++- .../prototype/toJSON/calendarname.js | 31 +++++++-- .../prototype/toString/calendar-tostring.js | 22 ++++++- .../prototype/toString/calendarname-always.js | 31 +++++++-- .../prototype/toString/calendarname-auto.js | 31 +++++++-- .../toString/calendarname-critical.js | 31 +++++++-- .../prototype/toString/calendarname-never.js | 31 +++++++-- .../toString/calendarname-undefined.js | 31 +++++++-- .../toString/calendarname-wrong-type.js | 20 ++++++ .../prototype/toString/options-undefined.js | 31 +++++++-- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../PlainYearMonth/calendar-wrong-type.js | 3 + ...rgument-propertybag-calendar-wrong-type.js | 6 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../from/order-of-operations.js | 23 ++++++- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/since/order-of-operations.js | 21 ++++++ .../prototype/toString/calendar-tostring.js | 22 ++++++- .../prototype/toString/calendarname-always.js | 31 +++++++-- .../prototype/toString/calendarname-auto.js | 31 +++++++-- .../toString/calendarname-critical.js | 31 +++++++-- .../prototype/toString/calendarname-never.js | 31 +++++++-- .../toString/calendarname-undefined.js | 31 +++++++-- .../toString/calendarname-wrong-type.js | 20 ++++++ .../prototype/toString/options-undefined.js | 20 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/until/order-of-operations.js | 21 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../getInstantFor/order-of-operations.js | 23 ++++++- .../calendar-wrong-type.js | 4 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../ZonedDateTime/calendar-wrong-type.js | 3 + ...rgument-propertybag-calendar-wrong-type.js | 6 +- .../compare/order-of-operations.js | 42 ++++++++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../ZonedDateTime/from/order-of-operations.js | 21 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/equals/order-of-operations.js | 21 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/since/order-of-operations.js | 21 ++++++ .../prototype/toString/calendar-tostring.js | 22 ++++++- .../prototype/toString/calendarname-always.js | 31 +++++++-- .../prototype/toString/calendarname-auto.js | 31 +++++++-- .../toString/calendarname-critical.js | 31 +++++++-- .../prototype/toString/calendarname-never.js | 31 +++++++-- .../toString/calendarname-undefined.js | 31 +++++++-- .../toString/calendarname-wrong-type.js | 20 ++++++ .../prototype/toString/options-undefined.js | 20 ++++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../prototype/until/order-of-operations.js | 21 ++++++ .../withCalendar/calendar-case-insensitive.js | 24 ++++++- .../prototype/withCalendar/calendar-number.js | 24 ++++++- .../calendar-string-leap-second.js | 24 ++++++- .../prototype/withCalendar/calendar-string.js | 24 ++++++- .../withCalendar/calendar-temporal-object.js | 24 ++++++- .../withCalendar/calendar-wrong-type.js | 28 +++++++- .../withCalendar/subclassing-ignored.js | 18 +++++ ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- ...rgument-propertybag-calendar-wrong-type.js | 5 +- .../argument-plaindate-calendar-noniso.js | 18 ++++- .../argument-plaindate-calendar-same-id.js | 38 ++++++++++- ...argument-plaindate-calendar-same-object.js | 18 ++++- .../argument-plaindate-calendar.js | 18 ++++- .../argument-string-iso-calendar.js | 18 ++++- .../withCalendar/calendar-case-insensitive.js | 24 ++++++- .../Temporal/Instant/old/toZonedDateTime.js | 24 ++++++- .../old/trivial-protocol-implementation.js | 42 ++++++++++-- .../UserTimezone/old/subminute-offset.js | 24 ++++++- .../UserTimezone/old/trivial-protocol.js | 24 ++++++- .../UserTimezone/old/trivial-subclass.js | 24 ++++++- .../Temporal/ZonedDateTime/old/compare.js | 24 ++++++- .../old/construction-and-properties.js | 8 +++ .../Temporal/ZonedDateTime/old/equals.js | 18 +++++ .../Temporal/ZonedDateTime/old/since.js | 24 ++++++- .../Temporal/ZonedDateTime/old/toPlainDate.js | 24 ++++++- .../ZonedDateTime/old/toPlainMonthDay.js | 16 +++++ .../ZonedDateTime/old/toPlainYearMonth.js | 16 +++++ .../Temporal/ZonedDateTime/old/toString.js | 24 ++++++- .../Temporal/ZonedDateTime/old/until.js | 24 ++++++- .../ZonedDateTime/old/withCalendar.js | 24 ++++++- .../ZonedDateTime/old/withPlainDate.js | 48 +++++++++++++- .../ZonedDateTime/old/withTimezone.js | 24 ++++++- 190 files changed, 3422 insertions(+), 303 deletions(-) diff --git a/harness/temporalHelpers.js b/harness/temporalHelpers.js index 769fa3a9d1..66672f558d 100644 --- a/harness/temporalHelpers.js +++ b/harness/temporalHelpers.js @@ -1464,6 +1464,34 @@ var TemporalHelpers = { * objectName is used in the log. */ calendarObserver(calls, objectName, methodOverrides = {}) { + function removeExtraHasPropertyChecks(objectName, calls) { + // Inserting the tracking calendar into the return values of methods + // that we chain up into the ISO calendar for, causes extra HasProperty + // checks, which we observe. This removes them so that we don't leak + // implementation details of the helper into the test code. + assert.sameValue(calls.pop(), `has ${objectName}.yearOfWeek`); + assert.sameValue(calls.pop(), `has ${objectName}.yearMonthFromFields`); + assert.sameValue(calls.pop(), `has ${objectName}.year`); + assert.sameValue(calls.pop(), `has ${objectName}.weekOfYear`); + assert.sameValue(calls.pop(), `has ${objectName}.monthsInYear`); + assert.sameValue(calls.pop(), `has ${objectName}.monthDayFromFields`); + assert.sameValue(calls.pop(), `has ${objectName}.monthCode`); + assert.sameValue(calls.pop(), `has ${objectName}.month`); + assert.sameValue(calls.pop(), `has ${objectName}.mergeFields`); + assert.sameValue(calls.pop(), `has ${objectName}.inLeapYear`); + assert.sameValue(calls.pop(), `has ${objectName}.id`); + assert.sameValue(calls.pop(), `has ${objectName}.fields`); + assert.sameValue(calls.pop(), `has ${objectName}.daysInYear`); + assert.sameValue(calls.pop(), `has ${objectName}.daysInWeek`); + assert.sameValue(calls.pop(), `has ${objectName}.daysInMonth`); + assert.sameValue(calls.pop(), `has ${objectName}.dayOfYear`); + assert.sameValue(calls.pop(), `has ${objectName}.dayOfWeek`); + assert.sameValue(calls.pop(), `has ${objectName}.day`); + assert.sameValue(calls.pop(), `has ${objectName}.dateUntil`); + assert.sameValue(calls.pop(), `has ${objectName}.dateFromFields`); + assert.sameValue(calls.pop(), `has ${objectName}.dateAdd`); + } + const iso8601 = new Temporal.Calendar("iso8601"); const trackingMethods = { dateFromFields(...args) { @@ -1475,7 +1503,9 @@ var TemporalHelpers = { const originalResult = iso8601.dateFromFields(...args); // Replace the calendar in the result with the call-tracking calendar const {isoYear, isoMonth, isoDay} = originalResult.getISOFields(); - return new Temporal.PlainDate(isoYear, isoMonth, isoDay, this); + const result = new Temporal.PlainDate(isoYear, isoMonth, isoDay, this); + removeExtraHasPropertyChecks(objectName, calls); + return result; }, yearMonthFromFields(...args) { calls.push(`call ${objectName}.yearMonthFromFields`); @@ -1486,7 +1516,9 @@ var TemporalHelpers = { const originalResult = iso8601.yearMonthFromFields(...args); // Replace the calendar in the result with the call-tracking calendar const {isoYear, isoMonth, isoDay} = originalResult.getISOFields(); - return new Temporal.PlainYearMonth(isoYear, isoMonth, this, isoDay); + const result = new Temporal.PlainYearMonth(isoYear, isoMonth, this, isoDay); + removeExtraHasPropertyChecks(objectName, calls); + return result; }, monthDayFromFields(...args) { calls.push(`call ${objectName}.monthDayFromFields`); @@ -1497,7 +1529,9 @@ var TemporalHelpers = { const originalResult = iso8601.monthDayFromFields(...args); // Replace the calendar in the result with the call-tracking calendar const {isoYear, isoMonth, isoDay} = originalResult.getISOFields(); - return new Temporal.PlainMonthDay(isoMonth, isoDay, this, isoYear); + const result = new Temporal.PlainMonthDay(isoMonth, isoDay, this, isoYear); + removeExtraHasPropertyChecks(objectName, calls); + return result; }, dateAdd(...args) { calls.push(`call ${objectName}.dateAdd`); @@ -1507,12 +1541,34 @@ var TemporalHelpers = { } const originalResult = iso8601.dateAdd(...args); const {isoYear, isoMonth, isoDay} = originalResult.getISOFields(); - return new Temporal.PlainDate(isoYear, isoMonth, isoDay, this); + const result = new Temporal.PlainDate(isoYear, isoMonth, isoDay, this); + removeExtraHasPropertyChecks(objectName, calls); + return result; }, id: "iso8601", }; // Automatically generate the other methods that don't need any custom code - ["toString", "dateUntil", "era", "eraYear", "year", "month", "monthCode", "day", "daysInMonth", "fields", "mergeFields"].forEach((methodName) => { + [ + "dateUntil", + "day", + "dayOfWeek", + "dayOfYear", + "daysInMonth", + "daysInWeek", + "daysInYear", + "era", + "eraYear", + "fields", + "inLeapYear", + "mergeFields", + "month", + "monthCode", + "monthsInYear", + "toString", + "weekOfYear", + "year", + "yearOfWeek", + ].forEach((methodName) => { trackingMethods[methodName] = function (...args) { calls.push(`call ${formatPropertyName(methodName, objectName)}`); if (methodName in methodOverrides) { diff --git a/test/built-ins/Temporal/Calendar/from/calendar-object.js b/test/built-ins/Temporal/Calendar/from/calendar-object.js index 6a75794694..c63e94ebc2 100644 --- a/test/built-ins/Temporal/Calendar/from/calendar-object.js +++ b/test/built-ins/Temporal/Calendar/from/calendar-object.js @@ -3,9 +3,33 @@ /*--- esid: sec-temporal.calendar.from -description: Converting a plain object to Temporal.Calendar gives the same object +description: > + Converting an object implementing the Calendar protocol to Temporal.Calendar + gives the same object features: [Temporal] ---*/ -const custom = { id: "custom-calendar" }; +const custom = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "custom-calendar", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(Temporal.Calendar.from(custom), custom); diff --git a/test/built-ins/Temporal/Calendar/from/calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/from/calendar-wrong-type.js index 7872409cd7..6a55869885 100644 --- a/test/built-ins/Temporal/Calendar/from/calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/from/calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-wrong-type.js index 9caa340f55..c0632bc6d1 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/order-of-operations.js index 251d8b2b4a..4a8d9c7d41 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/order-of-operations.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/order-of-operations.js @@ -9,8 +9,29 @@ features: [Temporal] ---*/ const expected = [ - // ToTemporalDate → GetTemporalCalendarWithISODefault + // ToTemporalDate → GetTemporalCalendarSlotValueWithISODefault "get date.calendar", + "has date.calendar.dateAdd", + "has date.calendar.dateFromFields", + "has date.calendar.dateUntil", + "has date.calendar.day", + "has date.calendar.dayOfWeek", + "has date.calendar.dayOfYear", + "has date.calendar.daysInMonth", + "has date.calendar.daysInWeek", + "has date.calendar.daysInYear", + "has date.calendar.fields", + "has date.calendar.id", + "has date.calendar.inLeapYear", + "has date.calendar.mergeFields", + "has date.calendar.month", + "has date.calendar.monthCode", + "has date.calendar.monthDayFromFields", + "has date.calendar.monthsInYear", + "has date.calendar.weekOfYear", + "has date.calendar.year", + "has date.calendar.yearMonthFromFields", + "has date.calendar.yearOfWeek", // ToTemporalDate → CalendarFields "get date.calendar.fields", "call date.calendar.fields", diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-wrong-type.js index 4dc24ee7a3..2ed2dbc256 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-wrong-type.js @@ -18,7 +18,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -29,8 +28,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/order-of-operations.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/order-of-operations.js index 4c1d8ec6fa..0f0adbf439 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateUntil/order-of-operations.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/order-of-operations.js @@ -9,8 +9,29 @@ features: [Temporal] ---*/ const expected = [ - // ToTemporalDate 1 → GetTemporalCalendarWithISODefault + // ToTemporalDate 1 → GetTemporalCalendarSlotValueWithISODefault "get one.calendar", + "has one.calendar.dateAdd", + "has one.calendar.dateFromFields", + "has one.calendar.dateUntil", + "has one.calendar.day", + "has one.calendar.dayOfWeek", + "has one.calendar.dayOfYear", + "has one.calendar.daysInMonth", + "has one.calendar.daysInWeek", + "has one.calendar.daysInYear", + "has one.calendar.fields", + "has one.calendar.id", + "has one.calendar.inLeapYear", + "has one.calendar.mergeFields", + "has one.calendar.month", + "has one.calendar.monthCode", + "has one.calendar.monthDayFromFields", + "has one.calendar.monthsInYear", + "has one.calendar.weekOfYear", + "has one.calendar.year", + "has one.calendar.yearMonthFromFields", + "has one.calendar.yearOfWeek", // ToTemporalDate 1 → CalendarFields "get one.calendar.fields", "call one.calendar.fields", @@ -30,8 +51,29 @@ const expected = [ // ToTemporalDate 1 → CalendarDateFromFields "get one.calendar.dateFromFields", "call one.calendar.dateFromFields", - // ToTemporalDate 2 → GetTemporalCalendarWithISODefault + // ToTemporalDate 2 → GetTemporalCalendarSlotValueWithISODefault "get two.calendar", + "has two.calendar.dateAdd", + "has two.calendar.dateFromFields", + "has two.calendar.dateUntil", + "has two.calendar.day", + "has two.calendar.dayOfWeek", + "has two.calendar.dayOfYear", + "has two.calendar.daysInMonth", + "has two.calendar.daysInWeek", + "has two.calendar.daysInYear", + "has two.calendar.fields", + "has two.calendar.id", + "has two.calendar.inLeapYear", + "has two.calendar.mergeFields", + "has two.calendar.month", + "has two.calendar.monthCode", + "has two.calendar.monthDayFromFields", + "has two.calendar.monthsInYear", + "has two.calendar.weekOfYear", + "has two.calendar.year", + "has two.calendar.yearMonthFromFields", + "has two.calendar.yearOfWeek", // ToTemporalDate 2 → CalendarFields "get two.calendar.fields", "call two.calendar.fields", diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-wrong-type.js index 1baae3e298..60436f3750 100644 --- a/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-wrong-type.js index 1c944627a9..c06e3be28d 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-wrong-type.js index 382e9fcb02..fb9ba32805 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-wrong-type.js index fd65933dbe..973239dde5 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-wrong-type.js index 2906c14d96..c477521753 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-wrong-type.js index 4d97f3a344..269a2b866a 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-wrong-type.js index e54562774d..10f3bd720e 100644 --- a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-wrong-type.js index fffbdfe7d5..fea4186a6b 100644 --- a/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-wrong-type.js index cfc0a004e2..9aeba9cb55 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-wrong-type.js index d35ea5b308..7e8647a1d6 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-wrong-type.js index fa47542e17..f3c8160d01 100644 --- a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-wrong-type.js index 47a4c42a18..a06cd4c751 100644 --- a/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-propertybag-calendar-wrong-type.js index 96d68de0ca..9c8e0c113f 100644 --- a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/Duration/compare/order-of-operations.js b/test/built-ins/Temporal/Duration/compare/order-of-operations.js index b760ae7f11..ba30751645 100644 --- a/test/built-ins/Temporal/Duration/compare/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/compare/order-of-operations.js @@ -88,6 +88,27 @@ actual.splice(0); // clear const expectedOpsForPlainRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", @@ -153,6 +174,27 @@ actual.splice(0); // clear const expectedOpsForZonedRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", diff --git a/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js index e07bc7347e..691357750e 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js @@ -71,6 +71,27 @@ actual.splice(0); // clear const expectedOpsForPlainRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", // PrepareTemporalFields @@ -135,6 +156,27 @@ actual.splice(0); // clear const expectedOpsForZonedRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", // PrepareTemporalFields diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-wrong-type.js index 17f4005e08..91cc575b54 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-wrong-type.js @@ -18,7 +18,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], [Temporal.PlainDate, "Temporal.PlainDate, object"], [Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"], [Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"], diff --git a/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js index 02055c0870..a1f899330d 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js @@ -48,6 +48,27 @@ const expectedOpsForPlainRelativeTo = [ "call options.largestUnit.toString", "get options.relativeTo", "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", @@ -230,6 +251,27 @@ const expectedOpsForZonedRelativeTo = [ "call options.largestUnit.toString", "get options.relativeTo", "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type.js index 92101c6f91..0a6adffc58 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type.js @@ -18,7 +18,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], [Temporal.PlainDate, "Temporal.PlainDate, object"], [Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"], [Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"], diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js index 8d96ee6a20..5b9dcf3dd2 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js @@ -71,6 +71,27 @@ actual.splice(0); // clear const expectedOpsForPlainRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", // PrepareTemporalFields @@ -135,6 +156,27 @@ actual.splice(0); // clear const expectedOpsForZonedRelativeTo = expected.concat([ // ToRelativeTemporalObject "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", // PrepareTemporalFields diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-wrong-type.js index 2aa220661a..5a9b7ca127 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-wrong-type.js @@ -18,7 +18,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], [Temporal.PlainDate, "Temporal.PlainDate, object"], [Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"], [Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"], diff --git a/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js index 57196df4fc..1a73a151bb 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js @@ -36,6 +36,27 @@ const expectedOpsForPlainRelativeTo = [ // ToRelativeTemporalObject "get options.relativeTo", "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", @@ -143,6 +164,27 @@ const expectedOpsForZonedRelativeTo = [ // ToRelativeTemporalObject "get options.relativeTo", "get options.relativeTo.calendar", + "has options.relativeTo.calendar.dateAdd", + "has options.relativeTo.calendar.dateFromFields", + "has options.relativeTo.calendar.dateUntil", + "has options.relativeTo.calendar.day", + "has options.relativeTo.calendar.dayOfWeek", + "has options.relativeTo.calendar.dayOfYear", + "has options.relativeTo.calendar.daysInMonth", + "has options.relativeTo.calendar.daysInWeek", + "has options.relativeTo.calendar.daysInYear", + "has options.relativeTo.calendar.fields", + "has options.relativeTo.calendar.id", + "has options.relativeTo.calendar.inLeapYear", + "has options.relativeTo.calendar.mergeFields", + "has options.relativeTo.calendar.month", + "has options.relativeTo.calendar.monthCode", + "has options.relativeTo.calendar.monthDayFromFields", + "has options.relativeTo.calendar.monthsInYear", + "has options.relativeTo.calendar.weekOfYear", + "has options.relativeTo.calendar.year", + "has options.relativeTo.calendar.yearMonthFromFields", + "has options.relativeTo.calendar.yearOfWeek", "get options.relativeTo.calendar.fields", "call options.relativeTo.calendar.fields", "get options.relativeTo.day", diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-wrong-type.js index 858661c01e..a495c04dd0 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-wrong-type.js @@ -18,7 +18,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], [Temporal.PlainDate, "Temporal.PlainDate, object"], [Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"], [Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"], diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-wrong-type.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-wrong-type.js index dbac639c89..515f292b0e 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-wrong-type.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-wrong-type.js @@ -17,7 +17,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -26,6 +25,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-wrong-type.js b/test/built-ins/Temporal/Now/plainDate/calendar-wrong-type.js index be8b7ddd03..e45fa6a81b 100644 --- a/test/built-ins/Temporal/Now/plainDate/calendar-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDate/calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js index 1b668fc535..e7c560d056 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js @@ -17,6 +17,27 @@ const expected = [ ]; const calendar = function() {}; +calendar.dateAdd = () => {}; +calendar.dateFromFields = () => {}; +calendar.dateUntil = () => {}; +calendar.day = () => {}; +calendar.dayOfWeek = () => {}; +calendar.dayOfYear = () => {}; +calendar.daysInMonth = () => {}; +calendar.daysInWeek = () => {}; +calendar.daysInYear = () => {}; +calendar.fields = () => {}; +calendar.id = "test-calendar"; +calendar.inLeapYear = () => {}; +calendar.mergeFields = () => {}; +calendar.month = () => {}; +calendar.monthCode = () => {}; +calendar.monthDayFromFields = () => {}; +calendar.monthsInYear = () => {}; +calendar.weekOfYear = () => {}; +calendar.year = () => {}; +calendar.yearMonthFromFields = () => {}; +calendar.yearOfWeek = () => {}; const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-object.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-object.js index 0d7b3cdb1b..15cbeec9be 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-object.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-object.js @@ -9,6 +9,29 @@ features: [Proxy, Temporal] ---*/ const actual = []; +const expected = [ + "has calendar.dateAdd", + "has calendar.dateFromFields", + "has calendar.dateUntil", + "has calendar.day", + "has calendar.dayOfWeek", + "has calendar.dayOfYear", + "has calendar.daysInMonth", + "has calendar.daysInWeek", + "has calendar.daysInYear", + "has calendar.fields", + "has calendar.id", + "has calendar.inLeapYear", + "has calendar.mergeFields", + "has calendar.month", + "has calendar.monthCode", + "has calendar.monthDayFromFields", + "has calendar.monthsInYear", + "has calendar.weekOfYear", + "has calendar.year", + "has calendar.yearMonthFromFields", + "has calendar.yearOfWeek", +]; const calendar = TemporalHelpers.calendarObserver(actual, "calendar", { toString: "iso8601", @@ -23,4 +46,4 @@ Object.defineProperty(Temporal.Calendar, 'from', { Temporal.Now.plainDateTime(calendar); -assert.compareArray(actual, [], 'no observable operations should be invoked'); +assert.compareArray(actual, expected, 'order of observable operations'); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-wrong-type.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-wrong-type.js index b9542a0a53..aa561c82c5 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js index ce0ce37aee..01911ec748 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js @@ -14,6 +14,27 @@ const expected = [ ]; const calendar = function() {}; +calendar.dateAdd = () => {}; +calendar.dateFromFields = () => {}; +calendar.dateUntil = () => {}; +calendar.day = () => {}; +calendar.dayOfWeek = () => {}; +calendar.dayOfYear = () => {}; +calendar.daysInMonth = () => {}; +calendar.daysInWeek = () => {}; +calendar.daysInYear = () => {}; +calendar.fields = () => {}; +calendar.id = "test-calendar"; +calendar.inLeapYear = () => {}; +calendar.mergeFields = () => {}; +calendar.month = () => {}; +calendar.monthCode = () => {}; +calendar.monthDayFromFields = () => {}; +calendar.monthsInYear = () => {}; +calendar.weekOfYear = () => {}; +calendar.year = () => {}; +calendar.yearMonthFromFields = () => {}; +calendar.yearOfWeek = () => {}; const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-object.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-object.js index 5a0a398c57..284d58595b 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-object.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-object.js @@ -9,6 +9,29 @@ features: [Proxy, Temporal] ---*/ const actual = []; +const expected = [ + "has calendar.dateAdd", + "has calendar.dateFromFields", + "has calendar.dateUntil", + "has calendar.day", + "has calendar.dayOfWeek", + "has calendar.dayOfYear", + "has calendar.daysInMonth", + "has calendar.daysInWeek", + "has calendar.daysInYear", + "has calendar.fields", + "has calendar.id", + "has calendar.inLeapYear", + "has calendar.mergeFields", + "has calendar.month", + "has calendar.monthCode", + "has calendar.monthDayFromFields", + "has calendar.monthsInYear", + "has calendar.weekOfYear", + "has calendar.year", + "has calendar.yearMonthFromFields", + "has calendar.yearOfWeek", +]; const calendar = TemporalHelpers.calendarObserver(actual, "calendar", { toString: "iso8601", @@ -23,4 +46,4 @@ Object.defineProperty(Temporal.Calendar, 'from', { Temporal.Now.zonedDateTime(calendar); -assert.compareArray(actual, [], 'no observable operations should be invoked'); +assert.compareArray(actual, expected, 'order of observable operations'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-wrong-type.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-wrong-type.js index b781ccc616..ce7bbc1b79 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-wrong-type.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainDate/calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/calendar-wrong-type.js index 10370ab28d..f79b226b84 100644 --- a/test/built-ins/Temporal/PlainDate/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/calendar-wrong-type.js @@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-wrong-type.js index 1b017b5114..964b88e9d8 100644 --- a/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -26,8 +25,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-wrong-type.js index 9981cc213f..c2e3954b75 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-wrong-type.js @@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDate/from/order-of-operations.js b/test/built-ins/Temporal/PlainDate/from/order-of-operations.js index 4bcfc4f941..e0f621e891 100644 --- a/test/built-ins/Temporal/PlainDate/from/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDate/from/order-of-operations.js @@ -10,6 +10,27 @@ features: [Temporal] const expected = [ "get fields.calendar", + "has fields.calendar.dateAdd", + "has fields.calendar.dateFromFields", + "has fields.calendar.dateUntil", + "has fields.calendar.day", + "has fields.calendar.dayOfWeek", + "has fields.calendar.dayOfYear", + "has fields.calendar.daysInMonth", + "has fields.calendar.daysInWeek", + "has fields.calendar.daysInYear", + "has fields.calendar.fields", + "has fields.calendar.id", + "has fields.calendar.inLeapYear", + "has fields.calendar.mergeFields", + "has fields.calendar.month", + "has fields.calendar.monthCode", + "has fields.calendar.monthDayFromFields", + "has fields.calendar.monthsInYear", + "has fields.calendar.weekOfYear", + "has fields.calendar.year", + "has fields.calendar.yearMonthFromFields", + "has fields.calendar.yearOfWeek", "get fields.calendar.fields", "call fields.calendar.fields", "get fields.day", diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid.js index 6618587e64..a20357f64d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid.js +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid.js @@ -11,6 +11,28 @@ const instance = new Temporal.PlainDate(2000, 5, 2); assert.sameValue(instance.equals({ year: 2000, month: 5, day: 2 }), true, "same date"); assert.sameValue(instance.equals({ year: 2000, month: 5, day: 4 }), false, "different date"); -const calendar = { id: "a" }; +const calendar = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "a", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(instance.withCalendar(calendar).equals({ year: 2000, month: 5, day: 2 }), false, "different calendar"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-wrong-type.js index d95c767789..13863fc0ea 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string.js index 60df5994a4..9919d17563 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string.js @@ -11,5 +11,27 @@ const instance = new Temporal.PlainDate(2000, 5, 2); assert.sameValue(instance.equals("2000-05-02"), true, "same date"); assert.sameValue(instance.equals("2000-05-04"), false, "different date"); -const calendar = { id: "a" }; +const calendar = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "a", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(instance.withCalendar(calendar).equals("2000-05-02"), false, "different calendar"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-wrong-type.js index 0c05fc81a0..13329b6270 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/calendar-mismatch.js b/test/built-ins/Temporal/PlainDate/prototype/since/calendar-mismatch.js index 9aa410c325..f8226f5f9c 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/calendar-mismatch.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/calendar-mismatch.js @@ -7,8 +7,52 @@ description: RangeError thrown if calendars' id properties do not match features: [Temporal] ---*/ -const calendar1 = { id: "A" }; -const calendar2 = { id: "B" }; +const calendar1 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "A", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; +const calendar2 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "B", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1); const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js index 9cdb7e2c38..cccbaf230c 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalDate "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendar-tostring.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendar-tostring.js index a2f4eea8c8..e8f0edb700 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendar-tostring.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendar-tostring.js @@ -16,7 +16,27 @@ const customCalendar = { }, toString() { TemporalHelpers.assertUnreachable('toString should not be called'); - } + }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const date = new Temporal.PlainDate(2000, 5, 2, customCalendar); [ diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-always.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-always.js index 6bfa0bd3f6..a5621276a5 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-always.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-always.js @@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included. 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[u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "2000-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-02[u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-02[u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-auto.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-auto.js index 3831f1dbe0..77e8c5dd4d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-auto.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-auto.js @@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" 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" }], "2000-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-critical.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-critical.js index 3a9b6198f6..dc3d37b756 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-critical.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-critical.js @@ -9,12 +9,35 @@ description: > 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[!u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "2000-05-02[!u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-02[!u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-02[!u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-02[!u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-02[!u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[!u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js index cb64db7540..1d25028717 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js @@ -7,12 +7,35 @@ 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" }], "2000-05-02", "custom"], - [[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-02", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-02", "custom with dotless i id"], + [[{ 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) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js index 84c74e6486..fac29dcf86 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js @@ -14,12 +14,35 @@ info: | 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" }], "2000-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-wrong-type.js index fae8c092a3..d3718951bf 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-wrong-type.js @@ -17,6 +17,26 @@ features: [Temporal] const calendar = { id: "custom", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const date = new Temporal.PlainDate(2000, 5, 2, calendar); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js b/test/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js index 6d466fc084..416b42fc2b 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js @@ -8,7 +8,27 @@ 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); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-wrong-type.js index 932a2ae0bf..9b59cff47d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/calendar-mismatch.js b/test/built-ins/Temporal/PlainDate/prototype/until/calendar-mismatch.js index 47166ce104..05c96de8c9 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/calendar-mismatch.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/calendar-mismatch.js @@ -7,8 +7,52 @@ description: RangeError thrown if calendars' id properties do not match features: [Temporal] ---*/ -const calendar1 = { id: "A" }; -const calendar2 = { id: "B" }; +const calendar1 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "A", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; +const calendar2 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "B", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1); const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js index 81f9c65d45..602f08936e 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalDate "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js index cf154ed3d1..511b0df4f4 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-case-insensitive.js @@ -7,7 +7,29 @@ description: Calendar names are case-insensitive features: [Temporal] ---*/ -const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); +const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iSo8601"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js index 430b624754..750acb3230 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-number.js @@ -7,7 +7,29 @@ description: A number is converted to a string, then to Temporal.Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); +const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = 19761118; diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js index 1adf612825..604f608538 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string-leap-second.js @@ -7,7 +7,29 @@ description: Leap second is a valid ISO string for Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); +const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "2016-12-31T23:59:60"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js index 39de48ee28..90a2149df6 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js @@ -7,7 +7,29 @@ description: A calendar ID is valid input for Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); +const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iso8601"; diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js index 2bd9587d6b..24ba4c7d1e 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js @@ -31,7 +31,29 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }, }); - const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); + const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const result = instance.withCalendar(arg); assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-wrong-type.js index 8e7c894d42..95df5e7cc5 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-wrong-type.js @@ -9,7 +9,29 @@ description: > features: [BigInt, Symbol, Temporal] ---*/ -const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); +const instance = new Temporal.PlainDate(1976, 11, 18, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const rangeErrorTests = [ [null, "null"], @@ -17,7 +39,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -26,6 +47,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js index 0849422f4d..5c0595831d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js @@ -15,7 +15,24 @@ const customCalendar = { month() { return 2; }, monthCode() { return "M02"; }, day() { return 5; }, + id: "custom-calendar", toString() { return "custom-calendar"; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; TemporalHelpers.checkSubclassingIgnored( diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/calendar-wrong-type.js index 61fc252ddc..4cdea027e4 100644 --- a/test/built-ins/Temporal/PlainDateTime/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/calendar-wrong-type.js @@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-wrong-type.js index 0af17c1f57..a1c9159a0a 100644 --- a/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -26,8 +25,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/compare/calendar-ignored.js b/test/built-ins/Temporal/PlainDateTime/compare/calendar-ignored.js index 9f197ae0a6..42b53741fa 100644 --- a/test/built-ins/Temporal/PlainDateTime/compare/calendar-ignored.js +++ b/test/built-ins/Temporal/PlainDateTime/compare/calendar-ignored.js @@ -4,11 +4,12 @@ /*--- esid: sec-temporal.plaindatetime.compare description: Calendar is not taken into account for the comparison. +includes: [temporalHelpers.js] features: [Temporal] ---*/ -const calendar1 = { toString() { throw new Test262Error("should not call calendar1.toString") } }; -const calendar2 = { toString() { throw new Test262Error("should not call calendar2.toString") } }; +const calendar1 = TemporalHelpers.calendarThrowEverything(); +const calendar2 = TemporalHelpers.calendarThrowEverything(); const dt1 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar1); const dt2 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1); const dt3 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-wrong-type.js index 4cc700e618..095682c77b 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-wrong-type.js @@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/from/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/from/order-of-operations.js index fa7519926e..ad11f628b9 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/from/order-of-operations.js @@ -9,8 +9,29 @@ features: [Temporal] ---*/ const expected = [ - // GetTemporalCalendarWithISODefault + // GetTemporalCalendarSlotValueWithISODefault "get fields.calendar", + "has fields.calendar.dateAdd", + "has fields.calendar.dateFromFields", + "has fields.calendar.dateUntil", + "has fields.calendar.day", + "has fields.calendar.dayOfWeek", + "has fields.calendar.dayOfYear", + "has fields.calendar.daysInMonth", + "has fields.calendar.daysInWeek", + "has fields.calendar.daysInYear", + "has fields.calendar.fields", + "has fields.calendar.id", + "has fields.calendar.inLeapYear", + "has fields.calendar.mergeFields", + "has fields.calendar.month", + "has fields.calendar.monthCode", + "has fields.calendar.monthDayFromFields", + "has fields.calendar.monthsInYear", + "has fields.calendar.weekOfYear", + "has fields.calendar.year", + "has fields.calendar.yearMonthFromFields", + "has fields.calendar.yearOfWeek", // CalendarFields "get fields.calendar.fields", "call fields.calendar.fields", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js index fcaea3bf00..b98b48b43e 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/calendar-checked.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/calendar-checked.js index 66db938217..bd13a76186 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/equals/calendar-checked.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/calendar-checked.js @@ -11,7 +11,28 @@ features: [Temporal] const actual = []; function makeCalendar(id, objectName) { - const calendar = {}; + const calendar = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, + }; TemporalHelpers.observeProperty(actual, calendar, "id", id, objectName); return calendar; } @@ -36,10 +57,50 @@ assert.sameValue(dt1.equals(dt3), false, "different calendar string"); assert.compareArray(actual, ["get calendar1.id", "get calendar3.id"]); const calendar4 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, get id() { TemporalHelpers.assertUnreachable('should not get calendar4.id'); }, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const calendar5 = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, get id() { TemporalHelpers.assertUnreachable('should not get calendar5.id'); }, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const dt4 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar4); const dt5 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar4); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js index 7107d4e735..65d510b3a2 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/different-calendars-throws.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/different-calendars-throws.js index ecb03f3ae3..19c34416c2 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/different-calendars-throws.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/different-calendars-throws.js @@ -8,7 +8,29 @@ features: [Temporal] ---*/ const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0); -const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { id: "custom" }); +const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "custom", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); assert.throws( RangeError, diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js index d49a3e0694..e1b7deb4e6 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalDateTime "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendar-tostring.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendar-tostring.js index 6671f1dd42..a105b5f513 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendar-tostring.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendar-tostring.js @@ -16,7 +16,27 @@ const customCalendar = { }, toString() { TemporalHelpers.assertUnreachable('toString should not be called'); - } + }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const date = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, customCalendar); [ diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-always.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-always.js index e38c5bf1a7..53659c4644 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-always.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-always.js @@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included. 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 = [ [[], "1976-11-18T15:23:00[u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1976-11-18T15:23:00[u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js index 4886e9e798..31f669617c 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js @@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" 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 = [ [[], "1976-11-18T15:23:00", "built-in ISO"], - [[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js index 7bea217a73..e3face2fc1 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js @@ -9,12 +9,35 @@ description: > 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 = [ [[], "1976-11-18T15:23:00[!u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "1976-11-18T15:23:00[!u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1976-11-18T15:23:00[!u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1976-11-18T15:23:00[!u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[!u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-never.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-never.js index f201e0ffed..5cc5a4d24b 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-never.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-never.js @@ -7,12 +7,35 @@ 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 = [ [[], "1976-11-18T15:23:00", "built-in ISO"], - [[{ id: "custom" }], "1976-11-18T15:23:00", "custom"], - [[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1976-11-18T15:23:00", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1976-11-18T15:23:00", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js index 7b56b83dce..fee3b92005 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js @@ -14,12 +14,35 @@ info: | 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 = [ [[], "1976-11-18T15:23:00", "built-in ISO"], - [[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js index 613d0f3d14..2786a47bb4 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js @@ -17,6 +17,26 @@ features: [Temporal] const calendar = { id: "custom", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/options-undefined.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/options-undefined.js index bc8aa6bc84..daa6083232 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/options-undefined.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/options-undefined.js @@ -8,7 +8,27 @@ 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 datetime1 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0); const datetime2 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0, calendar); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js index c51e57168c..12be4ae7ef 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/different-calendars-throws.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/different-calendars-throws.js index f5c667a5dc..a644ccbd65 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/different-calendars-throws.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/different-calendars-throws.js @@ -8,7 +8,29 @@ features: [Temporal] ---*/ const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0); -const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { id: "custom" }); +const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "custom", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); assert.throws( RangeError, diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js index 3c00177447..43ea0733d9 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalDateTime "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js index a958430e1d..249c69712f 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/argument-string.js @@ -9,7 +9,28 @@ includes: [temporalHelpers.js] ---*/ const calendar = { - toString() { return "something special"; } + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "something special", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + toString() { return "something special"; }, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const dt = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar); const result = dt.withCalendar("iso8601"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js index 026d8ed46d..9af65170f6 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -7,7 +7,29 @@ description: Calendar names are case-insensitive features: [Temporal] ---*/ -const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iSo8601"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js index adae39f20d..e06e31bd52 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-number.js @@ -7,7 +7,29 @@ description: A number is converted to a string, then to Temporal.Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = 19761118; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js index a883e9879a..e6f877f4ab 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string-leap-second.js @@ -7,7 +7,29 @@ description: Leap second is a valid ISO string for Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "2016-12-31T23:59:60"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js index 35d532b79e..6f570a53b7 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js @@ -7,7 +7,29 @@ description: A calendar ID is valid input for Calendar features: [Temporal] ---*/ -const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iso8601"; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js index 76333c86ae..d7dc089866 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -31,7 +31,29 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }, }); - const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); + const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const result = instance.withCalendar(arg); assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-wrong-type.js index a36bffb011..a6c8fdd6e4 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-wrong-type.js @@ -9,7 +9,29 @@ description: > features: [BigInt, Symbol, Temporal] ---*/ -const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const rangeErrorTests = [ [null, "null"], @@ -17,7 +39,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -26,6 +47,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js index 79463912ef..2cff05a4dc 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js @@ -15,7 +15,24 @@ const customCalendar = { month() { return 2; }, monthCode() { return "M02"; }, day() { return 5; }, + id: "custom-calendar", toString() { return "custom-calendar"; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; TemporalHelpers.checkSubclassingIgnored( diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js index 7fbc3e41e0..c578cfd538 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0); assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js index 3d06dce97e..bfe7155e35 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js @@ -10,7 +10,27 @@ includes: [temporalHelpers.js] const cal1 = { id: "this is a string", - toString() { return "this is another string"; } + toString() { return "this is another string"; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const cal2 = { id: "this is a string", @@ -20,7 +40,23 @@ const cal2 = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal1); const pd = new Temporal.PlainDate(2010, 11, 12, cal2); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js index 53b7ddacb8..f57041ffb4 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js @@ -20,7 +20,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12, cal); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js index bc8d9a927c..6544aafdab 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js index a8dbe64756..9d5c5491ec 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js index 5432793271..5cec5467a7 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const shifted = dt.withPlainDate("2010-11-12"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/non-compatible-calendars-throw.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/non-compatible-calendars-throw.js index 9e3920d2bb..4a691cf608 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/non-compatible-calendars-throw.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/non-compatible-calendars-throw.js @@ -7,9 +7,33 @@ description: If two non-ISO calendars are involved, an error is raised 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 cal = { id: "foo", toString() { return "this is a string"; }, + ...calendarMethods, }; const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); @@ -17,6 +41,7 @@ const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const anotherCal = { id: "bar", toString() { return "this is another string"; }, + ...calendarMethods, }; const date = new Temporal.PlainDate(2008, 9, 6, anotherCal); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-wrong-type.js b/test/built-ins/Temporal/PlainMonthDay/calendar-wrong-type.js index d2f3038539..f05d07c4e9 100644 --- a/test/built-ins/Temporal/PlainMonthDay/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-wrong-type.js @@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-wrong-type.js index 723ad5a904..8464fa0729 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-wrong-type.js @@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainMonthDay/from/order-of-operations.js b/test/built-ins/Temporal/PlainMonthDay/from/order-of-operations.js index 0c31a12beb..043b3461ce 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/order-of-operations.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/order-of-operations.js @@ -10,6 +10,27 @@ features: [Temporal] const expected = [ "get fields.calendar", + "has fields.calendar.dateAdd", + "has fields.calendar.dateFromFields", + "has fields.calendar.dateUntil", + "has fields.calendar.day", + "has fields.calendar.dayOfWeek", + "has fields.calendar.dayOfYear", + "has fields.calendar.daysInMonth", + "has fields.calendar.daysInWeek", + "has fields.calendar.daysInYear", + "has fields.calendar.fields", + "has fields.calendar.id", + "has fields.calendar.inLeapYear", + "has fields.calendar.mergeFields", + "has fields.calendar.month", + "has fields.calendar.monthCode", + "has fields.calendar.monthDayFromFields", + "has fields.calendar.monthsInYear", + "has fields.calendar.weekOfYear", + "has fields.calendar.year", + "has fields.calendar.yearMonthFromFields", + "has fields.calendar.yearOfWeek", // CalendarFields "get fields.calendar.fields", "call fields.calendar.fields", diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-wrong-type.js index c22cbfea50..57b2933e85 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/calendars.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/calendars.js index 0ae2a49a3a..33ea114706 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/calendars.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/calendars.js @@ -14,7 +14,28 @@ const expected = [ ]; const actual = []; const calendar = (id) => { - const c = {}; + const c = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, + }; TemporalHelpers.observeProperty(actual, c, "id", id, `calendar ${id}`); return c; }; diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js index c2b26f5cd7..d5606782a7 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js @@ -7,12 +7,35 @@ description: toJSON doesn't take calendarName into account. 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 = [ [[], "05-02"], - [[{ id: "custom" }], "1972-05-02[u-ca=custom]"], - [[{ id: "iso8601" }], "05-02"], - [[{ id: "ISO8601" }], "1972-05-02[u-ca=ISO8601]"], - [[{ id: "\u0131so8601" }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i + [[{ id: "custom", ...calendarMethods }], "1972-05-02[u-ca=custom]"], + [[{ id: "iso8601", ...calendarMethods }], "05-02"], + [[{ id: "ISO8601", ...calendarMethods }], "1972-05-02[u-ca=ISO8601]"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i ]; const options = { get calendarName() { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendar-tostring.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendar-tostring.js index 76357fea1f..f48201eb7d 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendar-tostring.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendar-tostring.js @@ -16,7 +16,27 @@ const customCalendar = { }, toString() { TemporalHelpers.assertUnreachable('toString should not be called'); - } + }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const monthday = new Temporal.PlainMonthDay(5, 2, customCalendar); [ diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js index bcffe3ecb5..c5a3fe2d16 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js @@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included. 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" }], "1972-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1972-05-02[u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1972-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1972-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ 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) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-auto.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-auto.js index 414312817c..7ab7659c84 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-auto.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-auto.js @@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" 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 = [ [[], "05-02", "built-in ISO"], - [[{ id: "custom" }], "1972-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1972-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1972-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1972-05-02[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "05-02", "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) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js index 06bbb45d6d..60d26a57d0 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-critical.js @@ -9,12 +9,35 @@ description: > 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" }], "1972-05-02[!u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1972-05-02[!u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1972-05-02[!u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1972-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ 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) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js index dc7b3bcc76..50e0459576 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js @@ -7,12 +7,35 @@ 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 = [ [[], "05-02", "built-in ISO"], - [[{ id: "custom" }], "1972-05-02", "custom"], - [[{ id: "iso8601" }], "05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1972-05-02", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1972-05-02", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1972-05-02", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "05-02", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1972-05-02", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1972-05-02", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-undefined.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-undefined.js index bb93009943..67c1d3a628 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-undefined.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-undefined.js @@ -14,12 +14,35 @@ info: | 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 = [ [[], "05-02", "built-in ISO"], - [[{ id: "custom" }], "1972-05-02[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "05-02", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1972-05-02[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1972-05-02[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1972-05-02[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "05-02", "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) { diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-wrong-type.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-wrong-type.js index 4a733f3709..efbc3a6138 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-wrong-type.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-wrong-type.js @@ -17,6 +17,26 @@ features: [Temporal] const calendar = { id: "custom", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const monthday = new Temporal.PlainMonthDay(5, 2, calendar); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/options-undefined.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/options-undefined.js index abeafa5a49..73b5c8361b 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toString/options-undefined.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toString/options-undefined.js @@ -7,12 +7,35 @@ description: Verify that undefined options are handled correctly. 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 = [ [[], "05-02"], - [[{ id: "custom" }], "1972-05-02[u-ca=custom]"], - [[{ id: "iso8601" }], "05-02"], - [[{ id: "ISO8601" }], "1972-05-02[u-ca=ISO8601]"], - [[{ id: "\u0131so8601" }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i + [[{ id: "custom", ...calendarMethods }], "1972-05-02[u-ca=custom]"], + [[{ id: "iso8601", ...calendarMethods }], "05-02"], + [[{ id: "ISO8601", ...calendarMethods }], "1972-05-02[u-ca=ISO8601]"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1972-05-02[u-ca=\u0131so8601]"], // dotless i ]; for (const [args, expected] of tests) { diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-wrong-type.js index 386a609505..14aaad26d4 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-wrong-type.js index 08459e393d..6b05bed91d 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/calendar-wrong-type.js index 3ca821d0b5..0df4de7aee 100644 --- a/test/built-ins/Temporal/PlainYearMonth/calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-wrong-type.js @@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-wrong-type.js index bc4538efcb..5d405acc50 100644 --- a/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-wrong-type.js @@ -15,7 +15,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -26,8 +25,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-wrong-type.js index 7d67ec74c0..551c97e3ac 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-wrong-type.js @@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/from/order-of-operations.js b/test/built-ins/Temporal/PlainYearMonth/from/order-of-operations.js index 158ff5aaac..a641a5786c 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/order-of-operations.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/order-of-operations.js @@ -9,8 +9,29 @@ features: [Temporal] ---*/ const expected = [ - // GetTemporalCalendarWithISODefault + // GetTemporalCalendarSlotValueWithISODefault "get fields.calendar", + "has fields.calendar.dateAdd", + "has fields.calendar.dateFromFields", + "has fields.calendar.dateUntil", + "has fields.calendar.day", + "has fields.calendar.dayOfWeek", + "has fields.calendar.dayOfYear", + "has fields.calendar.daysInMonth", + "has fields.calendar.daysInWeek", + "has fields.calendar.daysInYear", + "has fields.calendar.fields", + "has fields.calendar.id", + "has fields.calendar.inLeapYear", + "has fields.calendar.mergeFields", + "has fields.calendar.month", + "has fields.calendar.monthCode", + "has fields.calendar.monthDayFromFields", + "has fields.calendar.monthsInYear", + "has fields.calendar.weekOfYear", + "has fields.calendar.year", + "has fields.calendar.yearMonthFromFields", + "has fields.calendar.yearOfWeek", // CalendarFields "get fields.calendar.fields", "call fields.calendar.fields", diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-wrong-type.js index 7214612b12..4448cd36f8 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-wrong-type.js index 2a7a85dbed..364753a840 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js index 7fa21b8732..5cc60b85e0 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalYearMonth "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.month", diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendar-tostring.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendar-tostring.js index f054008db7..da23c65c5e 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendar-tostring.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendar-tostring.js @@ -16,7 +16,27 @@ const customCalendar = { }, toString() { TemporalHelpers.assertUnreachable('toString should not be called'); - } + }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const yearmonth = new Temporal.PlainYearMonth(2000, 5, customCalendar); [ diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js index bf4907ce11..9aaf7f0d76 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js @@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included. 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-01[u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "2000-05-01[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-01[u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-01[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-01[u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-auto.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-auto.js index 52403a6e8f..c940f67815 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-auto.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-auto.js @@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" 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", "built-in ISO"], - [[{ id: "custom" }], "2000-05-01[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-01[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js index 9685c5e733..cc4aeaea3a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js @@ -9,12 +9,35 @@ description: > 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-01[!u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "2000-05-01[!u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05-01[!u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-01[!u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-01[!u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-01[!u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05-01[!u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-01[!u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-01[!u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-never.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-never.js index 0025f6cd33..9bfe45ec12 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-never.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-never.js @@ -7,12 +7,35 @@ 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", "built-in ISO"], - [[{ id: "custom" }], "2000-05-01", "custom"], - [[{ id: "iso8601" }], "2000-05", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-01", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-01", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-01", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-01", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-01", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js index de744477c9..a8d9717ead 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js @@ -14,12 +14,35 @@ info: | 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", "built-in ISO"], - [[{ id: "custom" }], "2000-05-01[u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "2000-05", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "2000-05-01[u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "2000-05", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "2000-05-01[u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-01[u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js index 8064a4ebe5..df91dd657c 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js @@ -17,6 +17,26 @@ features: [Temporal] const calendar = { id: "custom", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const yearmonth = new Temporal.PlainYearMonth(2000, 5, calendar); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/options-undefined.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/options-undefined.js index 65e309b45e..c84712f2e6 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toString/options-undefined.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toString/options-undefined.js @@ -8,7 +8,27 @@ 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 yearmonth1 = new Temporal.PlainYearMonth(2000, 5); const yearmonth2 = new Temporal.PlainYearMonth(2000, 5, calendar); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-wrong-type.js index d0a69dd11c..760a559d6b 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js index 5ad27b5911..3eb4a0f3bf 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalYearMonth "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.month", diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-wrong-type.js index aed207a98b..6604b51fe7 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/order-of-operations.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/order-of-operations.js index 9dea3ed0b0..02f53ffbba 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/order-of-operations.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/order-of-operations.js @@ -9,8 +9,29 @@ features: [Temporal] ---*/ const expected = [ - // GetTemporalCalendarWithISODefault + // GetTemporalCalendarSlotValueWithISODefault "get fields.calendar", + "has fields.calendar.dateAdd", + "has fields.calendar.dateFromFields", + "has fields.calendar.dateUntil", + "has fields.calendar.day", + "has fields.calendar.dayOfWeek", + "has fields.calendar.dayOfYear", + "has fields.calendar.daysInMonth", + "has fields.calendar.daysInWeek", + "has fields.calendar.daysInYear", + "has fields.calendar.fields", + "has fields.calendar.id", + "has fields.calendar.inLeapYear", + "has fields.calendar.mergeFields", + "has fields.calendar.month", + "has fields.calendar.monthCode", + "has fields.calendar.monthDayFromFields", + "has fields.calendar.monthsInYear", + "has fields.calendar.weekOfYear", + "has fields.calendar.year", + "has fields.calendar.yearMonthFromFields", + "has fields.calendar.yearOfWeek", // CalendarFields "get fields.calendar.fields", "call fields.calendar.fields", diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-wrong-type.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-wrong-type.js index 8ebd2df733..10b657796d 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-wrong-type.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-wrong-type.js @@ -17,7 +17,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -26,6 +25,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-wrong-type.js index 70cb81b475..ac83d439b1 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/calendar-wrong-type.js index 082c904fda..537bcca972 100644 --- a/test/built-ins/Temporal/ZonedDateTime/calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-wrong-type.js @@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-wrong-type.js index 9895596b94..b0a235e939 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-wrong-type.js @@ -17,7 +17,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [calendar, description] of rangeErrorTests) { @@ -28,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js index 209b732b31..1c64febece 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js @@ -10,6 +10,27 @@ features: [Temporal] const expected = [ "get one.calendar", + "has one.calendar.dateAdd", + "has one.calendar.dateFromFields", + "has one.calendar.dateUntil", + "has one.calendar.day", + "has one.calendar.dayOfWeek", + "has one.calendar.dayOfYear", + "has one.calendar.daysInMonth", + "has one.calendar.daysInWeek", + "has one.calendar.daysInYear", + "has one.calendar.fields", + "has one.calendar.id", + "has one.calendar.inLeapYear", + "has one.calendar.mergeFields", + "has one.calendar.month", + "has one.calendar.monthCode", + "has one.calendar.monthDayFromFields", + "has one.calendar.monthsInYear", + "has one.calendar.weekOfYear", + "has one.calendar.year", + "has one.calendar.yearMonthFromFields", + "has one.calendar.yearOfWeek", "get one.calendar.fields", "call one.calendar.fields", // PrepareTemporalFields @@ -60,6 +81,27 @@ const expected = [ "call one.timeZone.getOffsetNanosecondsFor", // Same set of operations, for the other argument: "get two.calendar", + "has two.calendar.dateAdd", + "has two.calendar.dateFromFields", + "has two.calendar.dateUntil", + "has two.calendar.day", + "has two.calendar.dayOfWeek", + "has two.calendar.dayOfYear", + "has two.calendar.daysInMonth", + "has two.calendar.daysInWeek", + "has two.calendar.daysInYear", + "has two.calendar.fields", + "has two.calendar.id", + "has two.calendar.inLeapYear", + "has two.calendar.mergeFields", + "has two.calendar.month", + "has two.calendar.monthCode", + "has two.calendar.monthDayFromFields", + "has two.calendar.monthsInYear", + "has two.calendar.weekOfYear", + "has two.calendar.year", + "has two.calendar.yearMonthFromFields", + "has two.calendar.yearOfWeek", "get two.calendar.fields", "call two.calendar.fields", // PrepareTemporalFields diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-wrong-type.js index a2f28eae44..c2b810525f 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-wrong-type.js @@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js index 7881e8098f..3e9a74abab 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js @@ -10,6 +10,27 @@ features: [Temporal] const expected = [ "get item.calendar", + "has item.calendar.dateAdd", + "has item.calendar.dateFromFields", + "has item.calendar.dateUntil", + "has item.calendar.day", + "has item.calendar.dayOfWeek", + "has item.calendar.dayOfYear", + "has item.calendar.daysInMonth", + "has item.calendar.daysInWeek", + "has item.calendar.daysInYear", + "has item.calendar.fields", + "has item.calendar.id", + "has item.calendar.inLeapYear", + "has item.calendar.mergeFields", + "has item.calendar.month", + "has item.calendar.monthCode", + "has item.calendar.monthDayFromFields", + "has item.calendar.monthsInYear", + "has item.calendar.weekOfYear", + "has item.calendar.year", + "has item.calendar.yearMonthFromFields", + "has item.calendar.yearOfWeek", "get item.calendar.fields", "call item.calendar.fields", // PrepareTemporalFields diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js index 77068d7b0b..a78ed4b4ed 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js index a39fa96637..fb44faa751 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js @@ -10,6 +10,27 @@ features: [Temporal] const expected = [ "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", // PrepareTemporalFields diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js index a084aa6464..d9c064e747 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js index 4e21060db1..e98adf5a88 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalZonedDateTime "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendar-tostring.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendar-tostring.js index 0989026740..3c4b251bed 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendar-tostring.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendar-tostring.js @@ -16,7 +16,27 @@ const customCalendar = { }, toString() { TemporalHelpers.assertUnreachable('toString should not be called'); - } + }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const date = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC", customCalendar); [ diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js index ae6ae4e75d..08d3803acd 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js @@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included. 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 = [ [[], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js index 9ed61ba254..5685d98990 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js @@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" 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 = [ [[], "1970-01-01T01:01:01.987654321+00:00[UTC]", "built-in ISO"], - [[{ id: "custom" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js index e91ff1089c..4cd5f7bcde 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js @@ -9,12 +9,35 @@ description: > 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 = [ [[], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=iso8601]", "built-in ISO"], - [[{ id: "custom" }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=iso8601]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=iso8601]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][!u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js index 5dcd599d56..23d81baa91 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js @@ -7,12 +7,35 @@ 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 = [ [[], "1970-01-01T01:01:01.987654321+00:00[UTC]", "built-in ISO"], - [[{ id: "custom" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom"], - [[{ id: "iso8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js index 3f450028ce..245597ed63 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js @@ -14,12 +14,35 @@ info: | 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 = [ [[], "1970-01-01T01:01:01.987654321+00:00[UTC]", "built-in ISO"], - [[{ id: "custom" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], - [[{ id: "iso8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], - [[{ id: "ISO8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], - [[{ id: "\u0131so8601" }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], + [[{ id: "custom", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=custom]", "custom"], + [[{ id: "iso8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC]", "custom with iso8601 id"], + [[{ id: "ISO8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=ISO8601]", "custom with caps id"], + [[{ id: "\u0131so8601", ...calendarMethods }], "1970-01-01T01:01:01.987654321+00:00[UTC][u-ca=\u0131so8601]", "custom with dotless i id"], ]; for (const [args, expected, description] of tests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type.js index 7bf6434b56..21bca7e70e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type.js @@ -17,6 +17,26 @@ features: [Temporal] const calendar = { id: "custom", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC", calendar); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined.js index e959cf114c..c8ba5fce0f 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined.js @@ -8,7 +8,27 @@ 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 datetime1 = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC"); const datetime2 = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC", calendar); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js index b6063cffe8..b2ab7ba259 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js index a64ddd12eb..cd6c92dd00 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js @@ -11,6 +11,27 @@ features: [Temporal] const expected = [ // ToTemporalZonedDateTime "get other.calendar", + "has other.calendar.dateAdd", + "has other.calendar.dateFromFields", + "has other.calendar.dateUntil", + "has other.calendar.day", + "has other.calendar.dayOfWeek", + "has other.calendar.dayOfYear", + "has other.calendar.daysInMonth", + "has other.calendar.daysInWeek", + "has other.calendar.daysInYear", + "has other.calendar.fields", + "has other.calendar.id", + "has other.calendar.inLeapYear", + "has other.calendar.mergeFields", + "has other.calendar.month", + "has other.calendar.monthCode", + "has other.calendar.monthDayFromFields", + "has other.calendar.monthsInYear", + "has other.calendar.weekOfYear", + "has other.calendar.year", + "has other.calendar.yearMonthFromFields", + "has other.calendar.yearOfWeek", "get other.calendar.fields", "call other.calendar.fields", "get other.day", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js index ab622d768d..5fdfeee782 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -7,7 +7,29 @@ description: Calendar names are case-insensitive features: [Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iSo8601"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js index d72dcd303e..b7a194d787 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-number.js @@ -7,7 +7,29 @@ description: A number is converted to a string, then to Temporal.Calendar features: [Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = 19761118; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js index 8b45f2d65f..8f1dda0f14 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string-leap-second.js @@ -7,7 +7,29 @@ description: Leap second is a valid ISO string for Calendar features: [Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "2016-12-31T23:59:60"; const result = instance.withCalendar(arg); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js index ddf6b9a220..7760408bc9 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js @@ -7,7 +7,29 @@ description: A calendar ID is valid input for Calendar features: [Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "iso8601"; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js index c06a99040b..8ab731918d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js @@ -31,7 +31,29 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT }, }); - const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); + const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const result = instance.withCalendar(arg); assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-wrong-type.js index b159f08d3a..55b122aed4 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-wrong-type.js @@ -9,7 +9,29 @@ description: > features: [BigInt, Symbol, Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const rangeErrorTests = [ [null, "null"], @@ -17,7 +39,6 @@ const rangeErrorTests = [ ["", "empty string"], [1, "number that doesn't convert to a valid ISO string"], [1n, "bigint"], - [new Temporal.TimeZone("UTC"), "time zone instance"], ]; for (const [arg, description] of rangeErrorTests) { @@ -26,6 +47,9 @@ for (const [arg, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], ]; for (const [arg, description] of typeErrorTests) { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js index b032fa8ed6..1bffb6ac9d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js @@ -13,6 +13,24 @@ const customCalendar = { month() { return 2; }, day() { return 5; }, toString() { return "custom-calendar"; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "custom-calendar", + inLeapYear() {}, + mergeFields() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; TemporalHelpers.checkSubclassingIgnored( diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js index c6772c3de7..f1c28a2d2a 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-wrong-type.js b/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-wrong-type.js index 7fffc7a0df..90c4346527 100644 --- a/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-wrong-type.js +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-wrong-type.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-wrong-type.js index 2b8a0938f8..4e9f42a80c 100644 --- a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-wrong-type.js +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-wrong-type.js @@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) { const typeErrorTests = [ [Symbol(), "symbol"], - [{}, "plain object"], // TypeError due to missing dateFromFields() - [Temporal.Calendar, "Temporal.Calendar, object"], // ditto + [{}, "plain object that doesn't implement the protocol"], + [new Temporal.TimeZone("UTC"), "time zone instance"], + [Temporal.Calendar, "Temporal.Calendar, object"], [Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields() ]; diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js index b78a7fcf87..5015812037 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0); assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js index 9e690ec5f0..25a2124c78 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js @@ -11,6 +11,26 @@ includes: [temporalHelpers.js] const cal1 = { id: "this is a string", toString() { return "this is a another string"; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const cal2 = { id: "this is a string", @@ -20,7 +40,23 @@ const cal2 = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal1); const pd = new Temporal.PlainDate(2010, 11, 12, cal2); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js index 8f505ad8b7..c69d3e487b 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js @@ -23,7 +23,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12, cal); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js index 75ed9c3892..3c5e661571 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const pd = new Temporal.PlainDate(2010, 11, 12); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js index 75b409856e..a23fb83aa3 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js @@ -16,7 +16,23 @@ const cal = { year() { return 2008; }, month() { return 9; }, monthCode() { return "M09"; }, - day() { return 6; } + day() { return 6; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + inLeapYear() {}, + mergeFields() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal); const shifted = dt.withPlainDate("2010-11-12"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js b/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js index c94489839a..dd8d0ee48a 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive.js @@ -7,7 +7,29 @@ description: Calendar names are case-insensitive features: [Temporal] ---*/ -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "replace-me", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}); const arg = "jApAnEsE";; const result = instance.withCalendar(arg); diff --git a/test/staging/Temporal/Instant/old/toZonedDateTime.js b/test/staging/Temporal/Instant/old/toZonedDateTime.js index f7fa59fc28..96fa9b5b5a 100644 --- a/test/staging/Temporal/Instant/old/toZonedDateTime.js +++ b/test/staging/Temporal/Instant/old/toZonedDateTime.js @@ -15,7 +15,29 @@ assert.throws(TypeError, () => inst.toZonedDateTime()); // throws with a string parameter assert.throws(TypeError, () => inst.toZonedDateTime("UTC")); -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; // time zone parameter UTC var timeZone = Temporal.TimeZone.from("UTC"); diff --git a/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js b/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js index 13585f5555..fcd2183ba6 100644 --- a/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js +++ b/test/staging/Temporal/UserCalendar/old/trivial-protocol-implementation.js @@ -86,13 +86,41 @@ var obj = { var {days} = isoToDecimal(date); return days % 10 + 1; }, - mergeFields(fields, additionalFields) { - if ("month" in additionalFields || "monthCode" in additionalFields) { - let {month, monthCode, ...rest} = fields; - return {...rest, ...additionalFields}; - } - return {...fields, ...additionalFields}; -} + dateAdd() {}, // left as an exercise for the reader + dateUntil() {}, // ditto + dayOfWeek() { + throw new Error('no weeks'); + }, + dayOfYear(date) { + return isoToDecimal(date).days; + }, + daysInMonth() { + return 10; + }, + daysInWeek() { + throw new Error('no weeks'); + }, + daysInYear() { + return 100; + }, + fields(fields) { + return fields; + }, + inLeapYear() { + return false; + }, + mergeFields(fields, additional) { + return new Temporal.Calendar("iso8601").mergeFields(fields, additional) + }, + monthsInYear() { + return 10; + }, + weekOfYear() { + throw new Error('no weeks'); + }, + yearOfWeek(date) { + throw new Error('no weeks'); + }, }; var date = Temporal.PlainDate.from({ year: 184, diff --git a/test/staging/Temporal/UserTimezone/old/subminute-offset.js b/test/staging/Temporal/UserTimezone/old/subminute-offset.js index 6f55e3bceb..4d6e925aeb 100644 --- a/test/staging/Temporal/UserTimezone/old/subminute-offset.js +++ b/test/staging/Temporal/UserTimezone/old/subminute-offset.js @@ -50,7 +50,29 @@ assert.throws(RangeError, () => Temporal.TimeZone.from("2020-05-26T16:02:46.2511 assert.sameValue(obj.getOffsetStringFor(inst), "-00:00:01.111111111") // converts to DateTime -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(`${ obj.getPlainDateTimeFor(inst) }`, "1969-12-31T23:59:58.888888889"); assert.sameValue(`${ obj.getPlainDateTimeFor(inst, fakeGregorian) }`, "1969-12-31T23:59:58.888888889[u-ca=gregory]"); diff --git a/test/staging/Temporal/UserTimezone/old/trivial-protocol.js b/test/staging/Temporal/UserTimezone/old/trivial-protocol.js index 72ff02967b..3c9be788ee 100644 --- a/test/staging/Temporal/UserTimezone/old/trivial-protocol.js +++ b/test/staging/Temporal/UserTimezone/old/trivial-protocol.js @@ -30,7 +30,29 @@ var zdt = new Temporal.ZonedDateTime(0n, obj); assert.sameValue(zdt.toString(), "1970-01-01T00:00:00+00:00[Etc/Custom/UTC_Protocol]"); // works in Temporal.Now -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert(Temporal.Now.plainDateTimeISO(obj) instanceof Temporal.PlainDateTime); assert(Temporal.Now.plainDateTime(fakeGregorian, obj) instanceof Temporal.PlainDateTime); assert(Temporal.Now.plainDateISO(obj) instanceof Temporal.PlainDate); diff --git a/test/staging/Temporal/UserTimezone/old/trivial-subclass.js b/test/staging/Temporal/UserTimezone/old/trivial-subclass.js index bf97d6f4d1..e8ae4c94a2 100644 --- a/test/staging/Temporal/UserTimezone/old/trivial-subclass.js +++ b/test/staging/Temporal/UserTimezone/old/trivial-subclass.js @@ -88,7 +88,29 @@ assert.throws(RangeError, () => Temporal.TimeZone.from("2020-05-26T16:02:46.2511 assert.sameValue(obj.getOffsetStringFor(inst), "+00:00") // converts to DateTime -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(`${ obj.getPlainDateTimeFor(inst) }`, "1970-01-01T00:00:00"); assert.sameValue(`${ obj.getPlainDateTimeFor(inst, fakeGregorian) }`, "1970-01-01T00:00:00[u-ca=gregory]"); diff --git a/test/staging/Temporal/ZonedDateTime/old/compare.js b/test/staging/Temporal/ZonedDateTime/old/compare.js index 209af7e262..05678af3d0 100644 --- a/test/staging/Temporal/ZonedDateTime/old/compare.js +++ b/test/staging/Temporal/ZonedDateTime/old/compare.js @@ -111,7 +111,29 @@ assert.throws(TypeError, () => Temporal.ZonedDateTime.compare(zdt1, { assert.sameValue(Temporal.ZonedDateTime.compare(zdt1, zdt1.withTimeZone("+05:30")), 0); // disregards calendar IDs if exact times and time zones are equal -var fakeJapanese = { toString() { return "japanese"; }}; +var fakeJapanese = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "japanese", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(Temporal.ZonedDateTime.compare(zdt1, zdt1.withCalendar(fakeJapanese)), 0); // compares exact time, not clock time diff --git a/test/staging/Temporal/ZonedDateTime/old/construction-and-properties.js b/test/staging/Temporal/ZonedDateTime/old/construction-and-properties.js index 63e5216902..0f38219641 100644 --- a/test/staging/Temporal/ZonedDateTime/old/construction-and-properties.js +++ b/test/staging/Temporal/ZonedDateTime/old/construction-and-properties.js @@ -67,6 +67,14 @@ var fakeGregorian = { monthsInYear(date) { return date.withCalendar("iso8601").monthsInYear; }, inLeapYear(date) { return date.withCalendar("iso8601").inLeapYear; }, id: "gregory", + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + fields() {}, + mergeFields() {}, + monthDayFromFields() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; var fakeVienna = { getOffsetNanosecondsFor() { return 3600_000_000_000; }, diff --git a/test/staging/Temporal/ZonedDateTime/old/equals.js b/test/staging/Temporal/ZonedDateTime/old/equals.js index 46c85290d1..b2623050ee 100644 --- a/test/staging/Temporal/ZonedDateTime/old/equals.js +++ b/test/staging/Temporal/ZonedDateTime/old/equals.js @@ -15,7 +15,25 @@ var tz = { var cal = { dateFromFields(...args) { return Temporal.Calendar.from("iso8601").dateFromFields(...args); }, id: "gregory", + dateAdd() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, fields(fieldNames) { return fieldNames; }, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; var zdt = new Temporal.ZonedDateTime(0n, tz, cal); diff --git a/test/staging/Temporal/ZonedDateTime/old/since.js b/test/staging/Temporal/ZonedDateTime/old/since.js index baf3462334..627defe613 100644 --- a/test/staging/Temporal/ZonedDateTime/old/since.js +++ b/test/staging/Temporal/ZonedDateTime/old/since.js @@ -87,7 +87,29 @@ assert.notSameValue(monthsDifference.months, 0); // no two different calendars var zdt1 = new Temporal.ZonedDateTime(0n, "UTC"); -var fakeJapanese = { id: "japanese" }; +var fakeJapanese = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "japanese", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; var zdt2 = new Temporal.ZonedDateTime(0n, "UTC", fakeJapanese); assert.throws(RangeError, () => zdt1.since(zdt2)); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js index 60b03d2bda..21577e560d 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainDate.js @@ -14,7 +14,29 @@ var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTim assert.sameValue(`${ zdt.toPlainDate() }`, "2019-10-29"); // preserves the calendar -const fakeGregorian = { id: 'gregory' }; +const fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTime({ timeZone: tz, calendar: fakeGregorian diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js b/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js index 4a6433aa41..e0ca0b7c2a 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js @@ -23,7 +23,23 @@ var fakeGregorian = { }, monthCode(date) { return date.withCalendar("iso8601").monthCode; }, day(date) { return date.withCalendar("iso8601").day; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, fields(fieldNames) { return fieldNames; }, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, }; var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTime({ timeZone: tz, diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js b/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js index 1e3e4d1ae3..1b33d284f1 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js +++ b/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js @@ -23,7 +23,23 @@ var fakeGregorian = { }, year(date) { return date.withCalendar("iso8601").year; }, monthCode(date) { return date.withCalendar("iso8601").monthCode; }, + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, fields(fieldNames) { return fieldNames; }, + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + yearOfWeek() {}, }; var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTime({ timeZone: tz, diff --git a/test/staging/Temporal/ZonedDateTime/old/toString.js b/test/staging/Temporal/ZonedDateTime/old/toString.js index d142a0ecf4..13c860ff56 100644 --- a/test/staging/Temporal/ZonedDateTime/old/toString.js +++ b/test/staging/Temporal/ZonedDateTime/old/toString.js @@ -9,7 +9,29 @@ features: [Temporal] ---*/ var zdt1 = Temporal.ZonedDateTime.from("1976-11-18T15:23+00:00[UTC]"); -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; // shows offset if offset = auto assert.sameValue(zdt1.toString({ offset: "auto" }), "1976-11-18T15:23:00+00:00[UTC]"); diff --git a/test/staging/Temporal/ZonedDateTime/old/until.js b/test/staging/Temporal/ZonedDateTime/old/until.js index 10f9cbc196..67280f879a 100644 --- a/test/staging/Temporal/ZonedDateTime/old/until.js +++ b/test/staging/Temporal/ZonedDateTime/old/until.js @@ -87,7 +87,29 @@ assert.notSameValue(monthsDifference.months, 0); // no two different calendars var zdt1 = new Temporal.ZonedDateTime(0n, "UTC"); -var fakeJapanese = { id: "japanese" }; +var fakeJapanese = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "japanese", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; var zdt2 = new Temporal.ZonedDateTime(0n, "UTC", fakeJapanese); assert.throws(RangeError, () => zdt1.until(zdt2)); diff --git a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js index 7a2be87bac..db9dec8077 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withCalendar.js +++ b/test/staging/Temporal/ZonedDateTime/old/withCalendar.js @@ -10,7 +10,29 @@ features: [Temporal] var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789-08:00[-08:00]"); // zonedDateTime.withCalendar(japanese) works -var cal = { id: 'japanese', toString() { return 'japanese'; } }; +var cal = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "japanese", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(`${ zdt.withCalendar(cal) }`, "2019-11-18T15:23:30.123456789-08:00[-08:00][u-ca=japanese]"); // keeps instant and time zone the same diff --git a/test/staging/Temporal/ZonedDateTime/old/withPlainDate.js b/test/staging/Temporal/ZonedDateTime/old/withPlainDate.js index 5aad741305..74a1048631 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withPlainDate.js +++ b/test/staging/Temporal/ZonedDateTime/old/withPlainDate.js @@ -27,7 +27,29 @@ assert.sameValue(`${ zdt.withPlainDate(date) }`, "2020-01-23T03:24:30-08:00[Cust assert.sameValue(`${ zdt.withPlainDate("2018-09-15") }`, "2018-09-15T03:24:30-08:00[Custom/Spring_Fall]"); // result contains a non-ISO calendar if present in the input -var fakeJapanese = { id: "japanese" }; +var fakeJapanese = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "japanese", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.sameValue(`${ zdt.withCalendar(fakeJapanese).withPlainDate("2008-09-06") }`, "2008-09-06T03:24:30-08:00[Custom/Spring_Fall][u-ca=japanese]"); // calendar is unchanged if input has ISO calendar @@ -35,7 +57,29 @@ var date = new Temporal.PlainDate(2008, 9, 6, fakeJapanese); assert.sameValue(`${ zdt.withPlainDate(date) }`, "2008-09-06T03:24:30-08:00[Custom/Spring_Fall][u-ca=japanese]"); // throws if both `this` and `other` have a non-ISO calendar -var fakeGregorian = { id: "gregory" }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; assert.throws(RangeError, () => zdt.withCalendar(fakeGregorian).withPlainDate(date)); // object must contain at least one correctly-spelled property diff --git a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js index fb096ca120..f05c2c5277 100644 --- a/test/staging/Temporal/ZonedDateTime/old/withTimezone.js +++ b/test/staging/Temporal/ZonedDateTime/old/withTimezone.js @@ -8,7 +8,29 @@ features: [Temporal] ---*/ // keeps instant and calendar the same -var fakeGregorian = { id: 'gregory' }; +var fakeGregorian = { + dateAdd() {}, + dateFromFields() {}, + dateUntil() {}, + day() {}, + dayOfWeek() {}, + dayOfYear() {}, + daysInMonth() {}, + daysInWeek() {}, + daysInYear() {}, + fields() {}, + id: "gregory", + inLeapYear() {}, + mergeFields() {}, + month() {}, + monthCode() {}, + monthDayFromFields() {}, + monthsInYear() {}, + weekOfYear() {}, + year() {}, + yearMonthFromFields() {}, + yearOfWeek() {}, +}; var zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00]").withCalendar(fakeGregorian); var zdt2 = zdt.withTimeZone("-08:00"); assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds);