From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- ...ormalized-time-duration-to-days-range-errors.js | 51 ++++++++++++++-------- 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/normalized-time-duration-to-days-range-errors.js') diff --git a/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/normalized-time-duration-to-days-range-errors.js b/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/normalized-time-duration-to-days-range-errors.js index 178b1c981b..479dcf0b0c 100644 --- a/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/normalized-time-duration-to-days-range-errors.js +++ b/js/src/tests/test262/built-ins/Temporal/ZonedDateTime/prototype/until/normalized-time-duration-to-days-range-errors.js @@ -8,12 +8,12 @@ description: > RangeErrors. info: | NormalizedTimeDurationToDays ( norm, zonedRelativeTo, timeZoneRec [ , precalculatedPlainDateTime ] ) - 22. If days < 0 and sign = 1, throw a RangeError exception. - 23. If days > 0 and sign = -1, throw a RangeError exception. + 23. If days < 0 and sign = 1, throw a RangeError exception. + 24. If days > 0 and sign = -1, throw a RangeError exception. ... - 25. If NormalizedTimeDurationSign(_norm_) = 1 and sign = -1, throw a RangeError exception. + 26. If NormalizedTimeDurationSign(_norm_) = 1 and sign = -1, throw a RangeError exception. ... - 28. If dayLength ≥ 2⁵³, throw a RangeError exception. + 29. If dayLength ≥ 2⁵³, throw a RangeError exception. features: [Temporal, BigInt] includes: [temporalHelpers.js] ---*/ @@ -40,13 +40,16 @@ const dayNs = 86_400_000_000_000; const zeroZDT = new Temporal.ZonedDateTime(0n, "UTC"); const oneZDT = new Temporal.ZonedDateTime(1n, "UTC"); const epochInstant = new Temporal.Instant(0n); -const options = { largestUnit: "days" }; +const options = { largestUnit: "days", smallestUnit: "seconds", roundingMode: "expand" }; -// Step 22: days < 0 and sign = 1 +// Step 23: days < 0 and sign = 1 let start = new Temporal.ZonedDateTime( 0n, // Sets DifferenceZonedDateTime _ns1_ timeZoneSubstituteValues( - [[epochInstant]], // Returned in step 16, setting _relativeResult_ + [ + TemporalHelpers.SUBSTITUTE_SKIP, // Behave normally in DifferenceZonedDateTime + [epochInstant], // Returned in step 16, setting _relativeResult_ + ], [ // Behave normally in 2 calls made prior to NormalizedTimeDurationToDays TemporalHelpers.SUBSTITUTE_SKIP, @@ -60,14 +63,18 @@ assert.throws(RangeError, () => start.until( oneZDT, // Sets DifferenceZonedDateTime _ns2_ options - ) + ), + "days < 0 and sign = 1" ); -// Step 23: days > 0 and sign = -1 +// Step 24: days > 0 and sign = -1 start = new Temporal.ZonedDateTime( 1n, // Sets DifferenceZonedDateTime _ns1_ timeZoneSubstituteValues( - [[epochInstant]], // Returned in step 16, setting _relativeResult_ + [ + TemporalHelpers.SUBSTITUTE_SKIP, // Behave normally in DifferenceZonedDateTime + [epochInstant], // Returned in step 16, setting _relativeResult_ + ], [ // Behave normally in 2 calls made prior to NormalizedTimeDurationToDays TemporalHelpers.SUBSTITUTE_SKIP, @@ -81,14 +88,18 @@ assert.throws(RangeError, () => start.until( zeroZDT, // Sets DifferenceZonedDateTime _ns2_ options - ) + ), + "days > 0 and sign = -1" ); -// Step 25: nanoseconds > 0 and sign = -1 +// Step 26: nanoseconds > 0 and sign = -1 start = new Temporal.ZonedDateTime( 1n, // Sets DifferenceZonedDateTime _ns1_ timeZoneSubstituteValues( - [[new Temporal.Instant(-1n)]], // Returned in step 16, setting _relativeResult_ + [ + TemporalHelpers.SUBSTITUTE_SKIP, // Behave normally in DifferenceZonedDateTime + [new Temporal.Instant(-2_000_000_000n)], // Returned in step 16, setting _relativeResult_ + ], [ // Behave normally in 2 calls made prior to NormalizedTimeDurationToDays TemporalHelpers.SUBSTITUTE_SKIP, @@ -102,16 +113,20 @@ assert.throws(RangeError, () => start.until( zeroZDT, // Sets DifferenceZonedDateTime _ns2_ options - ) + ), + "norm > 0 and sign = -1" ); -// Step 28: day length is an unsafe integer +// Step 29: day length is an unsafe integer start = new Temporal.ZonedDateTime( 0n, timeZoneSubstituteValues( - // Not called in step 16 because _days_ = 0 - // Returned in step 21.a, making _oneDayFarther_ 2^53 ns later than _relativeResult_ - [[new Temporal.Instant(2n ** 53n)]], + [ + TemporalHelpers.SUBSTITUTE_SKIP, // Behave normally in DifferenceZonedDateTime + // Not called in step 16 because _days_ = 0 + // Returned in step 19, making _oneDayFarther_ 2^53 ns later than _relativeResult_ + [new Temporal.Instant(2n ** 53n)], + ], [] ) ); -- cgit v1.2.3