From 8dcc0e1955b1753271ed0812d1a2a15a23de069b Mon Sep 17 00:00:00 2001 From: Aditi Date: Thu, 25 Aug 2022 18:01:04 +0530 Subject: [PATCH] Add calendar strings to instant string tests --- .../Temporal/Instant/compare/instant-string.js | 12 ++++++++++++ .../Temporal/Instant/from/instant-string.js | 12 ++++++++++++ .../Instant/prototype/equals/instant-string.js | 12 ++++++++++++ .../Instant/prototype/since/instant-string.js | 12 ++++++++++++ .../Instant/prototype/until/instant-string.js | 12 ++++++++++++ .../prototype/getNextTransition/instant-string.js | 3 +++ .../getOffsetNanosecondsFor/instant-string.js | 3 +++ .../prototype/getOffsetStringFor/instant-string.js | 3 +++ .../prototype/getPlainDateTimeFor/instant-string.js | 12 ++++++++++++ .../getPreviousTransition/instant-string.js | 3 +++ 10 files changed, 84 insertions(+) diff --git a/test/built-ins/Temporal/Instant/compare/instant-string.js b/test/built-ins/Temporal/Instant/compare/instant-string.js index 212305252d..e21caa16b3 100644 --- a/test/built-ins/Temporal/Instant/compare/instant-string.js +++ b/test/built-ins/Temporal/Instant/compare/instant-string.js @@ -32,3 +32,15 @@ assert.sameValue(Temporal.Instant.compare(epoch, str), 0, "date-time + Z + IANA str = "1970-01-01T00:00+01:00[Etc/Ignored]"; assert.sameValue(Temporal.Instant.compare(str, hourBefore), 0, "date-time + offset + IANA annotation ignores the IANA annotation (first argument)"); assert.sameValue(Temporal.Instant.compare(hourBefore, str), 0, "date-time + offset + IANA annotation ignores the IANA annotation (second argument)"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +assert.sameValue(Temporal.Instant.compare(str, epoch), 0, "date-time + Z + Calendar ignores the Calendar (first argument)"); +assert.sameValue(Temporal.Instant.compare(epoch, str), 0, "date-time + Z + Calendar ignores the Calendar (second argument)"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +assert.sameValue(Temporal.Instant.compare(str, hourBefore), 0, "date-time + offset + Calendar ignores the Calendar (first argument)"); +assert.sameValue(Temporal.Instant.compare(hourBefore, str), 0, "date-time + offset + Calendar ignores the Calendar (second argument)"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +assert.sameValue(Temporal.Instant.compare(str, hourBefore), 0, "date-time + offset + IANA annotation + Calendar ignores the IANA annotation and the Calendar (first argument)"); +assert.sameValue(Temporal.Instant.compare(hourBefore, str), 0, "date-time + offset + IANA annotation + Calendar ignores the IANA annotation and the Calendar (second argument)"); diff --git a/test/built-ins/Temporal/Instant/from/instant-string.js b/test/built-ins/Temporal/Instant/from/instant-string.js index a39cd2f03f..c7e5f9498e 100644 --- a/test/built-ins/Temporal/Instant/from/instant-string.js +++ b/test/built-ins/Temporal/Instant/from/instant-string.js @@ -27,3 +27,15 @@ assert.sameValue(result3.epochNanoseconds, 0n, "date-time + Z + IANA annotation str = "1970-01-01T00:00+01:00[Etc/Ignored]"; const result4 = Temporal.Instant.from(str); assert.sameValue(result4.epochNanoseconds, -3600_000_000_000n, "date-time + offset + IANA annotation ignores the IANA annotation"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +const result6 = Temporal.Instant.from(str); +assert.sameValue(result6.epochNanoseconds, 0n, "date-time + Z + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +const result7 = Temporal.Instant.from(str); +assert.sameValue(result7.epochNanoseconds, -3600_000_000_000n, "date-time + offset + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +const result8 = Temporal.Instant.from(str); +assert.sameValue(result8.epochNanoseconds, -3600_000_000_000n, "date-time + offset + IANA annotation + Calendar ignores the Calendar and IANA annotation"); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/instant-string.js b/test/built-ins/Temporal/Instant/prototype/equals/instant-string.js index ca39e140a7..891099e0a8 100644 --- a/test/built-ins/Temporal/Instant/prototype/equals/instant-string.js +++ b/test/built-ins/Temporal/Instant/prototype/equals/instant-string.js @@ -29,3 +29,15 @@ assert.sameValue(result3, true, "date-time + Z + IANA annotation ignores the IAN str = "1970-01-01T00:00+01:00[Etc/Ignored]"; const result4 = instance.equals(str); assert.sameValue(result4, false, "date-time + offset + IANA annotation ignores the IANA annotation"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +const result6 = instance.equals(str); +assert.sameValue(result6, true, "date-time + Z + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +const result5 = instance.equals(str); +assert.sameValue(result5, false, "date-time + offset + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +const result7 = instance.equals(str); +assert.sameValue(result7, false, "date-time + offset + IANA annotation + Calendar ignores the Calendar and IANA annotation"); diff --git a/test/built-ins/Temporal/Instant/prototype/since/instant-string.js b/test/built-ins/Temporal/Instant/prototype/since/instant-string.js index b9f0d965e3..d9ef09b27e 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/instant-string.js +++ b/test/built-ins/Temporal/Instant/prototype/since/instant-string.js @@ -30,3 +30,15 @@ TemporalHelpers.assertDuration(result3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "date-time str = "1970-01-01T00:00+01:00[Etc/Ignored]"; const result4 = instance.since(str); TemporalHelpers.assertDuration(result4, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0, "date-time + offset + IANA annotation ignores the IANA annotation"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +const result6 = instance.since(str); +TemporalHelpers.assertDuration(result6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "date-time + Z + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +const result5 = instance.since(str); +TemporalHelpers.assertDuration(result5, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0, "date-time + offset + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +const result7 = instance.since(str); +TemporalHelpers.assertDuration(result7, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0, "date-time + offset + IANA annotation + Calendar ignores the Calendar and IANA annotation"); diff --git a/test/built-ins/Temporal/Instant/prototype/until/instant-string.js b/test/built-ins/Temporal/Instant/prototype/until/instant-string.js index f312089d1f..d6086dd9c1 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/instant-string.js +++ b/test/built-ins/Temporal/Instant/prototype/until/instant-string.js @@ -30,3 +30,15 @@ TemporalHelpers.assertDuration(result3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "date-time str = "1970-01-01T00:00+01:00[Etc/Ignored]"; const result4 = instance.until(str); TemporalHelpers.assertDuration(result4, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0, "date-time + offset + IANA annotation ignores the IANA annotation"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +const result6 = instance.until(str); +TemporalHelpers.assertDuration(result6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "date-time + Z + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +const result5 = instance.until(str); +TemporalHelpers.assertDuration(result5, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0, "date-time + offset + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +const result7 = instance.until(str); +TemporalHelpers.assertDuration(result7, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0, "date-time + offset + IANA annotation + Calendar ignores the Calendar and IANA annotation"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js index 4b8a62965e..673432f46e 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js @@ -21,6 +21,9 @@ const valids = [ "1970-01-01T00:00+01:00", "1970-01-01T00:00Z[UTC]", "1970-01-01T00:00+01:00[UTC]", + "1970-01-01T00:00Z[u-ca=hebrew]", + "1970-01-01T00:00+01:00[u-ca=hebrew]", + "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]", ]; for (const str of valids) { const result = instance.getNextTransition(str); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js index 8b15d22bf5..1153055026 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js @@ -21,6 +21,9 @@ const valids = [ "1970-01-01T00:00+01:00", "1970-01-01T00:00Z[UTC]", "1970-01-01T00:00+01:00[UTC]", + "1970-01-01T00:00Z[u-ca=hebrew]", + "1970-01-01T00:00+01:00[u-ca=hebrew]", + "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]", ]; for (const str of valids) { const result = instance.getOffsetNanosecondsFor(str); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js index 55350dbe6c..b79e1c1e6f 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js @@ -21,6 +21,9 @@ const valids = [ "1970-01-01T00:00+01:00", "1970-01-01T00:00Z[UTC]", "1970-01-01T00:00+01:00[UTC]", + "1970-01-01T00:00Z[u-ca=hebrew]", + "1970-01-01T00:00+01:00[u-ca=hebrew]", + "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]", ]; for (const str of valids) { const result = instance.getOffsetStringFor(str); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js index caa2b018cd..4299e729a5 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js @@ -30,3 +30,15 @@ TemporalHelpers.assertPlainDateTime(result3, 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0 str = "1970-01-01T00:00+01:00[Etc/Ignored]"; const result4 = instance.getPlainDateTimeFor(str); TemporalHelpers.assertPlainDateTime(result4, 1969, 12, "M12", 31, 23, 0, 0, 0, 0, 0, "date-time + offset + IANA annotation ignores the IANA annotation"); + +str = "1970-01-01T00:00Z[u-ca=hebrew]"; +const result6 = instance.getPlainDateTimeFor(str); +TemporalHelpers.assertPlainDateTime(result6, 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0, "date-time + Z + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[u-ca=hebrew]"; +const result5 = instance.getPlainDateTimeFor(str); +TemporalHelpers.assertPlainDateTime(result5, 1969, 12, "M12", 31, 23, 0, 0, 0, 0, 0, "date-time + offset + Calendar ignores the Calendar"); + +str = "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]"; +const result7 = instance.getPlainDateTimeFor(str); +TemporalHelpers.assertPlainDateTime(result7, 1969, 12, "M12", 31, 23, 0, 0, 0, 0, 0, "date-time + offset + IANA annotation + Calendar ignores the Calendar and IANA annotation"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js index 958a3915fd..a2a6c477e9 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js @@ -21,6 +21,9 @@ const valids = [ "1970-01-01T00:00+01:00", "1970-01-01T00:00Z[UTC]", "1970-01-01T00:00+01:00[UTC]", + "1970-01-01T00:00Z[u-ca=hebrew]", + "1970-01-01T00:00+01:00[u-ca=hebrew]", + "1970-01-01T00:00+01:00[Etc/Ignored][u-ca=hebrew]", ]; for (const str of valids) { const result = instance.getPreviousTransition(str);