mirror of https://github.com/tc39/test262.git
Temporal: Make calendar method lookups unconditional
See https://github.com/tc39/proposal-temporal/issues/2724
This commit is contained in:
parent
3e23610431
commit
dc1c787cc8
|
@ -109,7 +109,6 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -134,6 +133,8 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"get options.relativeTo.year.valueOf",
|
||||
"call options.relativeTo.year.valueOf",
|
||||
"call options.relativeTo.calendar.dateFromFields",
|
||||
// lookup in Duration.compare
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
]);
|
||||
|
||||
const plainRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
||||
|
@ -176,7 +177,6 @@ actual.splice(0); // clear
|
|||
// to days:
|
||||
const expectedOpsForPlainDayBalancing = expectedOpsForPlainRelativeTo.concat(
|
||||
[
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
// UnbalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iii.1 MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iv.1 MoveRelativeDate
|
||||
|
@ -264,6 +264,8 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup in Duration.compare
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
]);
|
||||
|
||||
const zonedRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
||||
|
@ -323,7 +325,6 @@ Temporal.Duration.compare(
|
|||
assert.compareArray(
|
||||
actual,
|
||||
expectedOpsForZonedRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// AddZonedDateTime on first argument
|
||||
"call options.relativeTo.calendar.dateAdd",
|
||||
|
|
|
@ -92,7 +92,6 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -119,7 +118,7 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"call options.relativeTo.year.valueOf",
|
||||
// InterpretTemporalDateTimeFields
|
||||
"call options.relativeTo.calendar.dateFromFields",
|
||||
// lookup 2
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// AddDuration
|
||||
|
@ -231,6 +230,9 @@ const expectedOpsForPlainRelativeToNoCalendarOperations = [
|
|||
"call options.relativeTo.year.valueOf",
|
||||
// InterpretTemporalDateTimeFields
|
||||
"call options.relativeTo.calendar.dateFromFields",
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const noCalendarInstance = new Temporal.Duration(0, 0, 0, 4, 5, 6, 7, 987, 654, 321);
|
||||
|
@ -273,7 +275,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -323,7 +324,7 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup 2
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// AddDuration
|
||||
|
@ -419,7 +420,6 @@ const expectedOpsForZonedRelativeToNoDaysOperations = [
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -469,6 +469,9 @@ const expectedOpsForZonedRelativeToNoDaysOperations = [
|
|||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const noDaysInstance = new Temporal.Duration(0, 0, 0, 0, 5, 6, 7, 987, 654, 321);
|
||||
|
|
|
@ -102,6 +102,9 @@ const expectedOpsForPlainRelativeTo = [
|
|||
"get options.smallestUnit",
|
||||
"get options.smallestUnit.toString",
|
||||
"call options.smallestUnit.toString",
|
||||
// lookup in Duration.p.round
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const plainRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
||||
|
@ -119,8 +122,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through RoundDuration that rounds to the nearest year, with minimal calendar calls:
|
||||
const expectedMinimalOpsForYearRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// 7.e and 7.g not called because years, months, weeks are 0
|
||||
"call options.relativeTo.calendar.dateUntil", // 7.o
|
||||
// 7.s not called because years, months, weeks are 0
|
||||
|
@ -132,8 +133,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through RoundDuration that rounds to the nearest year:
|
||||
const expectedOpsForYearRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
"call options.relativeTo.calendar.dateAdd", // 7.e
|
||||
"call options.relativeTo.calendar.dateAdd", // 7.g
|
||||
"call options.relativeTo.calendar.dateUntil", // 7.o
|
||||
|
@ -152,8 +151,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through Duration.prototype.round that rounds to the nearest month:
|
||||
const expectedOpsForMonthRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// UnbalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 9.d.i
|
||||
"call options.relativeTo.calendar.dateUntil", // 9.d.iv
|
||||
|
@ -172,7 +169,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through Duration.prototype.round that rounds to the nearest week:
|
||||
const expectedOpsForWeekRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
// UnbalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.c.i MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.d.i MoveRelativeDate
|
||||
|
@ -189,7 +185,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through UnbalanceDurationRelative that rounds to the nearest day:
|
||||
const expectedOpsForDayRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iii.1 MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iv.1 MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.v.1 MoveRelativeDate
|
||||
|
@ -201,8 +196,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through BalanceDurationRelative balancing from days up to years:
|
||||
const expectedOpsForDayToYearBalancing = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.b MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.e.iv MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.f MoveRelativeDate
|
||||
|
@ -217,8 +210,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through Duration.prototype.round balancing from months up to years:
|
||||
const expectedOpsForMonthToYearBalancing = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// RoundDuration
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.c
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.e
|
||||
|
@ -237,7 +228,6 @@ assert.compareArray(actual, expectedOpsForMonthToYearBalancing, "order of operat
|
|||
actual.splice(0); // clear
|
||||
|
||||
const expectedOpsForDayToMonthBalancing = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
// BalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.b MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.e.iv MoveRelativeDate
|
||||
|
@ -248,7 +238,6 @@ assert.compareArray(actual, expectedOpsForDayToMonthBalancing, "order of operati
|
|||
actual.splice(0); // clear
|
||||
|
||||
const expectedOpsForDayToWeekBalancing = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
// BalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 12.c MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 12.f.iv MoveRelativeDate
|
||||
|
@ -360,14 +349,17 @@ const zonedRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
|||
|
||||
// basic order of operations with ZonedDateTime relativeTo:
|
||||
instance.round(createOptionsObserver({ relativeTo: zonedRelativeTo }));
|
||||
assert.compareArray(actual, expectedOpsForZonedRelativeTo, "order of operations for ZonedDateTime relativeTo");
|
||||
assert.compareArray(actual, expectedOpsForZonedRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
]), "order of operations for ZonedDateTime relativeTo");
|
||||
actual.splice(0); // clear
|
||||
|
||||
// code path through RoundDuration that rounds to the nearest year with minimal calendar operations:
|
||||
const expectedOpsForMinimalYearRoundingZoned = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.round
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// NanosecondsToDays
|
||||
|
@ -395,7 +387,7 @@ actual.splice(0); // clear
|
|||
const expectedOpsForYearRoundingZoned = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.round
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// MoveRelativeZonedDateTime → AddZonedDateTime
|
||||
|
@ -432,8 +424,9 @@ actual.splice(0); // clear
|
|||
const expectedOpsForUnbalanceRoundBalance = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.round
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// No user code calls in UnbalanceDurationRelative
|
||||
// RoundDuration → MoveRelativeZonedDateTime → AddZonedDateTime
|
||||
"call options.relativeTo.calendar.dateAdd",
|
||||
|
|
|
@ -92,7 +92,6 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -119,7 +118,7 @@ const expectedOpsForPlainRelativeTo = expected.concat([
|
|||
"call options.relativeTo.year.valueOf",
|
||||
// InterpretTemporalDateTimeFields
|
||||
"call options.relativeTo.calendar.dateFromFields",
|
||||
// lookup 2
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// AddDuration
|
||||
|
@ -231,6 +230,9 @@ const expectedOpsForPlainRelativeToNoCalendarOperations = [
|
|||
"call options.relativeTo.year.valueOf",
|
||||
// InterpretTemporalDateTimeFields
|
||||
"call options.relativeTo.calendar.dateFromFields",
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const noCalendarInstance = new Temporal.Duration(0, 0, 0, 4, 5, 6, 7, 987, 654, 321);
|
||||
|
@ -273,7 +275,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -323,7 +324,7 @@ const expectedOpsForZonedRelativeTo = expected.concat([
|
|||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup 2
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// AddDuration
|
||||
|
@ -419,7 +420,6 @@ const expectedOpsForZonedRelativeToNoDaysOperations = [
|
|||
"has options.relativeTo.calendar.year",
|
||||
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||
"has options.relativeTo.calendar.yearOfWeek",
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateFromFields",
|
||||
"get options.relativeTo.calendar.fields",
|
||||
"call options.relativeTo.calendar.fields",
|
||||
|
@ -469,6 +469,9 @@ const expectedOpsForZonedRelativeToNoDaysOperations = [
|
|||
"get options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getPossibleInstantsFor",
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup in AddDurationToOrSubtractDurationFromDuration
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const noDaysInstance = new Temporal.Duration(0, 0, 0, 0, 5, 6, 7, 987, 654, 321);
|
||||
|
|
|
@ -85,6 +85,9 @@ const expectedOpsForPlainRelativeTo = [
|
|||
"get options.unit",
|
||||
"get options.unit.toString",
|
||||
"call options.unit.toString",
|
||||
// lookup in Duration.p.total
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
];
|
||||
|
||||
const plainRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
||||
|
@ -102,9 +105,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through RoundDuration that rounds to the nearest year with minimal calendar calls:
|
||||
const expectedOpsForMinimalYearRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
// lookup
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// 7.e and 7.g not called because years, months, weeks are 0
|
||||
"call options.relativeTo.calendar.dateUntil", // 7.o
|
||||
// 7.s not called because years, months, weeks are 0
|
||||
|
@ -116,8 +116,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through RoundDuration that rounds to the nearest year:
|
||||
const expectedOpsForYearRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
"call options.relativeTo.calendar.dateAdd", // 7.d
|
||||
"call options.relativeTo.calendar.dateAdd", // 7.f
|
||||
"call options.relativeTo.calendar.dateUntil", // 7.n
|
||||
|
@ -131,8 +129,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through Duration.prototype.total that rounds to the nearest month:
|
||||
const expectedOpsForMonthRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// UnbalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 9.d.i
|
||||
"call options.relativeTo.calendar.dateUntil", // 9.d.iv
|
||||
|
@ -148,7 +144,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through Duration.prototype.total that rounds to the nearest week:
|
||||
const expectedOpsForWeekRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
// UnbalanceDurationRelative
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.c.i MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 10.d.i MoveRelativeDate
|
||||
|
@ -162,7 +157,6 @@ actual.splice(0); // clear
|
|||
|
||||
// code path through UnbalanceDurationRelative that rounds to the nearest day:
|
||||
const expectedOpsForDayRounding = expectedOpsForPlainRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iii.1 MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.iv.1 MoveRelativeDate
|
||||
"call options.relativeTo.calendar.dateAdd", // 11.a.v.1 MoveRelativeDate
|
||||
|
@ -267,14 +261,18 @@ const zonedRelativeTo = TemporalHelpers.propertyBagObserver(actual, {
|
|||
|
||||
// basic order of observable operations, without rounding:
|
||||
instance.total(createOptionsObserver({ unit: "nanoseconds", relativeTo: zonedRelativeTo }));
|
||||
assert.compareArray(actual, expectedOpsForZonedRelativeTo, "order of operations for ZonedDateTime relativeTo");
|
||||
assert.compareArray(actual, expectedOpsForZonedRelativeTo.concat([
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
]), "order of operations for ZonedDateTime relativeTo");
|
||||
actual.splice(0); // clear
|
||||
|
||||
// code path through RoundDuration that rounds to the nearest year with minimal calendar operations:
|
||||
const expectedOpsForMinimalYearRoundingZoned = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
"get options.relativeTo.calendar.dateAdd", // lookup
|
||||
// lookup in Duration.p.total
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// BalancePossiblyInfiniteDuration → NanosecondsToDays
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor", // 7. GetPlainDateTimeFor
|
||||
|
@ -304,7 +302,7 @@ actual.splice(0); // clear
|
|||
const expectedOpsForYearRoundingZoned = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.total
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// MoveRelativeZonedDateTime → AddZonedDateTime
|
||||
|
@ -339,8 +337,9 @@ actual.splice(0); // clear
|
|||
const expectedOpsForUnbalanceRound = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.total
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// No user code calls in UnbalanceDateDurationRelative
|
||||
// MoveRelativeZonedDateTime → AddZonedDateTime
|
||||
"call options.relativeTo.calendar.dateAdd",
|
||||
|
@ -365,8 +364,9 @@ actual.splice(0); // clear
|
|||
const expectedOpsForBalanceRound = expectedOpsForZonedRelativeTo.concat([
|
||||
// ToTemporalDate
|
||||
"call options.relativeTo.timeZone.getOffsetNanosecondsFor",
|
||||
// lookup
|
||||
// lookup in Duration.p.total
|
||||
"get options.relativeTo.calendar.dateAdd",
|
||||
"get options.relativeTo.calendar.dateUntil",
|
||||
// No user code calls in UnbalanceDateDurationRelative
|
||||
// No user code calls in AddZonedDateTime (years, months, weeks = 0)
|
||||
// BalanceTimeDurationRelative
|
||||
|
|
|
@ -103,6 +103,7 @@ const noCalendarExpected = [
|
|||
"call fields.seconds.valueOf",
|
||||
"get fields.weeks",
|
||||
"get fields.years",
|
||||
"get this.calendar.dateAdd",
|
||||
// AddDate
|
||||
"get options.overflow",
|
||||
"get options.overflow.toString",
|
||||
|
|
|
@ -105,6 +105,7 @@ actual.splice(0);
|
|||
instance.since(otherDatePropertyBag, createOptionsObserver({ largestUnit: "years" }));
|
||||
assert.compareArray(actual, expected.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateUntil",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
|
|
|
@ -103,6 +103,7 @@ const noCalendarExpected = [
|
|||
"call fields.seconds.valueOf",
|
||||
"get fields.weeks",
|
||||
"get fields.years",
|
||||
"get this.calendar.dateAdd",
|
||||
// AddDate
|
||||
"get options.overflow",
|
||||
"get options.overflow.toString",
|
||||
|
|
|
@ -105,6 +105,7 @@ actual.splice(0);
|
|||
instance.until(otherDatePropertyBag, createOptionsObserver({ largestUnit: "years" }));
|
||||
assert.compareArray(actual, expected.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateUntil",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
|
|
|
@ -101,6 +101,7 @@ const noCalendarExpected = [
|
|||
"call fields.seconds.valueOf",
|
||||
"get fields.weeks",
|
||||
"get fields.years",
|
||||
"get this.calendar.dateAdd",
|
||||
// AddDateTime -> AddDate
|
||||
"get options.overflow",
|
||||
"get options.overflow.toString",
|
||||
|
|
|
@ -129,6 +129,7 @@ actual.splice(0);
|
|||
instance.since(otherDateTimePropertyBag, createOptionsObserver({ largestUnit: "years" }));
|
||||
assert.compareArray(actual, expected.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateUntil",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
|
|
|
@ -101,6 +101,7 @@ const noCalendarExpected = [
|
|||
"call fields.seconds.valueOf",
|
||||
"get fields.weeks",
|
||||
"get fields.years",
|
||||
"get this.calendar.dateAdd",
|
||||
// AddDateTime -> AddDate
|
||||
"get options.overflow",
|
||||
"get options.overflow.toString",
|
||||
|
|
|
@ -129,6 +129,7 @@ actual.splice(0);
|
|||
instance.until(otherDateTimePropertyBag, createOptionsObserver({ largestUnit: "years" }));
|
||||
assert.compareArray(actual, expected.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateUntil",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
|
|
|
@ -43,6 +43,7 @@ const expected = [
|
|||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateFromFields",
|
||||
"get this.calendar.day",
|
||||
"get this.calendar.fields",
|
||||
"get this.calendar.yearMonthFromFields",
|
||||
// CalendarFields
|
||||
|
@ -129,7 +130,9 @@ const noCalendarExpected = [
|
|||
"get fields.weeks",
|
||||
"get fields.years",
|
||||
// lookup
|
||||
"get this.calendar.dateAdd",
|
||||
"get this.calendar.dateFromFields",
|
||||
"get this.calendar.day",
|
||||
"get this.calendar.fields",
|
||||
"get this.calendar.yearMonthFromFields",
|
||||
// CalendarFields
|
||||
|
|
|
@ -123,28 +123,7 @@ actual.splice(0);
|
|||
|
||||
// code path that skips RoundDuration:
|
||||
instance.since(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "months", roundingIncrement: 1 }));
|
||||
assert.compareArray(actual, expectedMinimal.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateFromFields",
|
||||
"get this.calendar.dateUntil",
|
||||
"get this.calendar.fields",
|
||||
// CalendarFields
|
||||
"call this.calendar.fields",
|
||||
// PrepareTemporalFields / CalendarDateFromFields (receiver)
|
||||
"get this.calendar.monthCode",
|
||||
"call this.calendar.monthCode",
|
||||
"get this.calendar.year",
|
||||
"call this.calendar.year",
|
||||
"call this.calendar.dateFromFields",
|
||||
// PrepareTemporalFields / CalendarDateFromFields (argument)
|
||||
"get other.calendar.monthCode",
|
||||
"call other.calendar.monthCode",
|
||||
"get other.calendar.year",
|
||||
"call other.calendar.year",
|
||||
"call this.calendar.dateFromFields",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
]), "order of operations with no rounding");
|
||||
assert.compareArray(actual, expected, "order of operations with no rounding");
|
||||
actual.splice(0); // clear
|
||||
|
||||
// short-circuit for identical objects:
|
||||
|
|
|
@ -123,28 +123,7 @@ actual.splice(0);
|
|||
|
||||
// code path that skips RoundDuration:
|
||||
instance.since(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "months", roundingIncrement: 1 }));
|
||||
assert.compareArray(actual, expectedMinimal.concat([
|
||||
// lookup
|
||||
"get this.calendar.dateFromFields",
|
||||
"get this.calendar.dateUntil",
|
||||
"get this.calendar.fields",
|
||||
// CalendarFields
|
||||
"call this.calendar.fields",
|
||||
// PrepareTemporalFields / CalendarDateFromFields (receiver)
|
||||
"get this.calendar.monthCode",
|
||||
"call this.calendar.monthCode",
|
||||
"get this.calendar.year",
|
||||
"call this.calendar.year",
|
||||
"call this.calendar.dateFromFields",
|
||||
// PrepareTemporalFields / CalendarDateFromFields (argument)
|
||||
"get other.calendar.monthCode",
|
||||
"call other.calendar.monthCode",
|
||||
"get other.calendar.year",
|
||||
"call other.calendar.year",
|
||||
"call this.calendar.dateFromFields",
|
||||
// CalendarDateUntil
|
||||
"call this.calendar.dateUntil",
|
||||
]), "order of operations with no rounding");
|
||||
assert.compareArray(actual, expected, "order of operations with no rounding");
|
||||
actual.splice(0); // clear
|
||||
|
||||
// short-circuit for identical objects:
|
||||
|
|
|
@ -42,7 +42,7 @@ const expected = [
|
|||
"has calendar.year",
|
||||
"has calendar.yearMonthFromFields",
|
||||
"has calendar.yearOfWeek",
|
||||
// lookup
|
||||
// lookup in ToTemporalZonedDateTime
|
||||
"get calendar.dateFromFields",
|
||||
"get calendar.fields",
|
||||
// CalendarFields
|
||||
|
|
|
@ -48,7 +48,7 @@ const expected = [
|
|||
"has calendar.year",
|
||||
"has calendar.yearMonthFromFields",
|
||||
"has calendar.yearOfWeek",
|
||||
// lookup
|
||||
// lookup in ToTemporalZonedDateTime
|
||||
"get calendar.dateFromFields",
|
||||
"get calendar.fields",
|
||||
// CalendarFields
|
||||
|
|
|
@ -48,7 +48,7 @@ const expected = [
|
|||
"has calendar.year",
|
||||
"has calendar.yearMonthFromFields",
|
||||
"has calendar.yearOfWeek",
|
||||
// lookup
|
||||
// lookup in ToTemporalZonedDateTime
|
||||
"get calendar.dateFromFields",
|
||||
"get calendar.fields",
|
||||
// CalendarFields
|
||||
|
|
|
@ -48,7 +48,7 @@ const expected = [
|
|||
"has calendar.year",
|
||||
"has calendar.yearMonthFromFields",
|
||||
"has calendar.yearOfWeek",
|
||||
// lookup
|
||||
// lookup in ToTemporalZonedDateTime
|
||||
"get calendar.dateFromFields",
|
||||
"get calendar.fields",
|
||||
// CalendarFields
|
||||
|
|
Loading…
Reference in New Issue