From bea421c1dc1ffaf922d42584169dab40c1f6585d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 27 Jul 2022 13:48:32 +0200 Subject: [PATCH] Update tests which used negative day lengths Negative day lengths are no longer valid after . --- .../round/smallest-unit-day-daylength-too-large.js | 9 ++++----- .../smallest-unit-day-daylength-zero-or-negative.js | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-too-large.js b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-too-large.js index e715938123..b305fb9272 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-too-large.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-too-large.js @@ -9,7 +9,8 @@ info: | Temporal.ZonedDateTime.prototype.round ( roundTo ) ... 18. Let dayLengthNs be ℝ(endNs - startNs). - ... + 19. If dayLengthNs ≤ 0, then + a. Throw a RangeError exception. 20. Let roundResult be ! RoundISODateTime(temporalDateTime.[[ISOYear]], temporalDateTime.[[ISOMonth]], temporalDateTime.[[ISODay]], temporalDateTime.[[ISOHour]], temporalDateTime.[[ISOMinute]], temporalDateTime.[[ISOSecond]], @@ -74,12 +75,10 @@ const oneDay = 24n * 60n * 60n * 1000n * 1000n * 1000n { let tz = new TimeZone(minInstant); let zoned = new Temporal.ZonedDateTime(0n, tz); - let result = zoned.round({ smallestUnit: "days" }); - assert(zoned.equals(result)); + assert.throws(RangeError, () => zoned.round({ smallestUnit: "days" })); } { let tz = new TimeZone(minInstant); let zoned = new Temporal.ZonedDateTime(maxInstant - oneDay, tz); - let result = zoned.round({ smallestUnit: "days" }); - assert(zoned.equals(result)); + assert.throws(RangeError, () => zoned.round({ smallestUnit: "days" })); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-zero-or-negative.js b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-zero-or-negative.js index 2103a0e6c3..747c628530 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-zero-or-negative.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallest-unit-day-daylength-zero-or-negative.js @@ -9,7 +9,7 @@ info: | Temporal.ZonedDateTime.prototype.round ( roundTo ) ... 18. Let dayLengthNs be ℝ(endNs - startNs). - 19. If dayLengthNs is 0, then + 19. If dayLengthNs ≤ 0, then a. Throw a RangeError exception. 20. Let roundResult be ! RoundISODateTime(temporalDateTime.[[ISOYear]], temporalDateTime.[[ISOMonth]], temporalDateTime.[[ISODay]], temporalDateTime.[[ISOHour]], @@ -62,6 +62,5 @@ class TimeZone extends Temporal.TimeZone { { let tz = new TimeZone(-1n); let zoned = new Temporal.ZonedDateTime(0n, tz); - let result = zoned.round({ smallestUnit: "days" }); - assert(zoned.equals(result)); + assert.throws(RangeError, () => zoned.round({ smallestUnit: "days" })); }