From 92dfe3cf279ecbc280dd45d37da400496c6bd8f3 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 8 May 2024 16:37:00 -0700 Subject: [PATCH] Temporal: Remove tests for argument of TimeZone.p.getNext/PreviousTransition This is being moved to a method on Temporal.ZonedDateTime.prototype. It will not take a Temporal.Instant argument. See: tc39/proposal-temporal#2826 --- ...-string-calendar-annotation-invalid-key.js | 22 ------- .../argument-string-calendar-annotation.js | 30 --------- ...ment-string-critical-unknown-annotation.js | 24 ------- .../argument-string-date-with-utc-offset.js | 49 -------------- .../argument-string-invalid.js | 66 ------------------- .../argument-string-multiple-calendar.js | 25 ------- .../argument-string-multiple-time-zone.js | 24 ------- .../argument-string-time-separators.js | 26 -------- .../argument-string-time-zone-annotation.js | 31 --------- .../argument-string-unknown-annotation.js | 28 -------- .../getNextTransition/argument-wrong-type.js | 43 ------------ .../argument-zoneddatetime.js | 21 ------ .../instant-string-limits.js | 44 ------------- .../getNextTransition/instant-string.js | 31 --------- .../getNextTransition/leap-second.js | 18 ----- .../prototype/getNextTransition/year-zero.js | 22 ------- ...-string-calendar-annotation-invalid-key.js | 22 ------- .../argument-string-calendar-annotation.js | 30 --------- ...ment-string-critical-unknown-annotation.js | 24 ------- .../argument-string-date-with-utc-offset.js | 49 -------------- .../argument-string-invalid.js | 66 ------------------- .../argument-string-multiple-calendar.js | 25 ------- .../argument-string-multiple-time-zone.js | 24 ------- .../argument-string-time-separators.js | 26 -------- .../argument-string-time-zone-annotation.js | 31 --------- .../argument-string-unknown-annotation.js | 28 -------- .../argument-wrong-type.js | 43 ------------ .../argument-zoneddatetime.js | 21 ------ .../instant-string-limits.js | 44 ------------- .../getPreviousTransition/instant-string.js | 31 --------- .../getPreviousTransition/leap-second.js | 18 ----- .../getPreviousTransition/year-zero.js | 22 ------- 32 files changed, 1008 deletions(-) delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-date-with-utc-offset.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-invalid.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-time-zone.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-separators.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-wrong-type.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-zoneddatetime.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string-limits.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/leap-second.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/year-zero.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-date-with-utc-offset.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-invalid.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-time-zone.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-separators.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-wrong-type.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-zoneddatetime.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string-limits.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/leap-second.js delete mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/year-zero.js diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js deleted file mode 100644 index c70b2259b5f..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Annotation keys are lowercase-only -features: [Temporal] ----*/ - -const invalidStrings = [ - ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], - ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], - ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach(([arg, descr]) => { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `annotation keys must be lowercase: ${arg} - ${descr}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js deleted file mode 100644 index db98cdb83d8..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Various forms of calendar annotation; critical flag has no effect -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[u-ca=iso8601]", "without time zone"], - ["1970-01-01T00:00Z[UTC][u-ca=gregory]", "with time zone"], - ["1970-01-01T00:00Z[!u-ca=hebrew]", "with ! and no time zone"], - ["1970-01-01T00:00Z[UTC][!u-ca=chinese]", "with ! and time zone"], - ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], - ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getNextTransition(arg); - - assert.sameValue( - result, - null, - `calendar annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js deleted file mode 100644 index d805a9438d6..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Unknown annotations with critical flag are rejected -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[!foo=bar]", - "1970-01-01T00:00Z[UTC][!foo=bar]", - "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", - "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", - "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `reject unknown annotation with critical flag: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-date-with-utc-offset.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-date-with-utc-offset.js deleted file mode 100644 index bc4474c4f27..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-date-with-utc-offset.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: UTC offset not valid with format that does not include a time -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const validStrings = [ - "1970-01-01T00Z", - "1970-01-01T00Z[UTC]", - "1970-01-01T00Z[!UTC]", - "1970-01-01T00Z[Europe/Vienna]", - "1970-01-01T00+00:00", - "1970-01-01T00+00:00[UTC]", - "1970-01-01T00+00:00[!UTC]", - "1969-12-31T16-08:00[America/Vancouver]", -]; - -for (const arg of validStrings) { - const result = instance.getNextTransition(arg); - - assert.sameValue( - result, - null, - `"${arg}" is a valid UTC offset with time for Instant` - ); -} - -const invalidStrings = [ - "2022-09-15Z", - "2022-09-15Z[UTC]", - "2022-09-15Z[Europe/Vienna]", - "2022-09-15+00:00", - "2022-09-15+00:00[UTC]", - "2022-09-15-02:30", - "2022-09-15-02:30[America/St_Johns]", -]; - -for (const arg of invalidStrings) { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `"${arg}" UTC offset without time is not valid for Instant` - ); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-invalid.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-invalid.js deleted file mode 100644 index 934edbfdf6b..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-invalid.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2022 Igalia S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: > - RangeError thrown if an invalid ISO string (or syntactically valid ISO string - that is not supported) is used as an Instant -features: [Temporal, arrow-function] ----*/ - -const invalidStrings = [ - // invalid ISO strings: - "", - "invalid iso8601", - "2020-01-00T00:00Z", - "2020-01-32T00:00Z", - "2020-02-30T00:00Z", - "2021-02-29T00:00Z", - "2020-00-01T00:00Z", - "2020-13-01T00:00Z", - "2020-01-01TZ", - "2020-01-01T25:00:00Z", - "2020-01-01T01:60:00Z", - "2020-01-01T01:60:61Z", - "2020-01-01T00:00Zjunk", - "2020-01-01T00:00:00Zjunk", - "2020-01-01T00:00:00.000000000Zjunk", - "2020-01-01T00:00:00+00:00junk", - "2020-01-01T00:00:00+00:00[UTC]junk", - "2020-01-01T00:00:00+00:00[UTC][u-ca=iso8601]junk", - "02020-01-01T00:00Z", - "2020-001-01T00:00Z", - "2020-01-001T00:00Z", - "2020-01-01T001Z", - "2020-01-01T01:001Z", - "2020-01-01T01:01:001Z", - // valid, but forms not supported in Temporal: - "2020-W01-1T00:00Z", - "2020-001T00:00Z", - "+0002020-01-01T00:00Z", - // may be valid in other contexts, but insufficient information for Instant: - "2020-01", - "+002020-01", - "01-01", - "2020-W01", - "P1Y", - "-P12Y", - "2020-01-01", - "2020-01-01T00", - "2020-01-01T00:00", - "2020-01-01T00:00:00", - "2020-01-01T00:00:00.000000000", - // valid, but outside the supported range: - "-999999-01-01T00:00Z", - "+999999-01-01T00:00Z", -]; - -const instance = new Temporal.TimeZone("UTC"); -for (const arg of invalidStrings) { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `"${arg}" should not be a valid ISO string for an Instant` - ); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js deleted file mode 100644 index 5adbdb1fa98..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: > - More than one calendar annotation is not syntactical if any have the criical - flag -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", - "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", - "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", - "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `reject more than one calendar annotation if any critical: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-time-zone.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-time-zone.js deleted file mode 100644 index ec245c5a685..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-time-zone.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: More than one time zone annotation is not syntactical -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[UTC][UTC]", - "1970-01-01T00:00Z[!UTC][UTC]", - "1970-01-01T00:00Z[UTC][!UTC]", - "1970-01-01T00:00Z[UTC][u-ca=iso8601][UTC]", - "1970-01-01T00:00Z[UTC][foo=bar][UTC]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - `reject more than one time zone annotation: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-separators.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-separators.js deleted file mode 100644 index 7bef091c27f..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-separators.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Time separator in string argument can vary -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z", "uppercase T"], - ["1970-01-01t00:00Z", "lowercase T"], - ["1970-01-01 00:00Z", "space between date and time"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getNextTransition(arg); - - assert.sameValue( - result, - null, - `variant time separators (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js deleted file mode 100644 index c31d25dee38..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-time-zone-annotation.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Various forms of time zone annotation; critical flag has no effect -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], - ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], - ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], - ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], - ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], - ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], - ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], - ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getNextTransition(arg); - - assert.sameValue( - result, - null, - `time zone annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js deleted file mode 100644 index 53f49b74b99..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Various forms of unknown annotation -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[foo=bar]", "alone"], - ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], - ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], - ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], - ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getNextTransition(arg); - - assert.sameValue( - result, - null, - `unknown annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-wrong-type.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-wrong-type.js deleted file mode 100644 index 65294ea9063..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-wrong-type.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: > - Appropriate error thrown when argument cannot be converted to a valid string - for Instant -features: [BigInt, Symbol, Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const primitiveTests = [ - [undefined, "undefined"], - [null, "null"], - [true, "boolean"], - ["", "empty string"], - [1, "number that doesn't convert to a valid ISO string"], - [19761118, "number that would convert to a valid ISO string in other contexts"], - [1n, "bigint"], - [{}, "plain object"], - [Temporal.Instant, "Temporal.Instant, object"], -]; - -for (const [arg, description] of primitiveTests) { - assert.throws( - typeof arg === "string" || (typeof arg === "object" && arg !== null) || typeof arg === "function" - ? RangeError - : TypeError, - () => instance.getNextTransition(arg), - `${description} does not convert to a valid ISO string` - ); -} - -const typeErrorTests = [ - [Symbol(), "symbol"], - [Temporal.Instant.prototype, "Temporal.Instant.prototype, object"], // fails brand check in toString() -]; - -for (const [arg, description] of typeErrorTests) { - assert.throws(TypeError, () => instance.getNextTransition(arg), `${description} does not convert to a string`); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-zoneddatetime.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-zoneddatetime.js deleted file mode 100644 index bf351bbd352..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-zoneddatetime.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Fast path for converting Temporal.ZonedDateTime to Temporal.Instant -info: | - sec-temporal.timezone.prototype.getnexttransition step 3: - 3. Set _startingPoint_ to ? ToTemporalInstant(_startingPoint_). - sec-temporal-totemporalinstant step 1.b: - b. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then - i. Return ! CreateTemporalInstant(_item_.[[Nanoseconds]]). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -TemporalHelpers.checkToTemporalInstantFastPath((datetime) => { - const timeZone = Temporal.TimeZone.from("UTC"); - const result = timeZone.getNextTransition(datetime); - assert.sameValue(result, null, "transition result"); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string-limits.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string-limits.js deleted file mode 100644 index 81f142ef7b6..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string-limits.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: String arguments at the limit of the representable range -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - assert.sameValue(instance.getNextTransition(str), null, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - assert.sameValue(instance.getNextTransition(str), null, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => instance.getNextTransition(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js deleted file mode 100644 index 673432f46e5..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Conversion of ISO date-time strings to Temporal.Instant instances -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -let str = "1970-01-01T00:00"; -assert.throws(RangeError, () => instance.getNextTransition(str), "bare date-time string is not an instant"); -str = "1970-01-01T00:00[UTC]"; -assert.throws(RangeError, () => instance.getNextTransition(str), "date-time + IANA annotation is not an instant"); - -// The following are all valid strings so should not throw: - -const valids = [ - "1970-01-01T00:00Z", - "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); - assert.sameValue(result, null); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/leap-second.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/leap-second.js deleted file mode 100644 index 44cafb81c3b..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/leap-second.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Leap second is a valid ISO string for Instant -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const arg = "2016-12-31T23:59:60Z"; -const result = instance.getNextTransition(arg); -assert.sameValue( - result, - null, - "leap second is a valid ISO string for Instant" -); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/year-zero.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/year-zero.js deleted file mode 100644 index 3874a284fb6..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/year-zero.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Negative zero, as an extended year, is rejected -features: [Temporal, arrow-function] ----*/ - -const invalidStrings = [ - "-000000-03-30T00:45Z", - "-000000-03-30T01:45+01:00", - "-000000-03-30T01:45:00+00:00[UTC]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getNextTransition(arg), - "reject minus zero as extended year" - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js deleted file mode 100644 index 24c567b1df7..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Annotation keys are lowercase-only -features: [Temporal] ----*/ - -const invalidStrings = [ - ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], - ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], - ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach(([arg, descr]) => { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `annotation keys must be lowercase: ${arg} - ${descr}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js deleted file mode 100644 index 6ede7be636f..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Various forms of calendar annotation; critical flag has no effect -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[u-ca=iso8601]", "without time zone"], - ["1970-01-01T00:00Z[UTC][u-ca=gregory]", "with time zone"], - ["1970-01-01T00:00Z[!u-ca=hebrew]", "with ! and no time zone"], - ["1970-01-01T00:00Z[UTC][!u-ca=chinese]", "with ! and time zone"], - ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], - ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getPreviousTransition(arg); - - assert.sameValue( - result, - null, - `calendar annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js deleted file mode 100644 index 527c45e2dd1..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Unknown annotations with critical flag are rejected -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[!foo=bar]", - "1970-01-01T00:00Z[UTC][!foo=bar]", - "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", - "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", - "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `reject unknown annotation with critical flag: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-date-with-utc-offset.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-date-with-utc-offset.js deleted file mode 100644 index 32aab26472e..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-date-with-utc-offset.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: UTC offset not valid with format that does not include a time -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const validStrings = [ - "1970-01-01T00Z", - "1970-01-01T00Z[UTC]", - "1970-01-01T00Z[!UTC]", - "1970-01-01T00Z[Europe/Vienna]", - "1970-01-01T00+00:00", - "1970-01-01T00+00:00[UTC]", - "1970-01-01T00+00:00[!UTC]", - "1969-12-31T16-08:00[America/Vancouver]", -]; - -for (const arg of validStrings) { - const result = instance.getPreviousTransition(arg); - - assert.sameValue( - result, - null, - `"${arg}" is a valid UTC offset with time for Instant` - ); -} - -const invalidStrings = [ - "2022-09-15Z", - "2022-09-15Z[UTC]", - "2022-09-15Z[Europe/Vienna]", - "2022-09-15+00:00", - "2022-09-15+00:00[UTC]", - "2022-09-15-02:30", - "2022-09-15-02:30[America/St_Johns]", -]; - -for (const arg of invalidStrings) { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `"${arg}" UTC offset without time is not valid for Instant` - ); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-invalid.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-invalid.js deleted file mode 100644 index 3b83ea8c354..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-invalid.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2022 Igalia S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: > - RangeError thrown if an invalid ISO string (or syntactically valid ISO string - that is not supported) is used as an Instant -features: [Temporal, arrow-function] ----*/ - -const invalidStrings = [ - // invalid ISO strings: - "", - "invalid iso8601", - "2020-01-00T00:00Z", - "2020-01-32T00:00Z", - "2020-02-30T00:00Z", - "2021-02-29T00:00Z", - "2020-00-01T00:00Z", - "2020-13-01T00:00Z", - "2020-01-01TZ", - "2020-01-01T25:00:00Z", - "2020-01-01T01:60:00Z", - "2020-01-01T01:60:61Z", - "2020-01-01T00:00Zjunk", - "2020-01-01T00:00:00Zjunk", - "2020-01-01T00:00:00.000000000Zjunk", - "2020-01-01T00:00:00+00:00junk", - "2020-01-01T00:00:00+00:00[UTC]junk", - "2020-01-01T00:00:00+00:00[UTC][u-ca=iso8601]junk", - "02020-01-01T00:00Z", - "2020-001-01T00:00Z", - "2020-01-001T00:00Z", - "2020-01-01T001Z", - "2020-01-01T01:001Z", - "2020-01-01T01:01:001Z", - // valid, but forms not supported in Temporal: - "2020-W01-1T00:00Z", - "2020-001T00:00Z", - "+0002020-01-01T00:00Z", - // may be valid in other contexts, but insufficient information for Instant: - "2020-01", - "+002020-01", - "01-01", - "2020-W01", - "P1Y", - "-P12Y", - "2020-01-01", - "2020-01-01T00", - "2020-01-01T00:00", - "2020-01-01T00:00:00", - "2020-01-01T00:00:00.000000000", - // valid, but outside the supported range: - "-999999-01-01T00:00Z", - "+999999-01-01T00:00Z", -]; - -const instance = new Temporal.TimeZone("UTC"); -for (const arg of invalidStrings) { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `"${arg}" should not be a valid ISO string for an Instant` - ); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js deleted file mode 100644 index 090cfc0e4d3..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: > - More than one calendar annotation is not syntactical if any have the criical - flag -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", - "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", - "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", - "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `reject more than one calendar annotation if any critical: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-time-zone.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-time-zone.js deleted file mode 100644 index 64aa91d2941..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-time-zone.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: More than one time zone annotation is not syntactical -features: [Temporal] ----*/ - -const invalidStrings = [ - "1970-01-01T00:00Z[UTC][UTC]", - "1970-01-01T00:00Z[!UTC][UTC]", - "1970-01-01T00:00Z[UTC][!UTC]", - "1970-01-01T00:00Z[UTC][u-ca=iso8601][UTC]", - "1970-01-01T00:00Z[UTC][foo=bar][UTC]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - `reject more than one time zone annotation: ${arg}` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-separators.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-separators.js deleted file mode 100644 index d9023ea6b5b..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-separators.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Time separator in string argument can vary -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z", "uppercase T"], - ["1970-01-01t00:00Z", "lowercase T"], - ["1970-01-01 00:00Z", "space between date and time"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getPreviousTransition(arg); - - assert.sameValue( - result, - null, - `variant time separators (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js deleted file mode 100644 index d85e05a2018..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-time-zone-annotation.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Various forms of time zone annotation; critical flag has no effect -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[Asia/Kolkata]", "named, with Z"], - ["1970-01-01T00:00Z[!Europe/Vienna]", "named, with Z and !"], - ["1970-01-01T00:00Z[+00:00]", "numeric, with Z"], - ["1970-01-01T00:00Z[!-02:30]", "numeric, with Z and !"], - ["1970-01-01T00:00+00:00[UTC]", "named, with offset"], - ["1970-01-01T00:00+00:00[!Africa/Abidjan]", "named, with offset and !"], - ["1970-01-01T00:00+00:00[-08:00]", "numeric, with offset"], - ["1970-01-01T00:00+00:00[!+01:00]", "numeric, with offset and !"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getPreviousTransition(arg); - - assert.sameValue( - result, - null, - `time zone annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js deleted file mode 100644 index 7d964fba19a..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Various forms of unknown annotation -features: [Temporal] ----*/ - -const tests = [ - ["1970-01-01T00:00Z[foo=bar]", "alone"], - ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], - ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], - ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], - ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], -]; - -const instance = new Temporal.TimeZone("UTC"); - -tests.forEach(([arg, description]) => { - const result = instance.getPreviousTransition(arg); - - assert.sameValue( - result, - null, - `unknown annotation (${description})` - ); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-wrong-type.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-wrong-type.js deleted file mode 100644 index 1bd6dd29933..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-wrong-type.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: > - Appropriate error thrown when argument cannot be converted to a valid string - for Instant -features: [BigInt, Symbol, Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const primitiveTests = [ - [undefined, "undefined"], - [null, "null"], - [true, "boolean"], - ["", "empty string"], - [1, "number that doesn't convert to a valid ISO string"], - [19761118, "number that would convert to a valid ISO string in other contexts"], - [1n, "bigint"], - [{}, "plain object"], - [Temporal.Instant, "Temporal.Instant, object"], -]; - -for (const [arg, description] of primitiveTests) { - assert.throws( - typeof arg === "string" || (typeof arg === "object" && arg !== null) || typeof arg === "function" - ? RangeError - : TypeError, - () => instance.getPreviousTransition(arg), - `${description} does not convert to a valid ISO string` - ); -} - -const typeErrorTests = [ - [Symbol(), "symbol"], - [Temporal.Instant.prototype, "Temporal.Instant.prototype, object"], // fails brand check in toString() -]; - -for (const [arg, description] of typeErrorTests) { - assert.throws(TypeError, () => instance.getPreviousTransition(arg), `${description} does not convert to a string`); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-zoneddatetime.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-zoneddatetime.js deleted file mode 100644 index 25b517f90a8..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-zoneddatetime.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Fast path for converting Temporal.ZonedDateTime to Temporal.Instant -info: | - sec-temporal.timezone.prototype.getprevioustransition step 3: - 3. Set _startingPoint_ to ? ToTemporalInstant(_startingPoint_). - sec-temporal-totemporalinstant step 1.b: - b. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then - i. Return ! CreateTemporalInstant(_item_.[[Nanoseconds]]). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -TemporalHelpers.checkToTemporalInstantFastPath((datetime) => { - const timeZone = Temporal.TimeZone.from("UTC"); - const result = timeZone.getPreviousTransition(datetime); - assert.sameValue(result, null, "transition result"); -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string-limits.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string-limits.js deleted file mode 100644 index 5f0afdbdec4..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string-limits.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: String arguments at the limit of the representable range -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const minInstantStrings = [ - "-271821-04-20T00:00Z", - "-271821-04-19T23:00-01:00", - "-271821-04-19T00:00:00.000000001-23:59:59.999999999", -]; -for (const str of minInstantStrings) { - assert.sameValue(instance.getPreviousTransition(str), null, `instant string ${str} should be valid`); -} - -const maxInstantStrings = [ - "+275760-09-13T00:00Z", - "+275760-09-13T01:00+01:00", - "+275760-09-13T23:59:59.999999999+23:59:59.999999999", -]; - -for (const str of maxInstantStrings) { - assert.sameValue(instance.getPreviousTransition(str), null, `instant string ${str} should be valid`); -} - -const outOfRangeInstantStrings = [ - "-271821-04-19T23:59:59.999999999Z", - "-271821-04-19T23:00-00:59:59.999999999", - "-271821-04-19T00:00:00-23:59:59.999999999", - "-271821-04-19T00:00:00-24:00", - "+275760-09-13T00:00:00.000000001Z", - "+275760-09-13T01:00+00:59:59.999999999", - "+275760-09-14T00:00+23:59:59.999999999", - "+275760-09-14T00:00+24:00", -]; - -for (const str of outOfRangeInstantStrings) { - assert.throws(RangeError, () => instance.getPreviousTransition(str), `instant string ${str} should not be valid`); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js deleted file mode 100644 index a2a6c477e97..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Conversion of ISO date-time strings to Temporal.Instant instances -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -let str = "1970-01-01T00:00"; -assert.throws(RangeError, () => instance.getPreviousTransition(str), "bare date-time string is not an instant"); -str = "1970-01-01T00:00[UTC]"; -assert.throws(RangeError, () => instance.getPreviousTransition(str), "date-time + IANA annotation is not an instant"); - -// The following are all valid strings so should not throw: - -const valids = [ - "1970-01-01T00:00Z", - "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); - assert.sameValue(result, null); -} diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/leap-second.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/leap-second.js deleted file mode 100644 index 29d3b5d4100..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/leap-second.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Leap second is a valid ISO string for Instant -features: [Temporal] ----*/ - -const instance = new Temporal.TimeZone("UTC"); - -const arg = "2016-12-31T23:59:60Z"; -const result = instance.getPreviousTransition(arg); -assert.sameValue( - result, - null, - "leap second is a valid ISO string for Instant" -); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/year-zero.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/year-zero.js deleted file mode 100644 index 07b1e7248f8..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/year-zero.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Negative zero, as an extended year, is rejected -features: [Temporal, arrow-function] ----*/ - -const invalidStrings = [ - "-000000-03-30T00:45Z", - "-000000-03-30T01:45+01:00", - "-000000-03-30T01:45:00+00:00[UTC]", -]; -const instance = new Temporal.TimeZone("UTC"); -invalidStrings.forEach((arg) => { - assert.throws( - RangeError, - () => instance.getPreviousTransition(arg), - "reject minus zero as extended year" - ); -});