Temporal: Expand order-of-operations tests to cover calendar methods

Some of the existing order-of-operations tests didn't observe the calendar
operations. Add a TemporalHelpers.calendarObserver() calendar to the
invocations of these methods in the order-of-operations tests.
This commit is contained in:
Philip Chimento 2022-11-03 17:49:38 -07:00 committed by Ms2ger
parent ed32b59bba
commit f2e17efaf8
14 changed files with 238 additions and 10 deletions

View File

@ -10,6 +10,9 @@ features: [Temporal]
const expected = [
"get fields.calendar",
"has fields.calendar.calendar",
"get fields.calendar.fields",
"call fields.calendar.fields",
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -22,17 +25,22 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
"get fields.calendar.dateFromFields",
"call fields.calendar.dateFromFields",
// inside Calendar.p.dateFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "fields.calendar");
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1.7,
calendar,
}, "fields");
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(2000, 5, 2);
const expected = [
// ToTemporalDuration
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,12 +40,21 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// CalendarDateAdd
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(2000, 5, 2);
const expected = [
// ToTemporalDuration
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,12 +40,21 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// CalendarDateAdd
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,10 +8,14 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(2000, 5, 2);
const expected = [
// RejectObjectWithCalendarOrTimeZone
"get fields.calendar",
"get fields.timeZone",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -24,12 +28,33 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// PrepareTemporalFields on receiver
"get this.calendar.day",
"call this.calendar.day",
"get this.calendar.month",
"call this.calendar.month",
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarMergeFields
"get this.calendar.mergeFields",
"call this.calendar.mergeFields",
// CalendarDateFromFields
"get this.calendar.dateFromFields",
"call this.calendar.dateFromFields",
// inside Calendar.p.dateFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,

View File

@ -9,7 +9,13 @@ features: [Temporal]
---*/
const expected = [
// GetTemporalCalendarWithISODefault
"get fields.calendar",
"has fields.calendar.calendar",
// CalendarFields
"get fields.calendar.fields",
"call fields.calendar.fields",
// PrepareTemporalFields
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -44,12 +50,15 @@ const expected = [
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
"get fields.calendar.dateFromFields",
"call fields.calendar.dateFromFields",
// inside Calendar.p.dateFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
@ -61,6 +70,7 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
millisecond: 1.7,
microsecond: 1.7,
nanosecond: 1.7,
calendar: TemporalHelpers.calendarObserver(actual, "fields.calendar"),
}, "fields");
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
const expected = [
// ToTemporalDurationRecord
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,12 +40,21 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// AddDateTime
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
const expected = [
// ToTemporalDurationRecord
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,12 +40,21 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// AddDateTime
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,10 +8,14 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
const expected = [
// RejectObjectWithCalendarOrTimeZone
"get fields.calendar",
"get fields.timeZone",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -42,16 +46,36 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// PrepareTemporalFields on receiver
"get this.calendar.day",
"call this.calendar.day",
"get this.calendar.month",
"call this.calendar.month",
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarMergeFields
"get this.calendar.mergeFields",
"call this.calendar.mergeFields",
// InterpretTemporalDateTimeFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
"get this.calendar.dateFromFields",
"call this.calendar.dateFromFields",
// inside Calendar.p.dateFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,

View File

@ -10,6 +10,12 @@ features: [Temporal]
const expected = [
"get fields.calendar",
// ToTemporalCalendarWithISODefault
"has fields.calendar.calendar",
// CalendarFields
"get fields.calendar.fields",
"call fields.calendar.fields",
// PrepareTemporalFields
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -22,17 +28,22 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// CalendarMonthDayFromFields
"get fields.calendar.monthDayFromFields",
"call fields.calendar.monthDayFromFields",
// inside Calendar.p.monthDayFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
day: 1.7,
calendar: TemporalHelpers.calendarObserver(actual, "fields.calendar"),
}, "fields");
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");

View File

@ -8,10 +8,14 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainMonthDay(5, 2);
const expected = [
// RejectObjectWithCalendarOrTimeZone
"get fields.calendar",
"get fields.timeZone",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields
"get fields.day",
"get fields.day.valueOf",
"call fields.day.valueOf",
@ -24,12 +28,29 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// PrepareTemporalFields on receiver
"get this.calendar.day",
"call this.calendar.day",
"get this.calendar.monthCode",
"call this.calendar.monthCode",
// CalendarMergeFields
"get this.calendar.mergeFields",
"call this.calendar.mergeFields",
// CalendarMonthDayFromFields
"get this.calendar.monthDayFromFields",
"call this.calendar.monthDayFromFields",
// inside Calendar.p.monthDayFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainMonthDay(5, 2, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,

View File

@ -9,7 +9,13 @@ features: [Temporal]
---*/
const expected = [
// GetTemporalCalendarWithISODefault
"get fields.calendar",
"has fields.calendar.calendar",
// CalendarFields
"get fields.calendar.fields",
"call fields.calendar.fields",
// PrepareTemporalFields
"get fields.month",
"get fields.month.valueOf",
"call fields.month.valueOf",
@ -19,16 +25,21 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// CalendarYearMonthFromFields
"get fields.calendar.yearMonthFromFields",
"call fields.calendar.yearMonthFromFields",
// inside Calendar.p.yearMonthFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,
monthCode: "M01",
calendar: TemporalHelpers.calendarObserver(actual, "fields.calendar"),
}, "fields");
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2000, 5);
const expected = [
// ToTemporalDuration
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,19 +40,47 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields on receiver
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarDateFromFields
"get this.calendar.dateFromFields",
"call this.calendar.dateFromFields",
// CopyDataProperties
"ownKeys options",
"getOwnPropertyDescriptor options.overflow",
"get options.overflow",
// CalendarDateAdd
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
// PrepareTemporalFields on added date
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarYearMonthFromFields
"get this.calendar.yearMonthFromFields",
"call this.calendar.yearMonthFromFields",
// inside Calendar.p.yearMonthFromFields
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,8 +8,8 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2000, 5);
const expected = [
// ToTemporalDuration
"get fields.days",
"get fields.days.valueOf",
"call fields.days.valueOf",
@ -40,19 +40,50 @@ const expected = [
"get fields.years",
"get fields.years.valueOf",
"call fields.years.valueOf",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields on receiver
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarDaysInMonth
"get this.calendar.daysInMonth",
"call this.calendar.daysInMonth",
// CalendarDateFromFields
"get this.calendar.dateFromFields",
"call this.calendar.dateFromFields",
// CopyDataProperties
"ownKeys options",
"getOwnPropertyDescriptor options.overflow",
"get options.overflow",
// CalendarDateAdd
"get this.calendar.dateAdd",
"call this.calendar.dateAdd",
// inside Calendar.p.dateAdd
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
// PrepareTemporalFields on added date
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarYearMonthFromFields
"get this.calendar.yearMonthFromFields",
"call this.calendar.yearMonthFromFields",
// inside Calendar.p.yearMonthFromFields
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 1,

View File

@ -8,10 +8,14 @@ includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2000, 5);
const expected = [
// RejectObjectWithCalendarOrTimeZone
"get fields.calendar",
"get fields.timeZone",
// CalendarFields
"get this.calendar.fields",
"call this.calendar.fields",
// PrepareTemporalFields
"get fields.month",
"get fields.month.valueOf",
"call fields.month.valueOf",
@ -21,12 +25,31 @@ const expected = [
"get fields.year",
"get fields.year.valueOf",
"call fields.year.valueOf",
// PrepareTemporalFields on receiver
"get this.calendar.month",
"call this.calendar.month",
"get this.calendar.monthCode",
"call this.calendar.monthCode",
"get this.calendar.year",
"call this.calendar.year",
// CalendarMergeFields
"get this.calendar.mergeFields",
"call this.calendar.mergeFields",
// CalendarYearMonthFromFields
"get this.calendar.yearMonthFromFields",
"call this.calendar.yearMonthFromFields",
// inside Calendar.p.yearMonthFromFields
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
// clear observable operations that occurred during the constructor call
actual.splice(0);
const fields = TemporalHelpers.propertyBagObserver(actual, {
year: 1.7,
month: 1.7,