From 60587104781e3ae960842977fc4fc0ba09e557f9 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 11 Jan 2022 17:31:27 -0800 Subject: [PATCH] Improve various assertion messages --- .../add/relativeto-string-zoneddatetime-wrong-offset.js | 6 +++++- .../round/relativeto-string-zoneddatetime-wrong-offset.js | 6 +++++- .../relativeto-string-zoneddatetime-wrong-offset.js | 6 +++++- .../total/relativeto-string-zoneddatetime-wrong-offset.js | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset.js index d40cf7fbac..cf8d26038c 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset.js @@ -9,4 +9,8 @@ features: [Temporal] const instance = new Temporal.Duration(1, 0, 0, 1); const relativeTo = "2000-01-01T00:00+05:30[UTC]"; -assert.throws(RangeError, () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo })); +assert.throws( + RangeError, + () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }), + "add should throw RangeError on a string with UTC offset mismatch" +); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime-wrong-offset.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime-wrong-offset.js index be9563773a..c494cf9a3f 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime-wrong-offset.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime-wrong-offset.js @@ -9,4 +9,8 @@ features: [Temporal] const instance = new Temporal.Duration(1, 0, 0, 0, 24); const relativeTo = "2000-01-01T00:00+05:30[UTC]"; -assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo })); +assert.throws( + RangeError, + () => instance.round({ largestUnit: "years", relativeTo }), + "round should throw RangeError on a string with UTC offset mismatch" +); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset.js index 4fb8a1bf7e..148723fd2b 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset.js @@ -9,4 +9,8 @@ features: [Temporal] const instance = new Temporal.Duration(1, 0, 0, 1); const relativeTo = "2000-01-01T00:00+05:30[UTC]"; -assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo })); +assert.throws( + RangeError, + () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }), + "subtract should throw RangeError on a string with UTC offset mismatch" +); diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime-wrong-offset.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime-wrong-offset.js index 8cba689041..d512f1363e 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime-wrong-offset.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime-wrong-offset.js @@ -9,4 +9,8 @@ features: [Temporal] const instance = new Temporal.Duration(1, 0, 0, 0, 24); const relativeTo = "2000-01-01T00:00+05:30[UTC]"; -assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo })); +assert.throws( + RangeError, + () => instance.total({ unit: "days", relativeTo }), + "total should throw RangeError on a string with UTC offset mismatch" +);