Temporal: Add clarifying assertion messages

normalized-time-duration-to-days-range-errors.js tests for several error
cases in the AO NormalizedTimeDurationToDays. Adding assertion messages
helps to know which one you are debugging.
This commit is contained in:
Philip Chimento 2024-02-23 08:17:53 -08:00 committed by Ms2ger
parent 0c12b84244
commit c8a876b1d9
2 changed files with 12 additions and 6 deletions

View File

@ -62,7 +62,8 @@ assert.throws(RangeError, () =>
start.since( start.since(
oneZDT, // Sets DifferenceZonedDateTime _ns2_ oneZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"days < 0 and sign = 1"
); );
// Step 24: days > 0 and sign = -1 // Step 24: days > 0 and sign = -1
@ -86,7 +87,8 @@ assert.throws(RangeError, () =>
start.since( start.since(
zeroZDT, // Sets DifferenceZonedDateTime _ns2_ zeroZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"days > 0 and sign = -1"
); );
// Step 26: nanoseconds > 0 and sign = -1 // Step 26: nanoseconds > 0 and sign = -1
@ -110,7 +112,8 @@ assert.throws(RangeError, () =>
start.since( start.since(
zeroZDT, // Sets DifferenceZonedDateTime _ns2_ zeroZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"norm > 0 and sign = -1"
); );
// Step 29: day length is an unsafe integer // Step 29: day length is an unsafe integer

View File

@ -62,7 +62,8 @@ assert.throws(RangeError, () =>
start.until( start.until(
oneZDT, // Sets DifferenceZonedDateTime _ns2_ oneZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"days < 0 and sign = 1"
); );
// Step 24: days > 0 and sign = -1 // Step 24: days > 0 and sign = -1
@ -86,7 +87,8 @@ assert.throws(RangeError, () =>
start.until( start.until(
zeroZDT, // Sets DifferenceZonedDateTime _ns2_ zeroZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"days > 0 and sign = -1"
); );
// Step 26: nanoseconds > 0 and sign = -1 // Step 26: nanoseconds > 0 and sign = -1
@ -110,7 +112,8 @@ assert.throws(RangeError, () =>
start.until( start.until(
zeroZDT, // Sets DifferenceZonedDateTime _ns2_ zeroZDT, // Sets DifferenceZonedDateTime _ns2_
options options
) ),
"norm > 0 and sign = -1"
); );
// Step 29: day length is an unsafe integer // Step 29: day length is an unsafe integer