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 154284211a..7b1e9a9c64 100644 --- a/test/built-ins/Temporal/Duration/compare/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/compare/order-of-operations.js @@ -105,14 +105,14 @@ const expectedOpsForPlainRelativeTo = expected.concat([ "get options.relativeTo.monthCode.toString", "call options.relativeTo.monthCode.toString", "get options.relativeTo.nanosecond", + "get options.relativeTo.offset", "get options.relativeTo.second", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", ]); const plainRelativeTo = TemporalHelpers.propertyBagObserver(actual, { @@ -181,19 +181,19 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.nanosecond", "get options.relativeTo.nanosecond.valueOf", "call options.relativeTo.nanosecond.valueOf", + "get options.relativeTo.offset", + "get options.relativeTo.offset.toString", + "call options.relativeTo.offset.toString", "get options.relativeTo.second", "get options.relativeTo.second.valueOf", "call options.relativeTo.second.valueOf", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", "has options.relativeTo.timeZone.timeZone", - "get options.relativeTo.offset.toString", - "call options.relativeTo.offset.toString", "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", "get options.relativeTo.timeZone.getOffsetNanosecondsFor", 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 235e54942b..bf182ee753 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 @@ -89,16 +89,15 @@ const expectedOpsForPlainRelativeTo = expected.concat([ "get options.relativeTo.monthCode.toString", "call options.relativeTo.monthCode.toString", "get options.relativeTo.nanosecond", + "get options.relativeTo.offset", "get options.relativeTo.second", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", // InterpretTemporalDateTimeFields "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - // ToRelativeTemporalObject again - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", // AddDuration "get options.relativeTo.calendar.dateAdd", "call options.relativeTo.calendar.dateAdd", @@ -165,9 +164,13 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.nanosecond", "get options.relativeTo.nanosecond.valueOf", "call options.relativeTo.nanosecond.valueOf", + "get options.relativeTo.offset", + "get options.relativeTo.offset.toString", + "call options.relativeTo.offset.toString", "get options.relativeTo.second", "get options.relativeTo.second.valueOf", "call options.relativeTo.second.valueOf", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", @@ -175,11 +178,7 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", // ToRelativeTemporalObject again - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", "has options.relativeTo.timeZone.timeZone", - "get options.relativeTo.offset.toString", - "call options.relativeTo.offset.toString", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", 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 c2dedd1596..8ab04a64a1 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 @@ -9,20 +9,19 @@ features: [Temporal] ---*/ const expected = [ - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", + "get options.relativeTo", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", - // ToRelativeTemporalObject - "get options.relativeTo", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; @@ -43,8 +42,11 @@ instance.round(createOptionsObserver({ smallestUnit: "microseconds" })); assert.compareArray(actual, expected, "order of operations"); actual.splice(0); // clear -const expectedOpsForPlainRelativeTo = expected.concat([ - // ToRelativeTemporalObject +const expectedOpsForPlainRelativeTo = [ + "get options.largestUnit", + "get options.largestUnit.toString", + "call options.largestUnit.toString", + "get options.relativeTo", "get options.relativeTo.calendar", "has options.relativeTo.calendar.calendar", "get options.relativeTo.calendar.fields", @@ -63,15 +65,24 @@ const expectedOpsForPlainRelativeTo = expected.concat([ "get options.relativeTo.monthCode.toString", "call options.relativeTo.monthCode.toString", "get options.relativeTo.nanosecond", + "get options.relativeTo.offset", "get options.relativeTo.second", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", -]); + "get options.roundingIncrement", + "get options.roundingIncrement.valueOf", + "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", +]; const plainRelativeTo = TemporalHelpers.propertyBagObserver(actual, { year: 2001, @@ -214,8 +225,11 @@ instance8.round(createOptionsObserver({ largestUnit: "weeks", smallestUnit: "day assert.compareArray(actual, expectedOpsForDayToWeekBalancing, "order of operations with largestUnit = weeks, smallestUnit = days"); actual.splice(0); // clear -const expectedOpsForZonedRelativeTo = expected.concat([ - // ToRelativeTemporalObject +const expectedOpsForZonedRelativeTo = [ + "get options.largestUnit", + "get options.largestUnit.toString", + "call options.largestUnit.toString", + "get options.relativeTo", "get options.relativeTo.calendar", "has options.relativeTo.calendar.calendar", "get options.relativeTo.calendar.fields", @@ -244,28 +258,37 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.nanosecond", "get options.relativeTo.nanosecond.valueOf", "call options.relativeTo.nanosecond.valueOf", + "get options.relativeTo.offset", + "get options.relativeTo.offset.toString", + "call options.relativeTo.offset.toString", "get options.relativeTo.second", "get options.relativeTo.second.valueOf", "call options.relativeTo.second.valueOf", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", "has options.relativeTo.timeZone.timeZone", - "get options.relativeTo.offset.toString", - "call options.relativeTo.offset.toString", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", "get options.relativeTo.timeZone.getOffsetNanosecondsFor", "call options.relativeTo.timeZone.getOffsetNanosecondsFor", + "get options.roundingIncrement", + "get options.roundingIncrement.valueOf", + "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // RoundDuration → ToTemporalDate "get options.relativeTo.timeZone.getOffsetNanosecondsFor", "call options.relativeTo.timeZone.getOffsetNanosecondsFor", -]); +]; const zonedRelativeTo = TemporalHelpers.propertyBagObserver(actual, { year: 2001, 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 68cc1d3b6b..0819c8786f 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 @@ -89,16 +89,15 @@ const expectedOpsForPlainRelativeTo = expected.concat([ "get options.relativeTo.monthCode.toString", "call options.relativeTo.monthCode.toString", "get options.relativeTo.nanosecond", + "get options.relativeTo.offset", "get options.relativeTo.second", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", // InterpretTemporalDateTimeFields "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - // ToRelativeTemporalObject again - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", // AddDuration "get options.relativeTo.calendar.dateAdd", "call options.relativeTo.calendar.dateAdd", @@ -165,9 +164,13 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.nanosecond", "get options.relativeTo.nanosecond.valueOf", "call options.relativeTo.nanosecond.valueOf", + "get options.relativeTo.offset", + "get options.relativeTo.offset.toString", + "call options.relativeTo.offset.toString", "get options.relativeTo.second", "get options.relativeTo.second.valueOf", "call options.relativeTo.second.valueOf", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", @@ -175,11 +178,7 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", // ToRelativeTemporalObject again - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", "has options.relativeTo.timeZone.timeZone", - "get options.relativeTo.offset.toString", - "call options.relativeTo.offset.toString", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js b/test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js index 4be3a8b6b7..637172da52 100644 --- a/test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js +++ b/test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js @@ -17,10 +17,13 @@ features: [Temporal] const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 650, 0); let string = duration.toString({ fractionalSecondDigits: 2.5 }); -assert.sameValue(string, "P1Y2M3W4DT5H6M7.98S", "fractionalSecondDigits 2.5 truncates to 2"); +assert.sameValue(string, "P1Y2M3W4DT5H6M7.98S", "fractionalSecondDigits 2.5 floors to 2"); string = duration.toString({ fractionalSecondDigits: 9.7 }); -assert.sameValue(string, "P1Y2M3W4DT5H6M7.987650000S", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range"); +assert.sameValue(string, "P1Y2M3W4DT5H6M7.987650000S", "fractionalSecondDigits 9.7 floors to 9 and is not out of range"); -string = duration.toString({ fractionalSecondDigits: -0.6 }); -assert.sameValue(string, "P1Y2M3W4DT5H6M7S", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range"); +assert.throws( + RangeError, + () => duration.toString({ fractionalSecondDigits: -0.6 }), + "fractionalSecondDigits -0.6 floors to -1 and is out of range" +); diff --git a/test/built-ins/Temporal/Duration/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/toString/order-of-operations.js index d4a6613a19..110a68a395 100644 --- a/test/built-ins/Temporal/Duration/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/toString/order-of-operations.js @@ -9,36 +9,32 @@ features: [Temporal] ---*/ const expected = [ - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", -]; -const actual = []; - -const instance = new Temporal.Duration(1, 1, 1, 1, 1, 1, 1, 1, 1, 1); - -instance.toString( - TemporalHelpers.propertyBagObserver(actual, { - fractionalSecondDigits: 3, - roundingMode: "halfExpand", - smallestUnit: "millisecond", - }, "options"), -); -assert.compareArray(actual, expected, "order of operations"); -actual.splice(0); // clear - -const expectedForFractionalSecondDigits = [ - "get options.smallestUnit", "get options.fractionalSecondDigits", "get options.fractionalSecondDigits.toString", "call options.fractionalSecondDigits.toString", "get options.roundingMode", "get options.roundingMode.toString", "call options.roundingMode.toString", + "get options.smallestUnit", ]; +const actual = []; + +const instance = new Temporal.Duration(1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + +const expectedForSmallestUnit = expected.concat([ + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", +]); + +instance.toString( + TemporalHelpers.propertyBagObserver(actual, { + fractionalSecondDigits: "auto", + roundingMode: "halfExpand", + smallestUnit: "millisecond", + }, "options"), +); +assert.compareArray(actual, expectedForSmallestUnit, "order of operations"); +actual.splice(0); // clear instance.toString( TemporalHelpers.propertyBagObserver(actual, { @@ -47,4 +43,4 @@ instance.toString( smallestUnit: undefined, }, "options"), ); -assert.compareArray(actual, expectedForFractionalSecondDigits, "order of operations with smallestUnit undefined"); +assert.compareArray(actual, expected, "order of operations with smallestUnit undefined"); diff --git a/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-fractionalseconddigits.js b/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-fractionalseconddigits.js index 19d1052380..451fea8d77 100644 --- a/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-fractionalseconddigits.js +++ b/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-fractionalseconddigits.js @@ -18,12 +18,12 @@ const tests = [ for (const [smallestUnit, expected] of tests) { const string = duration.toString({ smallestUnit, - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }); assert.sameValue(string, expected, `smallestUnit: "${smallestUnit}" overrides fractionalSecondDigits`); } assert.throws(RangeError, () => duration.toString({ smallestUnit: "hour", - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }), "hour is an invalid smallestUnit but still overrides fractionalSecondDigits"); 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 5a8b504fd4..44aa5e89c9 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 @@ -53,14 +53,14 @@ const expectedOpsForPlainRelativeTo = [ "get options.relativeTo.monthCode.toString", "call options.relativeTo.monthCode.toString", "get options.relativeTo.nanosecond", + "get options.relativeTo.offset", "get options.relativeTo.second", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", // GetTemporalUnit "get options.unit", "get options.unit.toString", @@ -171,19 +171,19 @@ const expectedOpsForZonedRelativeTo = [ "get options.relativeTo.nanosecond", "get options.relativeTo.nanosecond.valueOf", "call options.relativeTo.nanosecond.valueOf", + "get options.relativeTo.offset", + "get options.relativeTo.offset.toString", + "call options.relativeTo.offset.toString", "get options.relativeTo.second", "get options.relativeTo.second.valueOf", "call options.relativeTo.second.valueOf", + "get options.relativeTo.timeZone", "get options.relativeTo.year", "get options.relativeTo.year.valueOf", "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "get options.relativeTo.offset", - "get options.relativeTo.timeZone", "has options.relativeTo.timeZone.timeZone", - "get options.relativeTo.offset.toString", - "call options.relativeTo.offset.toString", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Instant/prototype/since/order-of-operations.js b/test/built-ins/Temporal/Instant/prototype/since/order-of-operations.js index f23d54ebcc..0d01f39932 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/Instant/prototype/since/order-of-operations.js @@ -11,18 +11,18 @@ features: [Temporal] const expected = [ "get other.toString", "call other.toString", - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; diff --git a/test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js b/test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js index ef91211f35..800c9f94d0 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js @@ -17,10 +17,13 @@ features: [Temporal] const instant = new Temporal.Instant(1_000_000_000_987_650_000n); let string = instant.toString({ fractionalSecondDigits: 2.5 }); -assert.sameValue(string, "2001-09-09T01:46:40.98Z", "fractionalSecondDigits 2.5 truncates to 2"); +assert.sameValue(string, "2001-09-09T01:46:40.98Z", "fractionalSecondDigits 2.5 floors to 2"); string = instant.toString({ fractionalSecondDigits: 9.7 }); -assert.sameValue(string, "2001-09-09T01:46:40.987650000Z", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range"); +assert.sameValue(string, "2001-09-09T01:46:40.987650000Z", "fractionalSecondDigits 9.7 floors to 9 and is not out of range"); -string = instant.toString({ fractionalSecondDigits: -0.6 }); -assert.sameValue(string, "2001-09-09T01:46:40Z", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range"); +assert.throws( + RangeError, + () => instant.toString({ fractionalSecondDigits: -0.6 }), + "fractionalSecondDigits -0.6 floors to -1 and is out of range" +); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js index 3058d55baf..bdec0d3efb 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js @@ -9,14 +9,17 @@ features: [Temporal] ---*/ const expected = [ - "get options.timeZone", - "has options.timeZone.timeZone", - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", + "get options.fractionalSecondDigits", + "get options.fractionalSecondDigits.toString", + "call options.fractionalSecondDigits.toString", "get options.roundingMode", "get options.roundingMode.toString", "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", + "get options.timeZone", + "has options.timeZone.timeZone", "get options.timeZone.getOffsetNanosecondsFor", "call options.timeZone.getOffsetNanosecondsFor", "get options.timeZone.getOffsetNanosecondsFor", @@ -28,7 +31,7 @@ const instance = new Temporal.Instant(0n); instance.toString( TemporalHelpers.propertyBagObserver(actual, { - fractionalSecondDigits: 3, + fractionalSecondDigits: "auto", roundingMode: "halfExpand", smallestUnit: "millisecond", timeZone: TemporalHelpers.timeZoneObserver(actual, "options.timeZone"), @@ -38,14 +41,14 @@ assert.compareArray(actual, expected, "order of operations"); actual.splice(0); // clear const expectedForFractionalSecondDigits = [ - "get options.timeZone", - "get options.smallestUnit", "get options.fractionalSecondDigits", "get options.fractionalSecondDigits.toString", "call options.fractionalSecondDigits.toString", "get options.roundingMode", "get options.roundingMode.toString", "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.timeZone", ]; instance.toString( diff --git a/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-fractionalseconddigits.js b/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-fractionalseconddigits.js index 73d8f9aaf9..131825bbb4 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-fractionalseconddigits.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-fractionalseconddigits.js @@ -19,12 +19,12 @@ const tests = [ for (const [smallestUnit, expected] of tests) { const string = instant.toString({ smallestUnit, - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }); assert.sameValue(string, expected, `smallestUnit: "${smallestUnit}" overrides fractionalSecondDigits`); } assert.throws(RangeError, () => instant.toString({ smallestUnit: "hour", - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }), "hour is an invalid smallestUnit but still overrides fractionalSecondDigits"); diff --git a/test/built-ins/Temporal/Instant/prototype/until/order-of-operations.js b/test/built-ins/Temporal/Instant/prototype/until/order-of-operations.js index 1529933a8b..5e6ff190cc 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/Instant/prototype/until/order-of-operations.js @@ -11,18 +11,18 @@ features: [Temporal] const expected = [ "get other.toString", "call other.toString", - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; diff --git a/test/built-ins/Temporal/PlainDate/from/calendar-fields-custom.js b/test/built-ins/Temporal/PlainDate/from/calendar-fields-custom.js index 7a18c12c8d..bf3686bed0 100644 --- a/test/built-ins/Temporal/PlainDate/from/calendar-fields-custom.js +++ b/test/built-ins/Temporal/PlainDate/from/calendar-fields-custom.js @@ -13,7 +13,7 @@ class CustomCalendar extends Temporal.Calendar { super("iso8601"); } dateFromFields(fields) { - assert.compareArray(Object.keys(fields), ["b", "a"]); + assert.compareArray(Object.keys(fields), ["a", "b"]); return new Temporal.PlainDate(2020, 7, 4); } fields(fields) { @@ -30,6 +30,6 @@ const plainDate = Temporal.PlainDate.from(item); TemporalHelpers.assertPlainDate(plainDate, 2020, 7, "M07", 4); assert.compareArray(actual, [ "get item.calendar", - "get item.b", "get item.a", + "get item.b", ]); 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 1a65dc2a2e..3acabec650 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 @@ -36,18 +36,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CopyDataProperties "ownKeys options", "getOwnPropertyDescriptor options.roundingIncrement", 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 5498d8f1b9..ee0215edd0 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 @@ -36,18 +36,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CopyDataProperties "ownKeys options", "getOwnPropertyDescriptor options.roundingIncrement", 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 99e548df82..16eca7a316 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 @@ -54,18 +54,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CopyDataProperties "ownKeys options", "getOwnPropertyDescriptor options.roundingIncrement", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js index b3200474e7..73d8b7522c 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js @@ -17,10 +17,13 @@ features: [Temporal] const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0); let string = datetime.toString({ fractionalSecondDigits: 2.5 }); -assert.sameValue(string, "2000-05-02T12:34:56.98", "fractionalSecondDigits 2.5 truncates to 2"); +assert.sameValue(string, "2000-05-02T12:34:56.98", "fractionalSecondDigits 2.5 floors to 2"); string = datetime.toString({ fractionalSecondDigits: 9.7 }); -assert.sameValue(string, "2000-05-02T12:34:56.987650000", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range"); +assert.sameValue(string, "2000-05-02T12:34:56.987650000", "fractionalSecondDigits 9.7 floors to 9 and is not out of range"); -string = datetime.toString({ fractionalSecondDigits: -0.6 }); -assert.sameValue(string, "2000-05-02T12:34:56", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range"); +assert.throws( + RangeError, + () => datetime.toString({ fractionalSecondDigits: -0.6 }), + "fractionalSecondDigits -0.6 floors to -1 and is out of range" +); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/order-of-operations.js index 68fd6a5684..5596255315 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/order-of-operations.js @@ -9,12 +9,18 @@ features: [Temporal] ---*/ const expected = [ - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.calendarName", "get options.calendarName.toString", "call options.calendarName.toString", + "get options.fractionalSecondDigits", + "get options.fractionalSecondDigits.toString", + "call options.fractionalSecondDigits.toString", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", "get this.calendar[Symbol.toPrimitive]", "get this.calendar.toString", "call this.calendar.toString", @@ -26,29 +32,33 @@ const instance = new Temporal.PlainDateTime(1990, 11, 3, 15, 54, 37, 123, 456, 7 // clear observable operations that occurred during the constructor call actual.splice(0); -const expectedForSmallestUnit = [ - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", -].concat(expected); - instance.toString( TemporalHelpers.propertyBagObserver(actual, { - fractionalSecondDigits: 3, + fractionalSecondDigits: "auto", roundingMode: "halfExpand", smallestUnit: "millisecond", calendarName: "auto", }, "options"), ); -assert.compareArray(actual, expectedForSmallestUnit, "order of operations"); +assert.compareArray(actual, expected, "order of operations"); actual.splice(0); // clear +// Same as above but without options.smallestUnit.toString const expectedForFractionalSecondDigits = [ - "get options.smallestUnit", + "get options.calendarName", + "get options.calendarName.toString", + "call options.calendarName.toString", "get options.fractionalSecondDigits", "get options.fractionalSecondDigits.toString", "call options.fractionalSecondDigits.toString", -].concat(expected); + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get this.calendar[Symbol.toPrimitive]", + "get this.calendar.toString", + "call this.calendar.toString", +]; instance.toString( TemporalHelpers.propertyBagObserver(actual, { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-fractionalseconddigits.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-fractionalseconddigits.js index 9918d045fc..629513c95c 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-fractionalseconddigits.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-fractionalseconddigits.js @@ -19,12 +19,12 @@ const tests = [ for (const [smallestUnit, expected] of tests) { const string = datetime.toString({ smallestUnit, - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }); assert.sameValue(string, expected, `smallestUnit: "${smallestUnit}" overrides fractionalSecondDigits`); } assert.throws(RangeError, () => datetime.toString({ smallestUnit: "hour", - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }), "hour is an invalid smallestUnit but still overrides fractionalSecondDigits"); 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 8e43d25037..2d437c434f 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 @@ -54,18 +54,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CopyDataProperties "ownKeys options", "getOwnPropertyDescriptor options.roundingIncrement", diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainTime/prototype/since/order-of-operations.js index 66b0ac28f0..ae337f47e0 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainTime/prototype/since/order-of-operations.js @@ -32,18 +32,18 @@ const expected = [ "get other.second.valueOf", "call other.second.valueOf", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; diff --git a/test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js b/test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js index 5bbbf63f48..da5051f155 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js @@ -17,10 +17,13 @@ features: [Temporal] const time = new Temporal.PlainTime(12, 34, 56, 987, 650, 0); let string = time.toString({ fractionalSecondDigits: 2.5 }); -assert.sameValue(string, "12:34:56.98", "fractionalSecondDigits 2.5 truncates to 2"); +assert.sameValue(string, "12:34:56.98", "fractionalSecondDigits 2.5 floors to 2"); string = time.toString({ fractionalSecondDigits: 9.7 }); -assert.sameValue(string, "12:34:56.987650000", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range"); +assert.sameValue(string, "12:34:56.987650000", "fractionalSecondDigits 9.7 floors to 9 and is not out of range"); -string = time.toString({ fractionalSecondDigits: -0.6 }); -assert.sameValue(string, "12:34:56", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range"); +assert.throws( + RangeError, + () => time.toString({ fractionalSecondDigits: -0.6 }), + "fractionalSecondDigits -0.6 floors to -1 and is out of range" +); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/PlainTime/prototype/toString/order-of-operations.js index d3f599fcff..e475a0b770 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toString/order-of-operations.js @@ -9,36 +9,32 @@ features: [Temporal] ---*/ const expected = [ - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", -]; -const actual = []; - -const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); - -instance.toString( - TemporalHelpers.propertyBagObserver(actual, { - fractionalSecondDigits: 3, - roundingMode: "halfExpand", - smallestUnit: "millisecond", - }, "options"), -); -assert.compareArray(actual, expected, "order of operations"); -actual.splice(0); // clear - -const expectedForFractionalSecondDigits = [ - "get options.smallestUnit", "get options.fractionalSecondDigits", "get options.fractionalSecondDigits.toString", "call options.fractionalSecondDigits.toString", "get options.roundingMode", "get options.roundingMode.toString", "call options.roundingMode.toString", + "get options.smallestUnit", ]; +const actual = []; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +const expectedForSmallestUnit = expected.concat([ + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", +]); + +instance.toString( + TemporalHelpers.propertyBagObserver(actual, { + fractionalSecondDigits: "auto", + roundingMode: "halfExpand", + smallestUnit: "millisecond", + }, "options"), +); +assert.compareArray(actual, expectedForSmallestUnit, "order of operations"); +actual.splice(0); // clear instance.toString( TemporalHelpers.propertyBagObserver(actual, { @@ -47,4 +43,4 @@ instance.toString( smallestUnit: undefined, }, "options"), ); -assert.compareArray(actual, expectedForFractionalSecondDigits, "order of operations with smallestUnit undefined"); +assert.compareArray(actual, expected, "order of operations with smallestUnit undefined"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-fractionalseconddigits.js b/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-fractionalseconddigits.js index 318041efa0..2a7f5163d7 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-fractionalseconddigits.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-fractionalseconddigits.js @@ -19,12 +19,12 @@ const tests = [ for (const [smallestUnit, expected] of tests) { const string = time.toString({ smallestUnit, - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }); assert.sameValue(string, expected, `smallestUnit: "${smallestUnit}" overrides fractionalSecondDigits`); } assert.throws(RangeError, () => time.toString({ smallestUnit: "hour", - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }), "hour is an invalid smallestUnit but still overrides fractionalSecondDigits"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainTime/prototype/until/order-of-operations.js index 37ff6793b3..9a8f60a492 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainTime/prototype/until/order-of-operations.js @@ -32,18 +32,18 @@ const expected = [ "get other.second.valueOf", "call other.second.valueOf", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; 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 9438ec949f..726f3554db 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 @@ -33,18 +33,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CalendarFields / PrepareTemporalFields / CalendarDateFromFields "get this.calendar.fields", "call this.calendar.fields", diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/copies-merge-fields-object.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/copies-merge-fields-object.js index ae24d79a26..a8073321a9 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/copies-merge-fields-object.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/copies-merge-fields-object.js @@ -13,15 +13,15 @@ features: [Temporal] ---*/ const expected = [ + "get day", + "get day.valueOf", + "call day.valueOf", "get monthCode", "get monthCode.toString", "call monthCode.toString", "get year", "get year.valueOf", "call year.valueOf", - "get day", // first receiver fields, then input fields - "get day.valueOf", - "call day.valueOf", ]; const calendar = TemporalHelpers.calendarMergeFieldsGetters(); 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 6b5d56b5c0..b572834414 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 @@ -33,18 +33,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", // CalendarFields / PrepareTemporalFields / CalendarDateFromFields "get this.calendar.fields", "call this.calendar.fields", 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 aa02e88168..a2318aee61 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js @@ -38,16 +38,16 @@ const expected = [ "get one.nanosecond", "get one.nanosecond.valueOf", "call one.nanosecond.valueOf", - "get one.second", - "get one.second.valueOf", - "call one.second.valueOf", - "get one.year", - "get one.year.valueOf", - "call one.year.valueOf", - "get one.timeZone", "get one.offset", "get one.offset.toString", "call one.offset.toString", + "get one.second", + "get one.second.valueOf", + "call one.second.valueOf", + "get one.timeZone", + "get one.year", + "get one.year.valueOf", + "call one.year.valueOf", "has one.timeZone.timeZone", // InterpretTemporalDateTimeFields "get one.calendar.dateFromFields", @@ -87,16 +87,16 @@ const expected = [ "get two.nanosecond", "get two.nanosecond.valueOf", "call two.nanosecond.valueOf", - "get two.second", - "get two.second.valueOf", - "call two.second.valueOf", - "get two.year", - "get two.year.valueOf", - "call two.year.valueOf", - "get two.timeZone", "get two.offset", "get two.offset.toString", "call two.offset.toString", + "get two.second", + "get two.second.valueOf", + "call two.second.valueOf", + "get two.timeZone", + "get two.year", + "get two.year.valueOf", + "call two.year.valueOf", "has two.timeZone.timeZone", // InterpretTemporalDateTimeFields "get two.calendar.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 c32f5be23a..2fc0b85b7d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js @@ -38,18 +38,24 @@ const expected = [ "get item.nanosecond", "get item.nanosecond.valueOf", "call item.nanosecond.valueOf", - "get item.second", - "get item.second.valueOf", - "call item.second.valueOf", - "get item.year", - "get item.year.valueOf", - "call item.year.valueOf", - "get item.timeZone", "get item.offset", "get item.offset.toString", "call item.offset.toString", + "get item.second", + "get item.second.valueOf", + "call item.second.valueOf", + "get item.timeZone", + "get item.year", + "get item.year.valueOf", + "call item.year.valueOf", "has item.timeZone.timeZone", // InterpretTemporalDateTimeFields + "get options.disambiguation", + "get options.disambiguation.toString", + "call options.disambiguation.toString", + "get options.offset", + "get options.offset.toString", + "call options.offset.toString", "get options.overflow", "get options.overflow.toString", "call options.overflow.toString", @@ -59,14 +65,6 @@ const expected = [ "get options.overflow", "get options.overflow.toString", "call options.overflow.toString", - // ToTemporalDisambiguation - "get options.disambiguation", - "get options.disambiguation.toString", - "call options.disambiguation.toString", - // ToTemporalOffset - "get options.offset", - "get options.offset.toString", - "call options.offset.toString", // InterpretISODateTimeOffset "get item.timeZone.getPossibleInstantsFor", "call item.timeZone.getPossibleInstantsFor", 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 cd9251da32..f45365a849 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 @@ -38,16 +38,16 @@ const expected = [ "get other.nanosecond", "get other.nanosecond.valueOf", "call other.nanosecond.valueOf", - "get other.second", - "get other.second.valueOf", - "call other.second.valueOf", - "get other.year", - "get other.year.valueOf", - "call other.year.valueOf", - "get other.timeZone", "get other.offset", "get other.offset.toString", "call other.offset.toString", + "get other.second", + "get other.second.valueOf", + "call other.second.valueOf", + "get other.timeZone", + "get other.year", + "get other.year.valueOf", + "call other.year.valueOf", "has other.timeZone.timeZone", // InterpretTemporalDateTimeFields "get other.calendar.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 850259169b..08f759a5b6 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 @@ -38,16 +38,16 @@ const expected = [ "get other.nanosecond", "get other.nanosecond.valueOf", "call other.nanosecond.valueOf", - "get other.second", - "get other.second.valueOf", - "call other.second.valueOf", - "get other.year", - "get other.year.valueOf", - "call other.year.valueOf", - "get other.timeZone", "get other.offset", "get other.offset.toString", "call other.offset.toString", + "get other.second", + "get other.second.valueOf", + "call other.second.valueOf", + "get other.timeZone", + "get other.year", + "get other.year.valueOf", + "call other.year.valueOf", "has other.timeZone.timeZone", "get other.calendar.dateFromFields", "call other.calendar.dateFromFields", @@ -63,18 +63,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer.js index feb7c6e2df..6cd26885fc 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer.js @@ -17,10 +17,13 @@ features: [Temporal] const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_650_000n, "UTC"); let string = datetime.toString({ fractionalSecondDigits: 2.5 }); -assert.sameValue(string, "2001-09-09T01:46:40.98+00:00[UTC]", "fractionalSecondDigits 2.5 truncates to 2"); +assert.sameValue(string, "2001-09-09T01:46:40.98+00:00[UTC]", "fractionalSecondDigits 2.5 floors to 2"); string = datetime.toString({ fractionalSecondDigits: 9.7 }); -assert.sameValue(string, "2001-09-09T01:46:40.987650000+00:00[UTC]", "fractionalSecondDigits 9.7 truncates to 9 and is not out of range"); +assert.sameValue(string, "2001-09-09T01:46:40.987650000+00:00[UTC]", "fractionalSecondDigits 9.7 floors to 9 and is not out of range"); -string = datetime.toString({ fractionalSecondDigits: -0.6 }); -assert.sameValue(string, "2001-09-09T01:46:40+00:00[UTC]", "fractionalSecondDigits -0.6 truncates to 0 and is not out of range"); +assert.throws( + RangeError, + () => datetime.toString({ fractionalSecondDigits: -0.6 }), + "fractionalSecondDigits -0.6 floors to -1 and is out of range" +); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/order-of-operations.js index a8e3341ed9..9c11a5cd9d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/order-of-operations.js @@ -9,18 +9,24 @@ features: [Temporal] ---*/ const expected = [ - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.calendarName", "get options.calendarName.toString", "call options.calendarName.toString", - "get options.timeZoneName", - "get options.timeZoneName.toString", - "call options.timeZoneName.toString", + "get options.fractionalSecondDigits", + "get options.fractionalSecondDigits.toString", + "call options.fractionalSecondDigits.toString", "get options.offset", "get options.offset.toString", "call options.offset.toString", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", + "get options.timeZoneName", + "get options.timeZoneName.toString", + "call options.timeZoneName.toString", "get this.timeZone.getOffsetNanosecondsFor", "call this.timeZone.getOffsetNanosecondsFor", "get this.timeZone.getOffsetNanosecondsFor", @@ -40,15 +46,9 @@ const instance = new Temporal.ZonedDateTime(0n, timeZone, calendar); // clear observable operations that occurred during the constructor call actual.splice(0); -const expectedForSmallestUnit = [ - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", -].concat(expected); - instance.toString( TemporalHelpers.propertyBagObserver(actual, { - fractionalSecondDigits: 3, + fractionalSecondDigits: "auto", roundingMode: "halfExpand", smallestUnit: "millisecond", offset: "auto", @@ -56,15 +56,38 @@ instance.toString( calendarName: "auto", }, "options"), ); -assert.compareArray(actual, expectedForSmallestUnit, "order of operations"); +assert.compareArray(actual, expected, "order of operations"); actual.splice(0); // clear +// Same as above but without accessing options.smallestUnit.toString const expectedForFractionalSecondDigits = [ - "get options.smallestUnit", + "get options.calendarName", + "get options.calendarName.toString", + "call options.calendarName.toString", "get options.fractionalSecondDigits", "get options.fractionalSecondDigits.toString", "call options.fractionalSecondDigits.toString", -].concat(expected); + "get options.offset", + "get options.offset.toString", + "call options.offset.toString", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.timeZoneName", + "get options.timeZoneName.toString", + "call options.timeZoneName.toString", + "get this.timeZone.getOffsetNanosecondsFor", + "call this.timeZone.getOffsetNanosecondsFor", + "get this.timeZone.getOffsetNanosecondsFor", + "call this.timeZone.getOffsetNanosecondsFor", + "get this.timeZone[Symbol.toPrimitive]", + "get this.timeZone.toString", + "call this.timeZone.toString", + "get this.calendar[Symbol.toPrimitive]", + "get this.calendar.toString", + "call this.calendar.toString", +]; instance.toString( TemporalHelpers.propertyBagObserver(actual, { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits.js index 7845c10bfb..2fa1e31678 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits.js @@ -19,12 +19,12 @@ const tests = [ for (const [smallestUnit, expected] of tests) { const string = datetime.toString({ smallestUnit, - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }); assert.sameValue(string, expected, `smallestUnit: "${smallestUnit}" overrides fractionalSecondDigits`); } assert.throws(RangeError, () => datetime.toString({ smallestUnit: "hour", - get fractionalSecondDigits() { throw new Test262Error("should not get fractionalSecondDigits") } + fractionalSecondDigits: 5, }), "hour is an invalid smallestUnit but still overrides fractionalSecondDigits"); 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 ed87ea4c4f..081d5e66f3 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 @@ -38,16 +38,16 @@ const expected = [ "get other.nanosecond", "get other.nanosecond.valueOf", "call other.nanosecond.valueOf", - "get other.second", - "get other.second.valueOf", - "call other.second.valueOf", - "get other.year", - "get other.year.valueOf", - "call other.year.valueOf", - "get other.timeZone", "get other.offset", "get other.offset.toString", "call other.offset.toString", + "get other.second", + "get other.second.valueOf", + "call other.second.valueOf", + "get other.timeZone", + "get other.year", + "get other.year.valueOf", + "call other.year.valueOf", "has other.timeZone.timeZone", "get other.calendar.dateFromFields", "call other.calendar.dateFromFields", @@ -63,18 +63,18 @@ const expected = [ "get other.calendar.toString", "call other.calendar.toString", // GetDifferenceSettings - "get options.smallestUnit", - "get options.smallestUnit.toString", - "call options.smallestUnit.toString", "get options.largestUnit", "get options.largestUnit.toString", "call options.largestUnit.toString", - "get options.roundingMode", - "get options.roundingMode.toString", - "call options.roundingMode.toString", "get options.roundingIncrement", "get options.roundingIncrement.valueOf", "call options.roundingIncrement.valueOf", + "get options.roundingMode", + "get options.roundingMode.toString", + "call options.roundingMode.toString", + "get options.smallestUnit", + "get options.smallestUnit.toString", + "call options.smallestUnit.toString", ]; const actual = []; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/with/copies-merge-fields-object.js b/test/built-ins/Temporal/ZonedDateTime/prototype/with/copies-merge-fields-object.js index b62f3f98b8..47094a91f6 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/with/copies-merge-fields-object.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/with/copies-merge-fields-object.js @@ -40,16 +40,16 @@ const expected = [ "get nanosecond", "get nanosecond.valueOf", "call nanosecond.valueOf", - "get second", - "get second.valueOf", - "call second.valueOf", - "get year", - "get year.valueOf", - "call year.valueOf", "get offset", "get offset.toString", "call offset.toString", + "get second", + "get second.valueOf", + "call second.valueOf", "get timeZone", + "get year", + "get year.valueOf", + "call year.valueOf", ]; const calendar = TemporalHelpers.calendarMergeFieldsGetters(); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/with/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/with/order-of-operations.js index b4b1340be8..27096ad5c5 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/with/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/with/order-of-operations.js @@ -39,22 +39,15 @@ const expected = [ "get fields.nanosecond", "get fields.nanosecond.valueOf", "call fields.nanosecond.valueOf", + "get fields.offset", + "get fields.offset.toString", + "call fields.offset.toString", "get fields.second", "get fields.second.valueOf", "call fields.second.valueOf", "get fields.year", "get fields.year.valueOf", "call fields.year.valueOf", - "get fields.offset", - "get fields.offset.toString", - "call fields.offset.toString", - // options - "get options.disambiguation", - "get options.disambiguation.toString", - "call options.disambiguation.toString", - "get options.offset", - "get options.offset.toString", - "call options.offset.toString", // PrepareTemporalFields "get this.timeZone.getOffsetNanosecondsFor", "call this.timeZone.getOffsetNanosecondsFor", @@ -78,18 +71,24 @@ const expected = [ "call this.calendar.monthCode", "get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.nanosecond "call this.timeZone.getOffsetNanosecondsFor", + "get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.offset + "call this.timeZone.getOffsetNanosecondsFor", "get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.second "call this.timeZone.getOffsetNanosecondsFor", "get this.timeZone.getOffsetNanosecondsFor", "call this.timeZone.getOffsetNanosecondsFor", "get this.calendar.year", "call this.calendar.year", - "get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.offset - "call this.timeZone.getOffsetNanosecondsFor", // CalendarMergeFields "get this.calendar.mergeFields", "call this.calendar.mergeFields", // InterpretTemporalDateTimeFields + "get options.disambiguation", + "get options.disambiguation.toString", + "call options.disambiguation.toString", + "get options.offset", + "get options.offset.toString", + "call options.offset.toString", "get options.overflow", "get options.overflow.toString", "call options.overflow.toString",