From c84752415dfccda36c12fb2baa7acab6f3b5355d Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Fri, 21 Jul 2023 18:04:51 -0700 Subject: [PATCH] Test PlainTime without full ISO strings Codecov showed that PlainTime strings like "09:00:00Z[UTC]" or "09:00:00Z" were not being tested. This commit fills that gap. It'd probably be good to make similar changes for other Plain* types, but Codecov didn't complain about them so they may be covered via other tests so it was less urgent. --- .../toPlainDateTime/argument-string-with-utc-designator.js | 2 ++ .../toZonedDateTime/argument-string-with-utc-designator.js | 2 ++ .../withPlainTime/argument-string-with-utc-designator.js | 2 ++ .../PlainTime/compare/argument-string-with-utc-designator.js | 2 ++ .../PlainTime/from/argument-string-with-utc-designator.js | 2 ++ .../prototype/equals/argument-string-with-utc-designator.js | 2 ++ .../prototype/since/argument-string-with-utc-designator.js | 2 ++ .../prototype/until/argument-string-with-utc-designator.js | 2 ++ .../withPlainTime/argument-string-with-utc-designator.js | 2 ++ 9 files changed, 18 insertions(+) diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js index 65c1bc1c82..a35cf10b56 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainDate(2000, 5, 2); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js index ee1fa639c0..8529d75314 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainDate(2000, 5, 2); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js index 80baeb2ea5..7412a9ebad 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js index 61b28a61f5..84634a1c4b 100644 --- a/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const plainTime = new Temporal.PlainTime(); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js index 70e7b22506..215996e555 100644 --- a/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; invalidStrings.forEach((arg) => { assert.throws( diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js index 8ea64a6f57..894824ba1e 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js index ccc946fbc5..54deaec9d0 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js index a64138a1a1..121ce49f18 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); invalidStrings.forEach((arg) => { diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js index f821197cc4..87434d30c2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js @@ -10,6 +10,8 @@ features: [Temporal, arrow-function] const invalidStrings = [ "2019-10-01T09:00:00Z", "2019-10-01T09:00:00Z[UTC]", + "09:00:00Z[UTC]", + "09:00:00Z", ]; const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); invalidStrings.forEach((arg) => {