Improve comments and assertion messages

This commit is contained in:
Philip Chimento 2023-03-03 14:48:55 -08:00 committed by Ms2ger
parent c03a58ba35
commit dd47e4e248
2 changed files with 13 additions and 7 deletions

View File

@ -54,7 +54,8 @@ assert.throws(RangeError, () =>
oneNsDuration.round({ oneNsDuration.round({
relativeTo: zdt, relativeTo: zdt,
smallestUnit: "days", smallestUnit: "days",
}) }),
"RangeError when days < 0 and sign = 1"
); );
// NanosecondsToDays.20: days > 0 and sign = -1 // NanosecondsToDays.20: days > 0 and sign = -1
@ -74,7 +75,8 @@ assert.throws(RangeError, () =>
negOneNsDuration.round({ negOneNsDuration.round({
relativeTo: zdt, relativeTo: zdt,
smallestUnit: "days", smallestUnit: "days",
}) }),
"RangeError when days > 0 and sign = -1"
); );
// NanosecondsToDays.22: nanoseconds > 0 and sign = -1 // NanosecondsToDays.22: nanoseconds > 0 and sign = -1
@ -93,9 +95,10 @@ zdt = new Temporal.ZonedDateTime(
) )
); );
assert.throws(RangeError, () => assert.throws(RangeError, () =>
// Using -1ns duration sets _nanoseocnds_ to -1 and _sign_ to -1 // Using -1ns duration sets _nanoseconds_ to -1 and _sign_ to -1
negOneNsDuration.round({ negOneNsDuration.round({
relativeTo: zdt, relativeTo: zdt,
smallestUnit: "days", smallestUnit: "days",
}) }),
"RangeError when nanoseconds > 0 and sign = -1"
); );

View File

@ -53,7 +53,8 @@ assert.throws(RangeError, () =>
oneNsDuration.total({ oneNsDuration.total({
relativeTo: zdt, relativeTo: zdt,
unit: "day", unit: "day",
}) }),
"RangeError when days < 0 and sign = 1"
); );
// NanosecondsToDays.20: days > 0 and sign = -1 // NanosecondsToDays.20: days > 0 and sign = -1
@ -72,7 +73,8 @@ assert.throws(RangeError, () =>
negOneNsDuration.total({ negOneNsDuration.total({
relativeTo: zdt, relativeTo: zdt,
unit: "day", unit: "day",
}) }),
"RangeError when days > 0 and sign = -1"
); );
// NanosecondsToDays.22: nanoseconds > 0 and sign = -1 // NanosecondsToDays.22: nanoseconds > 0 and sign = -1
@ -94,5 +96,6 @@ assert.throws(RangeError, () =>
negOneNsDuration.total({ negOneNsDuration.total({
relativeTo: zdt, relativeTo: zdt,
unit: "day", unit: "day",
}) }),
"RangeError when nanoseconds > 0 and sign = -1"
); );