mirror of https://github.com/tc39/test262.git
Temporal: Expand order-of-operations tests to cover options bags
Some of the existing order-of-operations tests didn't pass an options bag: primarily from(), with(), add() and subtract(). (since() and until() were covered in a previous commit.) Add a TemporalHelpers.propertyBagObserver() options bag to the invocations of these methods in the order-of-operations tests.
This commit is contained in:
parent
e1d46f7fdc
commit
ed32b59bba
|
@ -22,6 +22,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.dateFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -30,7 +34,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
day: 1.7,
|
day: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = Temporal.PlainDate.from(fields);
|
|
||||||
TemporalHelpers.assertPlainDate(result, 1, 1, "M01", 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
const result = Temporal.PlainDate.from(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,10 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +58,10 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.add(fields);
|
|
||||||
TemporalHelpers.assertPlainDate(result, 2001, 6, "M06", 10);
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
overflow: "constrain",
|
||||||
|
}, "options");
|
||||||
|
|
||||||
|
instance.add(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,10 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +58,10 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.subtract(fields);
|
|
||||||
TemporalHelpers.assertPlainDate(result, 1999, 3, "M03", 25);
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
overflow: "constrain",
|
||||||
|
}, "options");
|
||||||
|
|
||||||
|
instance.subtract(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -24,6 +24,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.dateFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -32,7 +36,10 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
day: 1.7,
|
day: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.with(fields);
|
|
||||||
TemporalHelpers.assertPlainDate(result, 1, 1, "M01", 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
overflow: "constrain",
|
||||||
|
}, "options");
|
||||||
|
|
||||||
|
instance.with(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,14 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// InterpretTemporalDateTimeFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
|
// inside Calendar.p.dateFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +62,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microsecond: 1.7,
|
microsecond: 1.7,
|
||||||
nanosecond: 1.7,
|
nanosecond: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = Temporal.PlainDateTime.from(fields);
|
|
||||||
TemporalHelpers.assertPlainDateTime(result, 1, 1, "M01", 1, 1, 1, 1, 1, 1, 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
Temporal.PlainDateTime.from(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,10 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +58,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.add(fields);
|
|
||||||
TemporalHelpers.assertPlainDateTime(result, 2001, 6, "M06", 10, 13, 35, 57, 988, 655, 322);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.add(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,10 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +58,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.subtract(fields);
|
|
||||||
TemporalHelpers.assertPlainDateTime(result, 1999, 3, "M03", 25, 11, 33, 55, 986, 653, 320);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.subtract(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -42,6 +42,14 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// InterpretTemporalDateTimeFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
|
// inside Calendar.p.dateFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -56,7 +64,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microsecond: 1.7,
|
microsecond: 1.7,
|
||||||
nanosecond: 1.7,
|
nanosecond: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.with(fields);
|
|
||||||
TemporalHelpers.assertPlainDateTime(result, 1, 1, "M01", 1, 1, 1, 1, 1, 1, 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.with(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -22,6 +22,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.monthDayFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -30,7 +34,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
day: 1.7,
|
day: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = Temporal.PlainMonthDay.from(fields);
|
|
||||||
TemporalHelpers.assertPlainMonthDay(result, "M01", 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
Temporal.PlainMonthDay.from(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -24,6 +24,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.monthDayFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -32,6 +36,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
day: 1.7,
|
day: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.with(fields);
|
|
||||||
TemporalHelpers.assertPlainMonthDay(result, "M01", 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
|
|
||||||
|
instance.with(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -9,6 +9,9 @@ features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
"get fields.calendar",
|
"get fields.calendar",
|
||||||
"get fields.hour",
|
"get fields.hour",
|
||||||
"get fields.hour.valueOf",
|
"get fields.hour.valueOf",
|
||||||
|
@ -38,7 +41,10 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microsecond: 1.7,
|
microsecond: 1.7,
|
||||||
nanosecond: 1.7,
|
nanosecond: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = Temporal.PlainTime.from(fields);
|
|
||||||
TemporalHelpers.assertPlainTime(result, 1, 1, 1, 1, 1, 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
overflow: "constrain",
|
||||||
|
}, "options");
|
||||||
|
|
||||||
|
const result = Temporal.PlainTime.from(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -10,8 +10,10 @@ features: [Temporal]
|
||||||
|
|
||||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||||
const expected = [
|
const expected = [
|
||||||
|
// RejectObjectWithCalendarOrTimeZone
|
||||||
"get fields.calendar",
|
"get fields.calendar",
|
||||||
"get fields.timeZone",
|
"get fields.timeZone",
|
||||||
|
// ToTemporalTimeRecord
|
||||||
"get fields.hour",
|
"get fields.hour",
|
||||||
"get fields.hour.valueOf",
|
"get fields.hour.valueOf",
|
||||||
"call fields.hour.valueOf",
|
"call fields.hour.valueOf",
|
||||||
|
@ -30,8 +32,13 @@ const expected = [
|
||||||
"get fields.second",
|
"get fields.second",
|
||||||
"get fields.second.valueOf",
|
"get fields.second.valueOf",
|
||||||
"call fields.second.valueOf",
|
"call fields.second.valueOf",
|
||||||
|
// ToTemporalOverflow
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
hour: 1.7,
|
hour: 1.7,
|
||||||
minute: 1.7,
|
minute: 1.7,
|
||||||
|
@ -40,7 +47,10 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microsecond: 1.7,
|
microsecond: 1.7,
|
||||||
nanosecond: 1.7,
|
nanosecond: 1.7,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.with(fields);
|
|
||||||
TemporalHelpers.assertPlainTime(result, 1, 1, 1, 1, 1, 1);
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
overflow: "constrain",
|
||||||
|
}, "options");
|
||||||
|
|
||||||
|
const result = instance.with(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -19,6 +19,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.yearMonthFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -26,7 +30,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
month: 1.7,
|
month: 1.7,
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = Temporal.PlainYearMonth.from(fields);
|
|
||||||
TemporalHelpers.assertPlainYearMonth(result, 1, 1, "M01");
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
Temporal.PlainYearMonth.from(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,17 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// CopyDataProperties
|
||||||
|
"ownKeys options",
|
||||||
|
"getOwnPropertyDescriptor options.overflow",
|
||||||
|
"get options.overflow",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
|
// inside Calendar.p.yearMonthFromFields
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +65,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.add(fields);
|
|
||||||
TemporalHelpers.assertPlainYearMonth(result, 2001, 6, "M06");
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.add(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -40,6 +40,17 @@ const expected = [
|
||||||
"get fields.years",
|
"get fields.years",
|
||||||
"get fields.years.valueOf",
|
"get fields.years.valueOf",
|
||||||
"call fields.years.valueOf",
|
"call fields.years.valueOf",
|
||||||
|
// CopyDataProperties
|
||||||
|
"ownKeys options",
|
||||||
|
"getOwnPropertyDescriptor options.overflow",
|
||||||
|
"get options.overflow",
|
||||||
|
// inside Calendar.p.dateAdd
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
|
// inside Calendar.p.yearMonthFromFields
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -54,7 +65,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
microseconds: 1,
|
microseconds: 1,
|
||||||
nanoseconds: 1,
|
nanoseconds: 1,
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.subtract(fields);
|
|
||||||
TemporalHelpers.assertPlainYearMonth(result, 1999, 4, "M04");
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.subtract(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
|
@ -21,6 +21,10 @@ const expected = [
|
||||||
"get fields.year",
|
"get fields.year",
|
||||||
"get fields.year.valueOf",
|
"get fields.year.valueOf",
|
||||||
"call fields.year.valueOf",
|
"call fields.year.valueOf",
|
||||||
|
// inside Calendar.p.yearMonthFromFields
|
||||||
|
"get options.overflow",
|
||||||
|
"get options.overflow.toString",
|
||||||
|
"call options.overflow.toString",
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
|
@ -28,7 +32,8 @@ const fields = TemporalHelpers.propertyBagObserver(actual, {
|
||||||
month: 1.7,
|
month: 1.7,
|
||||||
monthCode: "M01",
|
monthCode: "M01",
|
||||||
}, "fields");
|
}, "fields");
|
||||||
const result = instance.with(fields);
|
|
||||||
TemporalHelpers.assertPlainYearMonth(result, 1, 1, "M01");
|
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
|
||||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
|
||||||
|
instance.with(fields, options);
|
||||||
assert.compareArray(actual, expected, "order of operations");
|
assert.compareArray(actual, expected, "order of operations");
|
||||||
|
|
Loading…
Reference in New Issue