From 24def913ec83bd8304a70be2f3da39baaf2e2fef Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 18 Jan 2023 17:15:28 -0800 Subject: [PATCH] Remove support for nested Temporal time zone property bags Previously, "nested" time zone property bags were unwrapped up to one level. That is, this object: { timeZone: { // ...Temporal.TimeZone methods } } would not be considered to implement the TimeZone protocol, but would have its timeZone property used instead, if it were passed to an API that required a TimeZone protocol object. These nested property bags are no longer supported. Discussion: https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753 Corresponding normative PR: https://github.com/tc39/proposal-temporal/pull/2485 --- .../Duration/compare/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 20 ------------- ...to-propertybag-timezone-string-datetime.js | 2 -- ...propertybag-timezone-string-leap-second.js | 6 ++-- ...o-propertybag-timezone-string-year-zero.js | 5 ---- ...ativeto-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/add/order-of-operations.js | 2 -- ...instance-does-not-get-timeZone-property.js | 22 --------------- ...to-propertybag-timezone-string-datetime.js | 2 -- ...propertybag-timezone-string-leap-second.js | 6 ++-- ...o-propertybag-timezone-string-year-zero.js | 5 ---- ...ativeto-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/round/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- ...to-propertybag-timezone-string-datetime.js | 2 -- ...propertybag-timezone-string-leap-second.js | 6 ++-- ...o-propertybag-timezone-string-year-zero.js | 5 ---- ...ativeto-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/subtract/order-of-operations.js | 2 -- ...instance-does-not-get-timeZone-property.js | 22 --------------- ...to-propertybag-timezone-string-datetime.js | 2 -- ...propertybag-timezone-string-leap-second.js | 6 ++-- ...o-propertybag-timezone-string-year-zero.js | 5 ---- ...ativeto-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/total/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- ...to-propertybag-timezone-string-datetime.js | 2 -- ...propertybag-timezone-string-leap-second.js | 6 ++-- ...o-propertybag-timezone-string-year-zero.js | 5 ---- ...ativeto-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/toString/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- .../toString/timezone-string-datetime.js | 27 ++++++------------ .../toString/timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../toString/timezone-string-year-zero.js | 5 ---- .../prototype/toString/timezone-wrong-type.js | 5 ---- .../Instant/prototype/toString/timezone.js | 1 - .../toZonedDateTime/plain-custom-timezone.js | 5 +--- ...instance-does-not-get-timeZone-property.js | 22 --------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../toZonedDateTime/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 22 --------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../toZonedDateTimeISO/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 20 ------------- .../Now/plainDate/timezone-string-datetime.js | 2 -- .../plainDate/timezone-string-leap-second.js | 6 ++-- .../plainDate/timezone-string-year-zero.js | 5 ---- .../Now/plainDate/timezone-wrong-type.js | 5 ---- .../Now/plainDate/toPlainDate-override.js | 1 - ...instance-does-not-get-timeZone-property.js | 20 ------------- .../plainDateISO/timezone-string-datetime.js | 2 -- .../timezone-string-leap-second.js | 6 ++-- .../plainDateISO/timezone-string-year-zero.js | 5 ---- .../Now/plainDateISO/timezone-wrong-type.js | 5 ---- .../Now/plainDateTime/calendar-function.js | 1 - ...instance-does-not-get-timeZone-property.js | 20 ------------- .../timezone-object-fail-call-tostring.js | 20 ------------- .../timezone-object-fail-get-timezone.js | 17 ----------- ...imezone-object-fail-has-nested-timezone.js | 21 -------------- .../timezone-object-fail-has-timezone.js | 19 ------------- .../Now/plainDateTime/timezone-object.js | 20 ++----------- .../plainDateTime/timezone-string-datetime.js | 2 -- .../timezone-string-leap-second.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../Now/plainDateTime/timezone-wrong-type.js | 5 ---- .../Temporal/Now/plainDateTime/timezone.js | 1 - ...instance-does-not-get-timeZone-property.js | 20 ------------- .../timezone-object-fail-call-tostring.js | 20 ------------- .../timezone-object-fail-get-timezone.js | 17 ----------- ...imezone-object-fail-has-nested-timezone.js | 21 -------------- .../timezone-object-fail-has-timezone.js | 19 ------------- .../Now/plainDateTimeISO/timezone-object.js | 20 ++----------- .../timezone-string-datetime.js | 2 -- .../timezone-string-leap-second.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../plainDateTimeISO/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 20 ------------- .../plainTimeISO/timezone-string-datetime.js | 2 -- .../timezone-string-leap-second.js | 6 ++-- .../plainTimeISO/timezone-string-year-zero.js | 5 ---- .../Now/plainTimeISO/timezone-wrong-type.js | 5 ---- .../Temporal/Now/plainTimeISO/timezone.js | 1 - .../Now/plainTimeISO/toPlainTime-override.js | 1 - .../Now/zonedDateTime/calendar-function.js | 6 +--- ...instance-does-not-get-timeZone-property.js | 20 ------------- .../timezone-object-fail-call-tostring.js | 20 ------------- .../timezone-object-fail-get-timezone.js | 17 ----------- ...imezone-object-fail-has-nested-timezone.js | 21 -------------- .../timezone-object-fail-has-timezone.js | 19 ------------- .../Now/zonedDateTime/timezone-object.js | 21 +------------- .../zonedDateTime/timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../Now/zonedDateTime/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 20 ------------- .../timezone-object-fail-call-tostring.js | 20 ------------- .../timezone-object-fail-get-timezone.js | 17 ----------- ...imezone-object-fail-has-nested-timezone.js | 21 -------------- .../timezone-object-fail-has-timezone.js | 19 ------------- .../Now/zonedDateTimeISO/timezone-object.js | 21 +------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../zonedDateTimeISO/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 22 --------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../toZonedDateTime/timezone-wrong-type.js | 5 ---- .../toZonedDateTime/order-of-operations.js | 2 -- .../toZonedDateTime/plain-custom-timezone.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../toZonedDateTime/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 22 --------------- .../timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../timezone-string-year-zero.js | 5 ---- .../toZonedDateTime/timezone-wrong-type.js | 5 ---- .../TimeZone/from/argument-object-invalid.js | 11 -------- .../Temporal/TimeZone/from/argument-object.js | 9 ------ ...instance-does-not-get-timeZone-property.js | 20 ------------- .../TimeZone/from/timezone-string-datetime.js | 27 ++++++------------ .../from/timezone-string-leap-second.js | 7 ++--- .../from/timezone-string-multiple-offsets.js | 6 ++-- .../from/timezone-string-year-zero.js | 5 ---- .../TimeZone/from/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 23 --------------- ...nt-propertybag-timezone-string-datetime.js | 4 --- ...propertybag-timezone-string-leap-second.js | 6 ---- ...rtybag-timezone-string-multiple-offsets.js | 17 +++++++++++ ...t-propertybag-timezone-string-year-zero.js | 11 -------- ...rgument-propertybag-timezone-wrong-type.js | 8 ------ .../compare/order-of-operations.js | 2 -- ...instance-does-not-get-timeZone-property.js | 20 ------------- ...nt-propertybag-timezone-string-datetime.js | 27 ++++++------------ ...propertybag-timezone-string-leap-second.js | 7 ++--- ...rtybag-timezone-string-multiple-offsets.js | 6 ++-- ...t-propertybag-timezone-string-year-zero.js | 5 ---- ...rgument-propertybag-timezone-wrong-type.js | 5 ---- .../ZonedDateTime/from/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- ...nt-propertybag-timezone-string-datetime.js | 6 ---- ...propertybag-timezone-string-leap-second.js | 2 -- ...rtybag-timezone-string-multiple-offsets.js | 3 +- ...t-propertybag-timezone-string-year-zero.js | 5 ---- ...rgument-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/equals/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- ...nt-propertybag-timezone-string-datetime.js | 6 ---- ...propertybag-timezone-string-leap-second.js | 4 +-- ...rtybag-timezone-string-multiple-offsets.js | 3 +- ...t-propertybag-timezone-string-year-zero.js | 5 ---- ...rgument-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/since/order-of-operations.js | 1 - .../toPlainDateTime/plain-custom-timezone.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- ...nt-propertybag-timezone-string-datetime.js | 6 ---- ...propertybag-timezone-string-leap-second.js | 4 +-- ...rtybag-timezone-string-multiple-offsets.js | 3 +- ...t-propertybag-timezone-string-year-zero.js | 5 ---- ...rgument-propertybag-timezone-wrong-type.js | 5 ---- .../prototype/until/order-of-operations.js | 1 - ...instance-does-not-get-timeZone-property.js | 22 --------------- .../withTimeZone/timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../withTimeZone/timezone-string-year-zero.js | 5 ---- .../withTimeZone/timezone-wrong-type.js | 5 ---- ...instance-does-not-get-timeZone-property.js | 20 ------------- .../ZonedDateTime/timezone-string-datetime.js | 27 ++++++------------ .../timezone-string-leap-second.js | 7 ++--- .../timezone-string-multiple-offsets.js | 6 ++-- .../ZonedDateTime/timezone-wrong-type.js | 5 ---- .../toString/timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 2 -- .../zonedDateTime/timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../timezone-string-datetime.js | 14 +++------- .../Temporal/TimeZone/from/argument-object.js | 9 ------ .../TimeZone/from/timezone-string-datetime.js | 14 +++------- ...nt-propertybag-timezone-string-datetime.js | 28 +++++++++++++++++++ ...nt-propertybag-timezone-string-datetime.js | 14 +++------- ...nt-propertybag-timezone-string-datetime.js | 3 -- ...nt-propertybag-timezone-string-datetime.js | 3 -- ...nt-propertybag-timezone-string-datetime.js | 3 -- 205 files changed, 262 insertions(+), 1810 deletions(-) delete mode 100644 test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Instant/prototype/toString/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/plainDate/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/plainDateISO/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-call-tostring.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-get-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-nested-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-call-tostring.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-get-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-nested-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-timezone.js delete mode 100644 test/built-ins/Temporal/Now/plainTimeISO/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-call-tostring.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-get-timezone.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-nested-timezone.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-timezone.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-call-tostring.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-get-timezone.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-nested-timezone.js delete mode 100644 test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-timezone.js delete mode 100644 test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/TimeZone/from/argument-object-invalid.js delete mode 100644 test/built-ins/Temporal/TimeZone/from/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-multiple-offsets.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-instance-does-not-get-timeZone-property.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/timezone-instance-does-not-get-timeZone-property.js create mode 100644 test/intl402/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js diff --git a/test/built-ins/Temporal/Duration/compare/order-of-operations.js b/test/built-ins/Temporal/Duration/compare/order-of-operations.js index 7b1e9a9c64..8c2947f78d 100644 --- a/test/built-ins/Temporal/Duration/compare/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/compare/order-of-operations.js @@ -193,7 +193,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([ "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "has options.relativeTo.timeZone.timeZone", "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", "get options.relativeTo.timeZone.getOffsetNanosecondsFor", diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 62086da857..0000000000 --- a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.duration.compare -description: > - A Temporal.TimeZone instance passed to compare() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-datetime.js index f475a24bbf..42267cf280 100644 --- a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration( "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); - Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); }); diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js index 02368982a3..4ba0cfc3eb 100644 --- a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-year-zero.js index 0c8d50f0e2..8ea4b40556 100644 --- a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-wrong-type.js index cd328593c3..ccb8c1847e 100644 --- a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js index bf182ee753..b66705c0a7 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/add/order-of-operations.js @@ -177,8 +177,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([ // InterpretTemporalDateTimeFields "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - // ToRelativeTemporalObject again - "has options.relativeTo.timeZone.timeZone", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 643acc2572..0000000000 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.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.duration.prototype.add -description: > - A Temporal.TimeZone instance passed to add() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Duration(1); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-datetime.js index 5f4c3968be..60a6cf1983 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-datetime.js @@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativ "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); - instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); }); diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-leap-second.js index a08b0dc14f..4571c15e21 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-leap-second.js @@ -10,12 +10,10 @@ features: [Temporal] const instance = new Temporal.Duration(1); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-year-zero.js index 2f09d730ba..75f689c305 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-wrong-type.js index 8eafc80af2..f77a416dc2 100644 --- a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js index 8ab04a64a1..9799b3a0ad 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/round/order-of-operations.js @@ -270,7 +270,6 @@ const expectedOpsForZonedRelativeTo = [ "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "has options.relativeTo.timeZone.timeZone", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 0f0cb9ff21..0000000000 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.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.duration.prototype.round -description: > - A Temporal.TimeZone instance passed to round() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Duration(1); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-datetime.js index cc4d8b377f..774bb727cf 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-datetime.js @@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.round({ largestUnit: "months", relative "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); - instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); }); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-leap-second.js index 73e01540e2..de17fb684a 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-leap-second.js @@ -10,12 +10,10 @@ features: [Temporal] const instance = new Temporal.Duration(1); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-year-zero.js index 290099ebed..3edcb20432 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-wrong-type.js index c77296c071..5618349ad6 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js index 0819c8786f..dc000b9de0 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js @@ -177,8 +177,6 @@ const expectedOpsForZonedRelativeTo = expected.concat([ // InterpretTemporalDateTimeFields "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - // ToRelativeTemporalObject again - "has options.relativeTo.timeZone.timeZone", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index b4a92890a5..0000000000 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.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.duration.prototype.subtract -description: > - A Temporal.TimeZone instance passed to subtract() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Duration(1); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-datetime.js index 1944c6d4d5..1f85b2dcf6 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-datetime.js @@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { re "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); - instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); }); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-leap-second.js index 5cd39edc24..088075a80c 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-leap-second.js @@ -10,12 +10,10 @@ features: [Temporal] const instance = new Temporal.Duration(1); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-year-zero.js index 251016b432..7e7830a2e0 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-wrong-type.js index 41d7977524..0d92e89035 100644 --- a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js b/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js index 44aa5e89c9..d559ba3b35 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js +++ b/test/built-ins/Temporal/Duration/prototype/total/order-of-operations.js @@ -183,7 +183,6 @@ const expectedOpsForZonedRelativeTo = [ "call options.relativeTo.year.valueOf", "get options.relativeTo.calendar.dateFromFields", "call options.relativeTo.calendar.dateFromFields", - "has options.relativeTo.timeZone.timeZone", // InterpretISODateTimeOffset "get options.relativeTo.timeZone.getPossibleInstantsFor", "call options.relativeTo.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 2ca7ed5f55..0000000000 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-instance-does-not-get-timeZone-property.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.duration.prototype.total -description: > - A Temporal.TimeZone instance passed to total() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Duration(1); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-datetime.js index 7f34abd377..3d4b8f6c6a 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-datetime.js @@ -11,7 +11,6 @@ const instance = new Temporal.Duration(1); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -32,5 +31,4 @@ assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { y "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); - instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); }); diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-leap-second.js index 0167a3c6dd..9fa62464bc 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-leap-second.js @@ -10,12 +10,10 @@ features: [Temporal] const instance = new Temporal.Duration(1); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }); -instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-year-zero.js index 223a510ca9..2aca32cd54 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-wrong-type.js index e6c0d94209..e75f3141ad 100644 --- a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js b/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js index bdec0d3efb..4f55140708 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js @@ -19,7 +19,6 @@ const expected = [ "get options.smallestUnit.toString", "call options.smallestUnit.toString", "get options.timeZone", - "has options.timeZone.timeZone", "get options.timeZone.getOffsetNanosecondsFor", "call options.timeZone.getOffsetNanosecondsFor", "get options.timeZone.getOffsetNanosecondsFor", diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 54e6309bc3..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-instance-does-not-get-timeZone-property.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.instant.prototype.tostring -description: > - A Temporal.TimeZone instance passed to toString() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Instant(0n); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toString({ timeZone }); -instance.toString({ timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime.js index e803ecbb0b..b1d948e4d4 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toString({ timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toString({ timeZone }); assert.sameValue(result1.substr(-6), "+00:00", "date-time + Z is UTC time zone"); -const result2 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result2.substr(-6), "+00:00", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toString({ timeZone }); -assert.sameValue(result3.substr(-6), "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result4.substr(-6), "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toString({ timeZone }); +assert.sameValue(result2.substr(-6), "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toString({ timeZone }); -assert.sameValue(result5.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone"); -const result6 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result6.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone (string in property bag)"); +const result3 = instance.toString({ timeZone }); +assert.sameValue(result3.substr(-6), "+00:00", "date-time + IANA annotation is the offset time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toString({ timeZone }); -assert.sameValue(result7.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone"); -const result8 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result8.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone (string in property bag)"); +const result4 = instance.toString({ timeZone }); +assert.sameValue(result4.substr(-6), "+00:00", "date-time + Z + IANA annotation is the offset time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toString({ timeZone }); -assert.sameValue(result9.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone"); -const result10 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result10.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone (string in property bag)"); +const result5 = instance.toString({ timeZone }); +assert.sameValue(result5.substr(-6), "+00:00", "date-time + offset + IANA annotation is the offset time zone"); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second.js index 72e3391394..fd64b06af7 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.Instant(0n); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toString({ timeZone }); -assert.sameValue(result1.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result2.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toString({ timeZone }); +assert.sameValue(result.substr(-6), "+00:00", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toString({ timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js index 9d118c093e..2b16120473 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.Instant(0n); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toString({ timeZone }); -assert.sameValue(result1.substr(-6), "+01:46", "Time zone string determined from offset"); -const result2 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result2.substr(-6), "+01:46", "Time zone string determined from offset"); +const result = instance.toString({ timeZone }); +assert.sameValue(result.substr(-6), "+01:46", "Time zone string determined from offset"); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js index c04a611c07..9e8cfd9b73 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toString({ timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toString({ timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone-wrong-type.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone-wrong-type.js index 699b279b82..7904ef0a19 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toString({ timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toString({ timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toString({ timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toString({ timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Instant/prototype/toString/timezone.js b/test/built-ins/Temporal/Instant/prototype/toString/timezone.js index acf2219485..19eac92a8f 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/timezone.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/timezone.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", "get timeZone.getOffsetNanosecondsFor", diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/plain-custom-timezone.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/plain-custom-timezone.js index be9aee8992..86901d3324 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/plain-custom-timezone.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/plain-custom-timezone.js @@ -9,9 +9,6 @@ features: [Temporal] ---*/ const actual = []; -const expected = [ - "has timeZone.timeZone", -]; const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456789Z"); const calendar = Temporal.Calendar.from("iso8601"); @@ -22,4 +19,4 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { const result = instant.toZonedDateTime({ timeZone, calendar }); assert.sameValue(result.epochNanoseconds, instant.epochNanoseconds); -assert.compareArray(actual, expected); +assert.compareArray(actual, []); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 9d171db011..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.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.instant.prototype.tozoneddatetime -description: > - A Temporal.TimeZone instance passed to toZonedDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Instant(0n); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js index 1dfe55a73b..db6dcd0569 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-leap-second.js index 62a5415829..fd7e6b68ad 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.Instant(0n); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets.js index f3ee8e04c4..ec9250d56c 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.Instant(0n); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js index 841a1bcb3d..c4ed2917f2 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-wrong-type.js index 8f5f4d0494..2fe2877930 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 0753643e2a..0000000000 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.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.instant.prototype.tozoneddatetimeiso -description: > - A Temporal.TimeZone instance passed to toZonedDateTimeISO() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.Instant(0n); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toZonedDateTimeISO(timeZone); -instance.toZonedDateTimeISO({ timeZone }); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js index a20e61b2f4..c5cb987c46 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toZonedDateTimeISO(timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-leap-second.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-leap-second.js index 81896caaf9..460b4da173 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.Instant(0n); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets.js index b7c8685973..3fbfc4a12b 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.Instant(0n); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js index a8a397ada4..79113665dd 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toZonedDateTimeISO(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toZonedDateTimeISO({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-wrong-type.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-wrong-type.js index fbe21dfed2..15c4814d87 100644 --- a/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toZonedDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toZonedDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toZonedDateTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toZonedDateTimeISO({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainDate/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/plainDate/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 36bf9b2cb1..0000000000 --- a/test/built-ins/Temporal/Now/plainDate/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.plaindate -description: > - A Temporal.TimeZone instance passed to plainDate() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.plainDate("iso8601", timeZone); -Temporal.Now.plainDate("iso8601", { timeZone }); diff --git a/test/built-ins/Temporal/Now/plainDate/timezone-string-datetime.js b/test/built-ins/Temporal/Now/plainDate/timezone-string-datetime.js index 2118b8a51a..0e8d22bd9a 100644 --- a/test/built-ins/Temporal/Now/plainDate/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/plainDate/timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Now.plainDate("iso8601", timeZone); - Temporal.Now.plainDate("iso8601", { timeZone }); }); diff --git a/test/built-ins/Temporal/Now/plainDate/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/plainDate/timezone-string-leap-second.js index 93db0e2f4c..febcb8a08f 100644 --- a/test/built-ins/Temporal/Now/plainDate/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDate/timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Now.plainDate("iso8601", timeZone); -Temporal.Now.plainDate("iso8601", { timeZone }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/plainDate/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/plainDate/timezone-string-year-zero.js index 71bb7a11a7..501894916e 100644 --- a/test/built-ins/Temporal/Now/plainDate/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/plainDate/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.plainDate("iso8601", timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.plainDate("iso8601", { timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/plainDate/timezone-wrong-type.js b/test/built-ins/Temporal/Now/plainDate/timezone-wrong-type.js index 3319d2378a..8bf7bd9ee8 100644 --- a/test/built-ins/Temporal/Now/plainDate/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDate/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.plainDate("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.plainDate("iso8601", { timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainDate/toPlainDate-override.js b/test/built-ins/Temporal/Now/plainDate/toPlainDate-override.js index 3e76b5534b..552cf1d21c 100644 --- a/test/built-ins/Temporal/Now/plainDate/toPlainDate-override.js +++ b/test/built-ins/Temporal/Now/plainDate/toPlainDate-override.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", ]; diff --git a/test/built-ins/Temporal/Now/plainDateISO/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/plainDateISO/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index fdb608b647..0000000000 --- a/test/built-ins/Temporal/Now/plainDateISO/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.plaindateiso -description: > - A Temporal.TimeZone instance passed to plainDateISO() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.plainDateISO(timeZone); -Temporal.Now.plainDateISO({ timeZone }); diff --git a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-datetime.js b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-datetime.js index c964b70425..d7cd7915dd 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "bare d "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Now.plainDateISO(timeZone); - Temporal.Now.plainDateISO({ timeZone }); }); diff --git a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-leap-second.js index 54f01540c1..4d5288df5e 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Now.plainDateISO(timeZone); -Temporal.Now.plainDateISO({ timeZone }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-year-zero.js index 5a0c755aa7..a2b11251b5 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/plainDateISO/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.plainDateISO(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.plainDateISO({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/plainDateISO/timezone-wrong-type.js b/test/built-ins/Temporal/Now/plainDateISO/timezone-wrong-type.js index bc6dace702..89c7a3ab5b 100644 --- a/test/built-ins/Temporal/Now/plainDateISO/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDateISO/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.plainDateISO(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.plainDateISO(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.plainDateISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.plainDateISO({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js index 7147a27575..8596750bcd 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-function.js @@ -9,7 +9,6 @@ features: [BigInt, Proxy, Temporal] const actual = []; const expected = [ - 'has timeZone.timeZone', 'get timeZone.getOffsetNanosecondsFor', 'call timeZone.getOffsetNanosecondsFor' ]; diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index dcc4274edf..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.plaindatetime -description: > - A Temporal.TimeZone instance passed to plainDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.plainDateTime("iso8601", timeZone); -Temporal.Now.plainDateTime("iso8601", { timeZone }); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-call-tostring.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-call-tostring.js deleted file mode 100644 index 8042f0e831..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-call-tostring.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetime -description: Forwards error thrown by invoking "toString" property -features: [Temporal] ----*/ - -var timeZone = { - timeZone: { - timeZone: true, - toString: function() { - throw new Test262Error(); - }, - } -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTime("iso8601", timeZone); -}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-get-timezone.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-get-timezone.js deleted file mode 100644 index 88c56aee2a..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-get-timezone.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetime -description: Forwards error thrown by retrieving value of "timeZone" property -features: [Temporal] ----*/ - -var timeZone = { - get timeZone() { - throw new Test262Error(); - }, -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTime("iso8601", timeZone); -}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-nested-timezone.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-nested-timezone.js deleted file mode 100644 index e7a0c0bc98..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-nested-timezone.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetime -description: Forwards error thrown by checking presence of nested "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = { - timeZone: new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, - }) -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTime("iso8601", timeZone); -}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-timezone.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-timezone.js deleted file mode 100644 index 8ecbfc40b1..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-timezone.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetime -description: Forwards error thrown by checking presence of "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, -}); - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTime("iso8601", timeZone); -}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-object.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-object.js index 384f361087..f5d33421d1 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-object.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone-object.js @@ -9,25 +9,10 @@ features: [BigInt, Proxy, Temporal] const actual = []; const expected = [ - 'has timeZone.timeZone', - 'get timeZone.timeZone', - 'has nestedTimeZone.timeZone', - 'get nestedTimeZone.getOffsetNanosecondsFor', - 'call nestedTimeZone.getOffsetNanosecondsFor' + 'get timeZone.getOffsetNanosecondsFor', + 'call timeZone.getOffsetNanosecondsFor' ]; -const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", { - getOffsetNanosecondsFor(instant) { - assert.sameValue( - instant instanceof Temporal.Instant, - true, - 'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true' - ); - - return -Number(instant.epochNanoseconds % 86400000000000n); - } -}); - const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { assert.sameValue( @@ -39,7 +24,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { return -Number(instant.epochNanoseconds % 86400000000000n); } }); -timeZone.timeZone = nestedTimeZone; Object.defineProperty(Temporal.TimeZone, 'from', { get() { diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-datetime.js index 2bf41674f1..3980f4a66f 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Now.plainDateTime("iso8601", timeZone); - Temporal.Now.plainDateTime("iso8601", { timeZone }); }); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-leap-second.js index e080f9aa85..e3c5d0056d 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Now.plainDateTime("iso8601", timeZone); -Temporal.Now.plainDateTime("iso8601", { timeZone }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-year-zero.js index 32c6a023c7..aef3cec297 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.plainDateTime("iso8601", timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.plainDateTime("iso8601", { timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/Now/plainDateTime/timezone-wrong-type.js index 429a0f865b..76bbc2a0e2 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.plainDateTime("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.plainDateTime("iso8601", { timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainDateTime/timezone.js b/test/built-ins/Temporal/Now/plainDateTime/timezone.js index c0fab52049..1d1d8c9558 100644 --- a/test/built-ins/Temporal/Now/plainDateTime/timezone.js +++ b/test/built-ins/Temporal/Now/plainDateTime/timezone.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", ]; diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 3eb8199497..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.plaindatetimeiso -description: > - A Temporal.TimeZone instance passed to plainDateTimeISO() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.plainDateTimeISO(timeZone); -Temporal.Now.plainDateTimeISO({ timeZone }); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-call-tostring.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-call-tostring.js deleted file mode 100644 index 80277327d2..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-call-tostring.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetimeiso -description: Forwards error thrown by invoking "toString" property -features: [Temporal] ----*/ - -var timeZone = { - timeZone: { - timeZone: true, - toString: function() { - throw new Test262Error(); - }, - } -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTimeISO(timeZone); -}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-get-timezone.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-get-timezone.js deleted file mode 100644 index 37cc21b8cc..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-get-timezone.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetimeiso -description: Forwards error thrown by retrieving value of "timeZone" property -features: [Temporal] ----*/ - -var timeZone = { - get timeZone() { - throw new Test262Error(); - }, -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTimeISO(timeZone); -}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-nested-timezone.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-nested-timezone.js deleted file mode 100644 index dc75b42302..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-nested-timezone.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetimeiso -description: Forwards error thrown by checking presence of nested "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = { - timeZone: new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, - }) -}; - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTimeISO(timeZone); -}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-timezone.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-timezone.js deleted file mode 100644 index 86850e3c79..0000000000 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-timezone.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.plaindatetimeiso -description: Forwards error thrown by checking presence of "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, -}); - -assert.throws(Test262Error, function() { - Temporal.Now.plainDateTimeISO(timeZone); -}, 'Temporal.Now.plainDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object.js index 5ef5745ba5..54cb16c241 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-object.js @@ -9,25 +9,10 @@ features: [BigInt, Proxy, Temporal] const actual = []; const expected = [ - 'has timeZone.timeZone', - 'get timeZone.timeZone', - 'has nestedTimeZone.timeZone', - 'get nestedTimeZone.getOffsetNanosecondsFor', - 'call nestedTimeZone.getOffsetNanosecondsFor' + 'get timeZone.getOffsetNanosecondsFor', + 'call timeZone.getOffsetNanosecondsFor' ]; -const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", { - getOffsetNanosecondsFor(instant) { - assert.sameValue( - instant instanceof Temporal.Instant, - true, - 'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true' - ); - - return -Number(instant.epochNanoseconds % 86400000000000n); - } -}); - const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { assert.sameValue( @@ -39,7 +24,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { return -Number(instant.epochNanoseconds % 86400000000000n); } }); -timeZone.timeZone = nestedTimeZone; Object.defineProperty(Temporal.TimeZone, 'from', { get() { diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js index 20509a2abb..50be32b2ce 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "ba "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Now.plainDateTimeISO(timeZone); - Temporal.Now.plainDateTimeISO({ timeZone }); }); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-leap-second.js index 4fc82538c2..37dc7cf296 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Now.plainDateTimeISO(timeZone); -Temporal.Now.plainDateTimeISO({ timeZone }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-year-zero.js index 48501a4b07..4cefee0c8b 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.plainDateTimeISO(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.plainDateTimeISO({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-wrong-type.js b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-wrong-type.js index 508de638b2..e44908ec8d 100644 --- a/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainDateTimeISO/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.plainDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index e49afec915..0000000000 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.plaintimeiso -description: > - A Temporal.TimeZone instance passed to plainTimeISO() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.plainTimeISO(timeZone); -Temporal.Now.plainTimeISO({ timeZone }); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-datetime.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-datetime.js index ce0307e1b3..425ddbd92c 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-datetime.js @@ -9,7 +9,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -30,5 +29,4 @@ assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "bare d "2021-08-19T1730-0700[UTC]", ].forEach((timeZone) => { Temporal.Now.plainTimeISO(timeZone); - Temporal.Now.plainTimeISO({ timeZone }); }); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-leap-second.js index f37d00c9b2..b01ae8c46d 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-leap-second.js @@ -9,12 +9,10 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// A string with a leap second is a valid ISO string, so the following two -// operations should not throw +// A string with a leap second is a valid ISO string, so the following +// operation should not throw Temporal.Now.plainTimeISO(timeZone); -Temporal.Now.plainTimeISO({ timeZone }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-year-zero.js index a9770de6fd..11b45dde31 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.plainTimeISO(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.plainTimeISO({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone-wrong-type.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone-wrong-type.js index 557f8aee0e..ef1b7149e0 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.plainTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.plainTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.plainTimeISO({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/plainTimeISO/timezone.js b/test/built-ins/Temporal/Now/plainTimeISO/timezone.js index 246bf54d8f..75cf03f9b1 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/timezone.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/timezone.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", ]; diff --git a/test/built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js b/test/built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js index b276ab7264..c93449e765 100644 --- a/test/built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js +++ b/test/built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", ]; diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js index 8c3fa3ab56..10632cd37e 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-function.js @@ -8,10 +8,6 @@ features: [BigInt, Proxy, Temporal] ---*/ const actual = []; -const expected = [ - 'has timeZone.timeZone' -]; - const calendar = function() {}; const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { @@ -29,7 +25,7 @@ Object.defineProperty(Temporal.Calendar, 'from', { const result = Temporal.Now.zonedDateTime(calendar, timeZone); -assert.compareArray(actual, expected, 'The value of actual is expected to equal the value of expected'); +assert.compareArray(actual, [], 'no observable operations should be invoked'); for (const property of ['hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond']) { assert.sameValue(result[property], 0, 'The value of result[property] is expected to be 0'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 73a27dd9f2..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.zoneddatetime -description: > - A Temporal.TimeZone instance passed to zonedDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.zonedDateTime("iso8601", timeZone); -Temporal.Now.zonedDateTime("iso8601", { timeZone }); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-call-tostring.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-call-tostring.js deleted file mode 100644 index 0f469eb4a5..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-call-tostring.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetime -description: Forwards error thrown by invoking "toString" property -features: [Temporal] ----*/ - -var timeZone = { - timeZone: { - timeZone: true, - toString: function() { - throw new Test262Error(); - }, - } -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTime("iso8601", timeZone); -}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-get-timezone.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-get-timezone.js deleted file mode 100644 index 630536cefb..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-get-timezone.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetime -description: Forwards error thrown by retrieving value of "timeZone" property -features: [Temporal] ----*/ - -var timeZone = { - get timeZone() { - throw new Test262Error(); - }, -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTime("iso8601", timeZone); -}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-nested-timezone.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-nested-timezone.js deleted file mode 100644 index 470ff62da0..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-nested-timezone.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetime -description: Forwards error thrown by checking presence of nested "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = { - timeZone: new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, - }) -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTime("iso8601", timeZone); -}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-timezone.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-timezone.js deleted file mode 100644 index 7e1d997ca0..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-timezone.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetime -description: Forwards error thrown by checking presence of "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, -}); - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTime("iso8601", timeZone); -}, 'Temporal.Now.zonedDateTime("iso8601", timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object.js index 579d015629..3bbb2d30e8 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-object.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-object.js @@ -8,24 +8,6 @@ features: [BigInt, Proxy, Temporal] ---*/ const actual = []; -const expected = [ - 'has timeZone.timeZone', - 'get timeZone.timeZone', - 'has nestedTimeZone.timeZone' -]; - -const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", { - getOffsetNanosecondsFor(instant) { - assert.sameValue( - instant instanceof Temporal.Instant, - true, - 'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true' - ); - - return -Number(instant.epochNanoseconds % 86400000000000n); - } -}); - const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { assert.sameValue( @@ -37,7 +19,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { return -Number(instant.epochNanoseconds % 86400000000000n); } }); -timeZone.timeZone = nestedTimeZone; Object.defineProperty(Temporal.TimeZone, 'from', { get() { @@ -47,4 +28,4 @@ Object.defineProperty(Temporal.TimeZone, 'from', { }); Temporal.Now.zonedDateTime('iso8601', timeZone); -assert.compareArray(actual, expected, 'The value of actual is expected to equal the value of expected'); +assert.compareArray(actual, [], 'no observable operations should be invoked'); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-datetime.js index 28a76a7dcb..1067afa632 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-datetime.js @@ -9,34 +9,23 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-leap-second.js index c3db6e1f1d..64a0f7afca 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-leap-second.js @@ -9,11 +9,8 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets.js index 751e83c329..a3e26f66a9 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets.js @@ -9,7 +9,5 @@ features: [Temporal] const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-year-zero.js index e27b3f1730..130ff02af3 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.zonedDateTime("iso8601", timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/Now/zonedDateTime/timezone-wrong-type.js index 2d309942c0..976ba27c80 100644 --- a/test/built-ins/Temporal/Now/zonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/zonedDateTime/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.zonedDateTime("iso8601", timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.zonedDateTime("iso8601", { timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index e65094d5e2..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.now.zoneddatetimeiso -description: > - A Temporal.TimeZone instance passed to zonedDateTimeISO() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.Now.zonedDateTimeISO(timeZone); -Temporal.Now.zonedDateTimeISO({ timeZone }); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-call-tostring.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-call-tostring.js deleted file mode 100644 index 3fd409a786..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-call-tostring.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetimeiso -description: Forwards error thrown by invoking "toString" property -features: [Temporal] ----*/ - -var timeZone = { - timeZone: { - timeZone: true, - toString: function() { - throw new Test262Error(); - }, - } -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTimeISO(timeZone); -}, 'Temporal.Now.zonedDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-get-timezone.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-get-timezone.js deleted file mode 100644 index a060e85b74..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-get-timezone.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetimeiso -description: Forwards error thrown by retrieving value of "timeZone" property -features: [Temporal] ----*/ - -var timeZone = { - get timeZone() { - throw new Test262Error(); - }, -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTimeISO(timeZone); -}, 'Temporal.Now.zonedDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-nested-timezone.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-nested-timezone.js deleted file mode 100644 index 70fac1c67a..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-nested-timezone.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetimeiso -description: Forwards error thrown by checking presence of nested "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = { - timeZone: new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, - }) -}; - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTimeISO(timeZone); -}, 'Temporal.Now.zonedDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-timezone.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-timezone.js deleted file mode 100644 index 19227d7333..0000000000 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-timezone.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.now.zoneddatetimeiso -description: Forwards error thrown by checking presence of "timeZone" property -features: [Proxy, Temporal] ----*/ - -var timeZone = new Proxy({}, { - has: function(target, property) { - if (property === 'timeZone') { - throw new Test262Error(); - } - }, -}); - -assert.throws(Test262Error, function() { - Temporal.Now.zonedDateTimeISO(timeZone); -}, 'Temporal.Now.zonedDateTimeISO(timeZone) throws a Test262Error exception'); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object.js index ae3489504e..bcb8472dc2 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-object.js @@ -8,24 +8,6 @@ features: [BigInt, Proxy, Temporal] ---*/ const actual = []; -const expected = [ - 'has timeZone.timeZone', - 'get timeZone.timeZone', - 'has nestedTimeZone.timeZone' -]; - -const nestedTimeZone = TemporalHelpers.timeZoneObserver(actual, "nestedTimeZone", { - getOffsetNanosecondsFor(instant) { - assert.sameValue( - instant instanceof Temporal.Instant, - true, - 'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true' - ); - - return -Number(instant.epochNanoseconds % 86400000000000n); - } -}); - const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { getOffsetNanosecondsFor(instant) { assert.sameValue( @@ -37,7 +19,6 @@ const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", { return -Number(instant.epochNanoseconds % 86400000000000n); } }); -timeZone.timeZone = nestedTimeZone; Object.defineProperty(Temporal.TimeZone, 'from', { get() { @@ -47,4 +28,4 @@ Object.defineProperty(Temporal.TimeZone, 'from', { }); Temporal.Now.zonedDateTimeISO(timeZone); -assert.compareArray(actual, expected, 'The value of actual is expected to equal the value of expected'); +assert.compareArray(actual, [], 'no observable operations should be invoked'); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js index 635423594b..fbba3f71b8 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js @@ -9,34 +9,23 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = Temporal.Now.zonedDateTimeISO(timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-leap-second.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-leap-second.js index 464911ea0d..f264837e02 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-leap-second.js @@ -9,11 +9,8 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-multiple-offsets.js index 5afc9061f0..1ecfceaff3 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-multiple-offsets.js @@ -9,7 +9,5 @@ features: [Temporal] const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-year-zero.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-year-zero.js index 6417c0a787..70be388488 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.Now.zonedDateTimeISO(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.Now.zonedDateTimeISO({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-wrong-type.js b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-wrong-type.js index 19f208c050..3c3b4023a0 100644 --- a/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-wrong-type.js +++ b/test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.Now.zonedDateTimeISO(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.Now.zonedDateTimeISO({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.Now.zonedDateTimeISO({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 6a69b6ca7e..0000000000 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.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.plaindate.prototype.tozoneddatetime -description: > - A Temporal.TimeZone instance passed to toZonedDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.PlainDate(2000, 5, 2); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toZonedDateTime(timeZone); -instance.toZonedDateTime({ timeZone }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js index d05b8d5ed2..c85fd3da5e 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.PlainDate(2000, 5, 2); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toZonedDateTime(timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toZonedDateTime(timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toZonedDateTime(timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toZonedDateTime(timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime(timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toZonedDateTime(timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.toZonedDateTime(timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toZonedDateTime(timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.toZonedDateTime(timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-leap-second.js index 0574078358..c5af9d74e1 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.PlainDate(2000, 5, 2); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toZonedDateTime(timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toZonedDateTime(timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets.js index 6a82c0d327..bc57050866 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.PlainDate(2000, 5, 2); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toZonedDateTime(timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.toZonedDateTime(timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js index 62e499eb4f..e565c5ef7e 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toZonedDateTime(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toZonedDateTime({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-wrong-type.js index cfeb1f3e00..95d2789f50 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toZonedDateTime(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/order-of-operations.js index 166c4e377d..e47e3a7c98 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/order-of-operations.js @@ -9,8 +9,6 @@ features: [Temporal] ---*/ const expected = [ - // ToTemporalTimeZone - "has timeZone.timeZone", // ToTemporalDisambiguation "get options.disambiguation", "get options.disambiguation.toString", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js index 1c2818759e..4b3b66a03b 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get options.disambiguation", "get options.disambiguation.toString", "call options.disambiguation.toString", diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index f9f6a4ede1..0000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.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.plaindatetime.prototype.tozoneddatetime -description: > - A Temporal.TimeZone instance passed to toZonedDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.PlainDateTime(2000, 5, 2); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toZonedDateTime(timeZone); -instance.toZonedDateTime({ timeZone }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js index fbd1b335d8..5ae2b549fa 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.PlainDateTime(2000, 5, 2); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toZonedDateTime(timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toZonedDateTime(timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toZonedDateTime(timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toZonedDateTime(timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime(timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toZonedDateTime(timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.toZonedDateTime(timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toZonedDateTime(timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.toZonedDateTime(timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-leap-second.js index c09506215b..e017519c3d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.PlainDateTime(2000, 5, 2); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toZonedDateTime(timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toZonedDateTime(timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js index ecb9531a1a..7c8c9a0819 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.PlainDateTime(2000, 5, 2); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toZonedDateTime(timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.toZonedDateTime(timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js index 79caa639eb..fe43b14d98 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toZonedDateTime(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toZonedDateTime({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-wrong-type.js index 22889a7132..44cd279070 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toZonedDateTime(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toZonedDateTime(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toZonedDateTime({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toZonedDateTime({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 75ecf010fd..0000000000 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-instance-does-not-get-timeZone-property.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.plaintime.prototype.tozoneddatetime -description: > - A Temporal.TimeZone instance passed to toZonedDateTime() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.PlainTime(); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js index e3c13a8268..a475b9870d 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.PlainTime(); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-leap-second.js index 099b350dd5..bb994f9ef5 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.PlainTime(); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js index 10442913c3..e70db04f47 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.PlainTime(); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js index 80a06780bc..50ca173af4 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-wrong-type.js index 304f4990b6..cbc3124db6 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/TimeZone/from/argument-object-invalid.js b/test/built-ins/Temporal/TimeZone/from/argument-object-invalid.js deleted file mode 100644 index 1c49e98ded..0000000000 --- a/test/built-ins/Temporal/TimeZone/from/argument-object-invalid.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2020 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.from -description: TimeZone.from() with invalid objects. -features: [Temporal] ----*/ - -assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone: "local" })); -assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone: { timeZone: "UTC" } })); diff --git a/test/built-ins/Temporal/TimeZone/from/argument-object.js b/test/built-ins/Temporal/TimeZone/from/argument-object.js index 95102b9fb6..48ff3d1a9e 100644 --- a/test/built-ins/Temporal/TimeZone/from/argument-object.js +++ b/test/built-ins/Temporal/TimeZone/from/argument-object.js @@ -36,13 +36,4 @@ for (const thisValue of thisValues) { const fromZdt = Temporal.TimeZone.from.call(thisValue, zdt); assert.notSameValue(fromZdt, zdt.getTimeZone(), "from() creates a new object from a string slot value"); assert.sameValue(fromZdt.id, "UTC"); - - const tz = new Temporal.TimeZone("UTC"); - const fromPropertyBagObject = Temporal.TimeZone.from.call(thisValue, { timeZone: tz }); - assert.sameValue(fromPropertyBagObject, tz); - assert.sameValue(fromPropertyBagObject.id, "UTC"); - - const fromPropertyBagString = Temporal.TimeZone.from.call(thisValue, { timeZone: "UTC" }); - assert(fromPropertyBagString instanceof Temporal.TimeZone); - assert.sameValue(fromPropertyBagString.id, "UTC"); } diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/TimeZone/from/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 38f519b518..0000000000 --- a/test/built-ins/Temporal/TimeZone/from/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.from -description: > - A Temporal.TimeZone instance passed to from() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.TimeZone.from(timeZone); -Temporal.TimeZone.from({ timeZone }); diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-string-datetime.js b/test/built-ins/Temporal/TimeZone/from/timezone-string-datetime.js index 7535023ae2..b37e7a47e5 100644 --- a/test/built-ins/Temporal/TimeZone/from/timezone-string-datetime.js +++ b/test/built-ins/Temporal/TimeZone/from/timezone-string-datetime.js @@ -9,34 +9,23 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.TimeZone.from(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = Temporal.TimeZone.from(timeZone); assert.sameValue(result1.id, "UTC", "date-time + Z is UTC time zone"); -const result2 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result2.id, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result3.id, "-07:00", "date-time + offset is the offset time zone"); -const result4 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result4.id, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result2.id, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result5.id, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result6.id, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result3.id, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result7.id, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result8.id, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result4.id, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result9.id, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result10.id, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result5.id, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-string-leap-second.js b/test/built-ins/Temporal/TimeZone/from/timezone-string-leap-second.js index 6629f5aeb8..6433f9f100 100644 --- a/test/built-ins/Temporal/TimeZone/from/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/TimeZone/from/timezone-string-leap-second.js @@ -9,11 +9,8 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result1.id, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result2.id, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = Temporal.TimeZone.from(timeZone); +assert.sameValue(result.id, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.TimeZone.from(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/TimeZone/from/timezone-string-multiple-offsets.js index 85693acae9..e8b686fe03 100644 --- a/test/built-ins/Temporal/TimeZone/from/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/TimeZone/from/timezone-string-multiple-offsets.js @@ -9,7 +9,5 @@ features: [Temporal] const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result1.id, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result2.id, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = Temporal.TimeZone.from(timeZone); +assert.sameValue(result.id, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-string-year-zero.js b/test/built-ins/Temporal/TimeZone/from/timezone-string-year-zero.js index 59940a4faa..9e3720be18 100644 --- a/test/built-ins/Temporal/TimeZone/from/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/TimeZone/from/timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.TimeZone.from(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.TimeZone.from({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/TimeZone/from/timezone-wrong-type.js b/test/built-ins/Temporal/TimeZone/from/timezone-wrong-type.js index e834410c78..172320b9bb 100644 --- a/test/built-ins/Temporal/TimeZone/from/timezone-wrong-type.js +++ b/test/built-ins/Temporal/TimeZone/from/timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.TimeZone.from(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.TimeZone.from(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.TimeZone.from({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.TimeZone.from({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 0a2b360ac5..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,23 +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.zoneddatetime.compare -description: > - A Temporal.TimeZone instance passed to compare() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -const arg1 = { year: 2020, month: 5, day: 2, timeZone }; -Temporal.ZonedDateTime.compare(arg1, arg1); - -const arg2 = { year: 2020, month: 5, day: 2, timeZone: { timeZone } }; -Temporal.ZonedDateTime.compare(arg2, arg2); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js index e61d15819f..27db89caec 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js @@ -12,8 +12,6 @@ const instance = new Temporal.ZonedDateTime(0n, "UTC"); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2000, month: 5, day: 2, timeZone }, instance), "bare date-time string is not a time zone (arg 1)"); assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(instance, { year: 2000, month: 5, day: 2, timeZone }), "bare date-time string is not a time zone (arg 2)"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }, instance), "bare date-time string is not a time zone (arg 1)"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(instance, { year: 2000, month: 5, day: 2, timeZone: { timeZone } }), "bare date-time string is not a time zone (arg 2)"); // The following are all valid strings so should not throw: @@ -26,6 +24,4 @@ assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(instance, { year: ].forEach((timeZone) => { Temporal.ZonedDateTime.compare({ year: 2000, month: 5, day: 2, timeZone }, instance); Temporal.ZonedDateTime.compare(instance, { year: 2000, month: 5, day: 2, timeZone }); - Temporal.ZonedDateTime.compare({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }, instance); - Temporal.ZonedDateTime.compare(instance, { year: 2000, month: 5, day: 2, timeZone: { timeZone } }); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-leap-second.js index 15726d7695..629490c710 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-leap-second.js @@ -15,13 +15,7 @@ const result1 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, t assert.sameValue(result1, 0, "leap second is a valid ISO string for TimeZone (first argument)"); const result2 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }); assert.sameValue(result2, 0, "leap second is a valid ISO string for TimeZone (second argument)"); -const result3 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, instance); -assert.sameValue(result3, 0, "leap second is a valid ISO string for TimeZone (nested property, first argument)"); -const result4 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result4, 0, "leap second is a valid ISO string for TimeZone (nested property, second argument)"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance), "leap second in time zone name not valid (first argument)"); assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }), "leap second in time zone name not valid (second argument)"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, instance), "leap second in time zone name not valid (nested property, first argument)"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "leap second in time zone name not valid (nested property, second argument)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-multiple-offsets.js new file mode 100644 index 0000000000..32c03c5f7e --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-multiple-offsets.js @@ -0,0 +1,17 @@ +// 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.zoneddatetime.compare +description: Time zone strings with UTC offset fractional part are not confused with time fractional part +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(1588371269_012_345_679n, "+01:45:30.987654321"); + +const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; + +const result1 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance); +assert.sameValue(result1, 0, "Time zone string determined from bracket name (first argument)"); +const result2 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }); +assert.sameValue(result2, 0, "Time zone string determined from bracket name (first argument)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-year-zero.js index 7f170bfe7e..b5a4de63df 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-year-zero.js @@ -23,15 +23,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone }), "reject minus zero as extended year (second argument)" ); - - assert.throws( - RangeError, - () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, datetime), - "reject minus zero as extended year (nested property, first argument)" - ); - assert.throws( - RangeError, - () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }), - "reject minus zero as extended year (nested property, second argument)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-wrong-type.js index 6ba49eac3e..2b354dcbd8 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-wrong-type.js @@ -24,8 +24,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, datetime), `${description} does not convert to a valid ISO string (first argument)`); assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone }), `${description} does not convert to a valid ISO string (second argument)`); - assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, datetime), `${description} does not convert to a valid ISO string (nested property, first argument)`); - assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property, second argument)`); } const typeErrorTests = [ @@ -35,10 +33,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, datetime), `${description} is not a valid object and does not convert to a string (first argument)`); assert.throws(TypeError, () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone }), `${description} is not a valid object and does not convert to a string (second argument)`); - assert.throws(TypeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, datetime), `${description} is not a valid object and does not convert to a string (nested property, first argument)`); - assert.throws(TypeError, () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property, second argument)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }, datetime), `undefined is always a RangeError as nested property (first argument)`); -assert.throws(RangeError, () => Temporal.ZonedDateTime.compare(datetime, { year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `undefined is always a RangeError as nested property (second argument)`); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js index a2318aee61..80ac0e3e75 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/order-of-operations.js @@ -48,7 +48,6 @@ const expected = [ "get one.year", "get one.year.valueOf", "call one.year.valueOf", - "has one.timeZone.timeZone", // InterpretTemporalDateTimeFields "get one.calendar.dateFromFields", "call one.calendar.dateFromFields", @@ -97,7 +96,6 @@ const expected = [ "get two.year", "get two.year.valueOf", "call two.year.valueOf", - "has two.timeZone.timeZone", // InterpretTemporalDateTimeFields "get two.calendar.dateFromFields", "call two.calendar.dateFromFields", diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index b8edbb9bd5..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.zoneddatetime.from -description: > - A Temporal.TimeZone instance passed to from() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js index 14a5a73582..1741348751 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js @@ -9,34 +9,23 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-leap-second.js index 72e06899ed..c117fbd776 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-leap-second.js @@ -9,11 +9,8 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-multiple-offsets.js index dc8b5cb2ca..0ed9870136 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-multiple-offsets.js @@ -9,7 +9,5 @@ features: [Temporal] const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-year-zero.js index 0065848f01..9f0328fcb5 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-year-zero.js @@ -17,9 +17,4 @@ invalidStrings.forEach((timeZone) => { () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-wrong-type.js index a879d7f756..81d4d21d7d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-wrong-type.js @@ -21,7 +21,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -30,8 +29,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js index 2fc0b85b7d..cc6181a1ed 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/order-of-operations.js @@ -48,7 +48,6 @@ const expected = [ "get item.year", "get item.year.valueOf", "call item.year.valueOf", - "has item.timeZone.timeZone", // InterpretTemporalDateTimeFields "get options.disambiguation", "get options.disambiguation.toString", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 092ee494ea..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-instance-does-not-get-timeZone-property.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.zoneddatetime.prototype.equals -description: > - A Temporal.TimeZone instance passed to equals() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC")); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.equals({ year: 2020, month: 5, day: 2, timeZone }); -instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js index 1feb0e36aa..e39e593354 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js @@ -12,7 +12,6 @@ const instance1 = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-02-19T17:30"; assert.throws(RangeError, () => instance1.equals({ year: 1970, month: 1, day: 1, timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance1.equals({ year: 1970, month: 1, day: 1, timeZone: { timeZone } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw. They should produce // expectedTimeZone, so additionally the operation should return true, because @@ -20,23 +19,18 @@ assert.throws(RangeError, () => instance1.equals({ year: 1970, month: 1, day: 1, timeZone = "2021-02-19T17:30Z"; assert(instance1.equals({ year: 1970, month: 1, day: 1, timeZone }), "date-time + Z is UTC time zone"); -assert(instance1.equals({ year: 1970, month: 1, day: 1, timeZone: { timeZone } }), "date-time + Z is UTC time zone (string in property bag)"); expectedTimeZone = "-08:00"; const instance2 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-02-19T17:30-08:00"; assert(instance2.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + offset is the offset time zone"); -assert(instance2.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + offset is the offset time zone (string in property bag)"); const instance3 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-02-19T17:30[-08:00]"; assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + IANA annotation is the IANA time zone"); -assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-02-19T17:30Z[-08:00]"; assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + Z + IANA annotation is the IANA time zone"); -assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-02-19T17:30-08:00[-08:00]"; assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + offset + IANA annotation is the IANA time zone"); -assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-leap-second.js index 8470aacdbf..4095674ad2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-leap-second.js @@ -11,8 +11,6 @@ const instance = new Temporal.ZonedDateTime(1588377600_000_000_000n, new Tempora let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; assert(instance.equals({ year: 2020, month: 5, day: 2, timeZone }), "leap second is a valid ISO string for TimeZone"); -assert(instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "leap second is a valid ISO String for TimeZone (nested property)"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-multiple-offsets.js index 2e2d7a84bb..ae1c3017eb 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-multiple-offsets.js @@ -11,10 +11,9 @@ const expectedTimeZone = "+01:45:30.987654321"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -// These operations should produce expectedTimeZone, so the following should +// This operation should produce expectedTimeZone, so the following should // be equal due to the time zones being different on the receiver and // the argument. const properties = { year: 1970, month: 1, day: 1, hour: 1, minute: 45, second: 30, millisecond: 987, microsecond: 654, nanosecond: 321 }; assert(instance.equals({ ...properties, timeZone }), "time zone string should produce expected time zone"); -assert(instance.equals({ ...properties, timeZone: { timeZone } }), "time zone string should produce expected time zone"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-year-zero.js index 9a58704f1f..54780e6540 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.equals({ year: 2020, month: 5, day: 2, timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-wrong-type.js index a122215527..284a2f3ac2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js index 49f7d9b382..7ba9951346 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/order-of-operations.js @@ -48,7 +48,6 @@ const expected = [ "get other.year", "get other.year.valueOf", "call other.year.valueOf", - "has other.timeZone.timeZone", // InterpretTemporalDateTimeFields "get other.calendar.dateFromFields", "call other.calendar.dateFromFields", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index dc1b28d6d6..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-instance-does-not-get-timeZone-property.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.zoneddatetime.prototype.since -description: > - A Temporal.TimeZone instance passed to since() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC")); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js index 1dbac956bd..cafe95f5d4 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js @@ -12,7 +12,6 @@ const instance1 = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance1.since({ year: 2020, month: 5, day: 2, timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance1.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw. They should produce // expectedTimeZone, so additionally the operation will not throw due to the @@ -20,24 +19,19 @@ assert.throws(RangeError, () => instance1.since({ year: 2020, month: 5, day: 2, timeZone = "2021-08-19T17:30Z"; instance1.since({ year: 2020, month: 5, day: 2, timeZone }); -instance1.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); expectedTimeZone = "-07:00"; const instance2 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-08-19T17:30-07:00"; instance2.since({ year: 2020, month: 5, day: 2, timeZone }); -instance2.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); expectedTimeZone = "UTC"; const instance3 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-08-19T17:30[UTC]"; instance3.since({ year: 2020, month: 5, day: 2, timeZone }); -instance3.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30Z[UTC]"; instance3.since({ year: 2020, month: 5, day: 2, timeZone }); -instance3.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30-07:00[UTC]"; instance3.since({ year: 2020, month: 5, day: 2, timeZone }); -instance3.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-leap-second.js index 5bce2e3547..024a7569ce 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-leap-second.js @@ -11,13 +11,11 @@ const expectedTimeZone = "UTC"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// These operations should produce expectedTimeZone, so the following operations +// This operation should produce expectedTimeZone, so the following operation // should not throw due to the time zones being different on the receiver and // the argument. instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-multiple-offsets.js index 94426467cf..c2a4fce8f1 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-multiple-offsets.js @@ -11,9 +11,8 @@ const expectedTimeZone = "+01:45:30.987654321"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -// These operations should produce expectedTimeZone, so the following operations +// This operation should produce expectedTimeZone, so the following operation // should not throw due to the time zones being different on the receiver and // the argument. instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-year-zero.js index 4c4cd97e92..27e043ae0e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.since({ year: 2020, month: 5, day: 2, timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-wrong-type.js index da877e7a53..4024447a63 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js index 149719f371..ae8d62c199 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js @@ -48,7 +48,6 @@ const expected = [ "get other.year", "get other.year.valueOf", "call other.year.valueOf", - "has other.timeZone.timeZone", "get other.calendar.dateFromFields", "call other.calendar.dateFromFields", "get other.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone.js index 55d04475f3..a20429d86c 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone.js @@ -10,7 +10,6 @@ features: [Temporal] const actual = []; const expected = [ - "has timeZone.timeZone", "get timeZone.getOffsetNanosecondsFor", "call timeZone.getOffsetNanosecondsFor", ]; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index f38e636c65..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-instance-does-not-get-timeZone-property.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.zoneddatetime.prototype.until -description: > - A Temporal.TimeZone instance passed to until() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC")); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js index 55eaf69012..ad74231922 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js @@ -12,7 +12,6 @@ const instance1 = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance1.until({ year: 2020, month: 5, day: 2, timeZone }), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance1.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw. They should produce // expectedTimeZone, so additionally the operation will not throw due to the @@ -20,24 +19,19 @@ assert.throws(RangeError, () => instance1.until({ year: 2020, month: 5, day: 2, timeZone = "2021-08-19T17:30Z"; instance1.until({ year: 2020, month: 5, day: 2, timeZone }); -instance1.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); expectedTimeZone = "-07:00"; const instance2 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-08-19T17:30-07:00"; instance2.until({ year: 2020, month: 5, day: 2, timeZone }); -instance2.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); expectedTimeZone = "UTC"; const instance3 = new Temporal.ZonedDateTime(0n, expectedTimeZone); timeZone = "2021-08-19T17:30[UTC]"; instance3.until({ year: 2020, month: 5, day: 2, timeZone }); -instance3.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30Z[UTC]"; instance3.until({ year: 2020, month: 5, day: 2, timeZone }); -instance3.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30-07:00[UTC]"; instance3.until({ year: 2020, month: 5, day: 2, timeZone }); -instance3.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-leap-second.js index 40dddba2e7..337d3d893d 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-leap-second.js @@ -11,13 +11,11 @@ const expectedTimeZone = "UTC"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -// These operations should produce expectedTimeZone, so the following operations +// This operation should produce expectedTimeZone, so the following operation // should not throw due to the time zones being different on the receiver and // the argument. instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone }), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-multiple-offsets.js index 1adbcb4239..c1d88c4c24 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-multiple-offsets.js @@ -11,9 +11,8 @@ const expectedTimeZone = "+01:45:30.987654321"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -// These operations should produce expectedTimeZone, so the following operations +// This operation should produce expectedTimeZone, so the following operation // should not throw due to the time zones being different on the receiver and // the argument. instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-year-zero.js index c733c4103e..3e01e23583 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.until({ year: 2020, month: 5, day: 2, timeZone }), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-wrong-type.js index 7d752202d6..073c937a85 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone }), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone }), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js index 476e392e3b..1ec6566317 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js @@ -48,7 +48,6 @@ const expected = [ "get other.year", "get other.year.valueOf", "call other.year.valueOf", - "has other.timeZone.timeZone", "get other.calendar.dateFromFields", "call other.calendar.dateFromFields", "get other.timeZone.getPossibleInstantsFor", diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index 2bd86e7e5b..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-instance-does-not-get-timeZone-property.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.zoneddatetime.prototype.withtimezone -description: > - A Temporal.TimeZone instance passed to withTimeZone() does not have its - 'timeZone' property observably checked -features: [Temporal] ----*/ - -const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC")); - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -instance.withTimeZone(timeZone); -instance.withTimeZone({ timeZone }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-datetime.js index 2d31855c6c..6e1a291043 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-datetime.js @@ -11,34 +11,23 @@ const instance = new Temporal.ZonedDateTime(0n, "UTC"); let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => instance.withTimeZone(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => instance.withTimeZone({ timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = instance.withTimeZone(timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = instance.withTimeZone({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = instance.withTimeZone(timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = instance.withTimeZone({ timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = instance.withTimeZone(timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = instance.withTimeZone(timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = instance.withTimeZone({ timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.withTimeZone(timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = instance.withTimeZone(timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = instance.withTimeZone({ timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = instance.withTimeZone(timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = instance.withTimeZone(timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = instance.withTimeZone({ timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = instance.withTimeZone(timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-leap-second.js index 75f4634c57..88f27c4153 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-leap-second.js @@ -10,11 +10,8 @@ features: [Temporal] const instance = new Temporal.ZonedDateTime(0n, "UTC"); let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = instance.withTimeZone(timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); -const result2 = instance.withTimeZone({ timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone (nested property)"); +const result = instance.withTimeZone(timeZone); +assert.sameValue(result.timeZoneId, "UTC", "leap second is a valid ISO string for TimeZone"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => instance.withTimeZone(timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => instance.withTimeZone({ timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-multiple-offsets.js index a4b9f7a973..e36156c1aa 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-multiple-offsets.js @@ -10,7 +10,5 @@ features: [Temporal] const instance = new Temporal.ZonedDateTime(0n, "UTC"); const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = instance.withTimeZone(timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = instance.withTimeZone({ timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = instance.withTimeZone(timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-year-zero.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-year-zero.js index fc14d8ed3a..727174f1b2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-year-zero.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-year-zero.js @@ -18,9 +18,4 @@ invalidStrings.forEach((timeZone) => { () => instance.withTimeZone(timeZone), "reject minus zero as extended year" ); - assert.throws( - RangeError, - () => instance.withTimeZone({ timeZone }), - "reject minus zero as extended year (nested property)" - ); }); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-wrong-type.js index 12c59e6ba8..4615fba3ef 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-wrong-type.js @@ -23,7 +23,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => instance.withTimeZone(timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => instance.withTimeZone({ timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -32,8 +31,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => instance.withTimeZone(timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => instance.withTimeZone({ timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => instance.withTimeZone({ timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-instance-does-not-get-timeZone-property.js b/test/built-ins/Temporal/ZonedDateTime/timezone-instance-does-not-get-timeZone-property.js deleted file mode 100644 index c91da6c755..0000000000 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-instance-does-not-get-timeZone-property.js +++ /dev/null @@ -1,20 +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.zoneddatetime -description: > - A Temporal.TimeZone instance passed to new ZonedDateTime() does not have - its 'timeZone' property observably checked -features: [Temporal] ----*/ - -const timeZone = new Temporal.TimeZone("UTC"); -Object.defineProperty(timeZone, "timeZone", { - get() { - throw new Test262Error("timeZone.timeZone should not be accessed"); - }, -}); - -new Temporal.ZonedDateTime(0n, timeZone); -new Temporal.ZonedDateTime(0n, { timeZone }); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-string-datetime.js b/test/built-ins/Temporal/ZonedDateTime/timezone-string-datetime.js index 8efe9bc43b..abf963a8ef 100644 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-string-datetime.js +++ b/test/built-ins/Temporal/ZonedDateTime/timezone-string-datetime.js @@ -9,34 +9,23 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, { timeZone }), "bare date-time string is not a time zone"); timeZone = "2021-08-19T17:30Z"; const result1 = new Temporal.ZonedDateTime(0n, timeZone); assert.sameValue(result1.timeZoneId, "UTC", "date-time + Z is UTC time zone"); -const result2 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "date-time + Z is UTC time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00"; -const result3 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result3.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); -const result4 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result4.timeZoneId, "-07:00", "date-time + offset is the offset time zone (string in property bag)"); +const result2 = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result2.timeZoneId, "-07:00", "date-time + offset is the offset time zone"); timeZone = "2021-08-19T17:30[UTC]"; -const result5 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result5.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); -const result6 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result6.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result3.timeZoneId, "UTC", "date-time + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30Z[UTC]"; -const result7 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result7.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); -const result8 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result8.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result4 = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result4.timeZoneId, "UTC", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[UTC]"; -const result9 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result9.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); -const result10 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result10.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result5 = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result5.timeZoneId, "UTC", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-string-leap-second.js b/test/built-ins/Temporal/ZonedDateTime/timezone-string-leap-second.js index 1c07bc2170..b24c78060b 100644 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-string-leap-second.js +++ b/test/built-ins/Temporal/ZonedDateTime/timezone-string-leap-second.js @@ -9,11 +9,8 @@ features: [Temporal] let timeZone = "2016-12-31T23:59:60+00:00[UTC]"; -const result1 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result1.timeZoneId, "UTC", "Time zone string determined from bracket name"); -const result2 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result2.timeZoneId, "UTC", "Time zone string determined from bracket name (nested property)"); +const result = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result.timeZoneId, "UTC", "Time zone string determined from bracket name"); timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]"; assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, timeZone), "leap second in time zone name not valid"); -assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, { timeZone }), "leap second in time zone name not valid (nested property)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-string-multiple-offsets.js b/test/built-ins/Temporal/ZonedDateTime/timezone-string-multiple-offsets.js index 8411057aca..a57aab67f2 100644 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-string-multiple-offsets.js +++ b/test/built-ins/Temporal/ZonedDateTime/timezone-string-multiple-offsets.js @@ -9,7 +9,5 @@ features: [Temporal] const timeZone = "2021-08-19T17:30:45.123456789+01:46[+01:45:30.987654321]"; -const result1 = new Temporal.ZonedDateTime(0n, timeZone); -assert.sameValue(result1.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); -const result2 = new Temporal.ZonedDateTime(0n, { timeZone }); -assert.sameValue(result2.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); +const result = new Temporal.ZonedDateTime(0n, timeZone); +assert.sameValue(result.timeZoneId, "+01:45:30.987654321", "Time zone string determined from bracket name"); diff --git a/test/built-ins/Temporal/ZonedDateTime/timezone-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/timezone-wrong-type.js index 163050b3ce..c19d14e5e6 100644 --- a/test/built-ins/Temporal/ZonedDateTime/timezone-wrong-type.js +++ b/test/built-ins/Temporal/ZonedDateTime/timezone-wrong-type.js @@ -20,7 +20,6 @@ const rangeErrorTests = [ for (const [timeZone, description] of rangeErrorTests) { assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, timeZone), `${description} does not convert to a valid ISO string`); - assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, { timeZone }), `${description} does not convert to a valid ISO string (nested property)`); } const typeErrorTests = [ @@ -29,8 +28,4 @@ const typeErrorTests = [ for (const [timeZone, description] of typeErrorTests) { assert.throws(TypeError, () => new Temporal.ZonedDateTime(0n, timeZone), `${description} is not a valid object and does not convert to a string`); - assert.throws(TypeError, () => new Temporal.ZonedDateTime(0n, { timeZone }), `${description} is not a valid object and does not convert to a string (nested property)`); } - -const timeZone = undefined; -assert.throws(RangeError, () => new Temporal.ZonedDateTime(0n, { timeZone }), `undefined is always a RangeError as nested property`); diff --git a/test/intl402/Temporal/Instant/prototype/toString/timezone-string-datetime.js b/test/intl402/Temporal/Instant/prototype/toString/timezone-string-datetime.js index 0f7c812b6a..8a387fc3b6 100644 --- a/test/intl402/Temporal/Instant/prototype/toString/timezone-string-datetime.js +++ b/test/intl402/Temporal/Instant/prototype/toString/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toString({ timeZone }); assert.sameValue(result1.substr(-6), "-08:00", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result2.substr(-6), "-08:00", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toString({ timeZone }); -assert.sameValue(result3.substr(-6), "-08:00", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result4.substr(-6), "-08:00", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toString({ timeZone }); +assert.sameValue(result2.substr(-6), "-08:00", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toString({ timeZone }); -assert.sameValue(result5.substr(-6), "-08:00", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toString({ timeZone: { timeZone } }); -assert.sameValue(result6.substr(-6), "-08:00", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toString({ timeZone }); +assert.sameValue(result3.substr(-6), "-08:00", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js b/test/intl402/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js index 15b38c1591..96d0944fcc 100644 --- a/test/intl402/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/intl402/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime({ timeZone, calendar: "iso8601" }); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js b/test/intl402/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js index 205876ebbe..b86bebfe8a 100644 --- a/test/intl402/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js +++ b/test/intl402/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.Instant(0n); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toZonedDateTimeISO(timeZone); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toZonedDateTimeISO(timeZone); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTimeISO({ timeZone }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTimeISO(timeZone); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js b/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js index f2525a95a5..fc7b266592 100644 --- a/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js +++ b/test/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js @@ -8,7 +8,6 @@ features: [Temporal] let timeZone = "2021-08-19T17:30"; assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone"); -assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "bare date-time string is not a time zone"); // The following are all valid strings so should not throw: @@ -29,5 +28,4 @@ assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "ba "2021-08-19T1730-0700[America/Vancouver]", ].forEach((timeZone) => { Temporal.Now.plainDateTimeISO(timeZone); - Temporal.Now.plainDateTimeISO({ timeZone }); }); diff --git a/test/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js b/test/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js index d93a23d94c..da19dc9597 100644 --- a/test/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js +++ b/test/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js @@ -10,17 +10,11 @@ features: [Temporal] let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = Temporal.Now.zonedDateTime("iso8601", { timeZone }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js index 7e0c82c1d9..27a3696690 100644 --- a/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js +++ b/test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js @@ -10,17 +10,11 @@ features: [Temporal] let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = Temporal.Now.zonedDateTimeISO(timeZone); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = Temporal.Now.zonedDateTimeISO(timeZone); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = Temporal.Now.zonedDateTimeISO({ timeZone }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.Now.zonedDateTimeISO(timeZone); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js b/test/intl402/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js index d75c7e914c..777ff4b352 100644 --- a/test/intl402/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/intl402/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.PlainDate(2000, 5, 2); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toZonedDateTime(timeZone); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toZonedDateTime(timeZone); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toZonedDateTime(timeZone); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toZonedDateTime(timeZone); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime(timeZone); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js b/test/intl402/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js index f79c383b29..dd51f781a9 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.PlainDateTime(2000, 5, 2); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toZonedDateTime(timeZone); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toZonedDateTime(timeZone); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toZonedDateTime(timeZone); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toZonedDateTime(timeZone); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ timeZone }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime(timeZone); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js b/test/intl402/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js index 83a0689966..b84f5ceec6 100644 --- a/test/intl402/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js +++ b/test/intl402/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js @@ -12,17 +12,11 @@ const instance = new Temporal.PlainTime(); let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/TimeZone/from/argument-object.js b/test/intl402/Temporal/TimeZone/from/argument-object.js index 736e491385..235c25f285 100644 --- a/test/intl402/Temporal/TimeZone/from/argument-object.js +++ b/test/intl402/Temporal/TimeZone/from/argument-object.js @@ -33,13 +33,4 @@ for (const thisValue of thisValues) { const fromZdt = Temporal.TimeZone.from.call(thisValue, zdt); assert.notSameValue(fromZdt, zdt.getTimeZone(), "from() creates a new object for a string slot value"); assert.sameValue(fromZdt.id, "Africa/Cairo"); - - const tz = new Temporal.TimeZone("Africa/Cairo"); - const fromPropertyBagObject = Temporal.TimeZone.from.call(thisValue, { timeZone: tz }); - assert.sameValue(fromPropertyBagObject, tz); - assert.sameValue(fromPropertyBagObject.id, "Africa/Cairo"); - - const fromPropertyBagString = Temporal.TimeZone.from.call(thisValue, { timeZone: "Africa/Cairo" }); - assert(fromPropertyBagString instanceof Temporal.TimeZone); - assert.sameValue(fromPropertyBagString.id, "Africa/Cairo"); } diff --git a/test/intl402/Temporal/TimeZone/from/timezone-string-datetime.js b/test/intl402/Temporal/TimeZone/from/timezone-string-datetime.js index 579e79c4c1..15255c9cc0 100644 --- a/test/intl402/Temporal/TimeZone/from/timezone-string-datetime.js +++ b/test/intl402/Temporal/TimeZone/from/timezone-string-datetime.js @@ -10,17 +10,11 @@ features: [Temporal] let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = Temporal.TimeZone.from(timeZone); assert.sameValue(result1.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result2.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result3.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result4.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result2.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = Temporal.TimeZone.from(timeZone); -assert.sameValue(result5.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = Temporal.TimeZone.from({ timeZone }); -assert.sameValue(result6.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.TimeZone.from(timeZone); +assert.sameValue(result3.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js b/test/intl402/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js new file mode 100644 index 0000000000..6bb0670c8c --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js @@ -0,0 +1,28 @@ +// 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.zoneddatetime.compare +description: Conversion of ISO date-time strings to Temporal.TimeZone instances (with Intl time zones) +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(1588402800_000_000_000n, "America/Vancouver") + +let timeZone = "2021-08-19T17:30[America/Vancouver]"; +const result1 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance); +assert.sameValue(result1, 0, "date-time + IANA annotation is the IANA time zone (first argument)"); +const result2 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }); +assert.sameValue(result1, 0, "date-time + IANA annotation is the IANA time zone (second argument)"); + +timeZone = "2021-08-19T17:30Z[America/Vancouver]"; +const result3 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance); +assert.sameValue(result3, 0, "date-time + Z + IANA annotation is the IANA time zone (first argument)"); +const result4 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }); +assert.sameValue(result4, 0, "date-time + Z + IANA annotation is the IANA time zone (second argument)"); + +timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; +const result5 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance); +assert.sameValue(result5, 0, "date-time + offset + IANA annotation is the IANA time zone (first argument)"); +const result6 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone }); +assert.sameValue(result6, 0, "date-time + offset + IANA annotation is the IANA time zone (second argument)"); diff --git a/test/intl402/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js b/test/intl402/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js index ca8bb53342..fffa1e155f 100644 --- a/test/intl402/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js +++ b/test/intl402/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-datetime.js @@ -10,17 +10,11 @@ features: [Temporal] let timeZone = "2021-08-19T17:30[America/Vancouver]"; const result1 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); -const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; -const result3 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); -const result4 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result4.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); +const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; -const result5 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); -assert.sameValue(result5.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); -const result6 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } }); -assert.sameValue(result6.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); +const result3 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); +assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js b/test/intl402/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js index fa4b61c776..58a4bf9b83 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-datetime.js @@ -11,12 +11,9 @@ const expectedTimeZone = "America/Vancouver"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-08-19T17:30[America/Vancouver]"; assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + IANA annotation is the IANA time zone"); -assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + Z + IANA annotation is the IANA time zone"); -assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + Z + IANA annotation is the IANA time zone (string in property bag)"); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + offset + IANA annotation is the IANA time zone"); -assert(instance.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone: { timeZone } }), "date-time + offset + IANA annotation is the IANA time zone (string in property bag)"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js b/test/intl402/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js index 474e8b3b29..77b30310bd 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-string-datetime.js @@ -11,12 +11,9 @@ const expectedTimeZone = "America/Vancouver"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-08-19T17:30[America/Vancouver]"; instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; instance.since({ year: 2020, month: 5, day: 2, timeZone }); -instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js b/test/intl402/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js index 978d7307d5..c2cc0c9165 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-string-datetime.js @@ -11,12 +11,9 @@ const expectedTimeZone = "America/Vancouver"; const instance = new Temporal.ZonedDateTime(0n, expectedTimeZone); let timeZone = "2021-08-19T17:30[America/Vancouver]"; instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30Z[America/Vancouver]"; instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } }); timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; instance.until({ year: 2020, month: 5, day: 2, timeZone }); -instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } });