From 0184842b09748b805d87c7bd8f87e7e88b1f4944 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 18 Oct 2021 14:16:28 -0700 Subject: [PATCH] Test rejection of "Z" UTC designators in Plain strings Tests for the normative changes made to Temporal in https://github.com/tc39/proposal-temporal/pull/1874 --- .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 27 +++++++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 26 ++++++++++++++++++ .../argument-string-with-utc-designator.js | 20 ++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 26 ++++++++++++++++++ .../argument-string-with-utc-designator.js | 20 ++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 20 ++++++++++++++ .../PlainMonthDay/from/fields-string.js | 3 +-- .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 26 ++++++++++++++++++ .../argument-string-with-utc-designator.js | 20 ++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 26 ++++++++++++++++++ .../argument-string-with-utc-designator.js | 20 ++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ .../argument-string-with-utc-designator.js | 21 +++++++++++++++ 49 files changed, 1030 insertions(+), 2 deletions(-) create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/compare/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/from/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/compare/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/from/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/from/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/from/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js create mode 100644 test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js create mode 100644 test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..6c60a8c4b8a --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.dateadd +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateAdd(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..8aa77d5e756 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js @@ -0,0 +1,27 @@ +// 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.calendar.prototype.dateuntil +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +const plainDate = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateUntil(arg, plainDate), + "String with UTC designator should not be valid as a PlainDate (first argument)" + ); + assert.throws( + RangeError, + () => instance.dateUntil(plainDate, arg), + "String with UTC designator should not be valid as a PlainDate (second argument)" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..04a1a7af9cc --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.day +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.day(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..03e1b79e161 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.dayofweek +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfWeek(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..9a9a64034da --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.dayofyear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..c0c1db53d34 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.daysinmonth +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInMonth(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..3db13fecb3a --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.daysinweek +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInWeek(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..b19041f274a --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.daysinyear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..a4ef7f78a37 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.inleapyear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.inLeapYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..874d8969a41 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.month +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.month(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..36e61a87351 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.monthcode +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthCode(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..6525702930c --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.monthsinyear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthsInYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..65513108298 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.weekofyear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.weekOfYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..5d8a8c91c72 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.year +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.year(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..4e5adcda0e9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-with-utc-designator.js @@ -0,0 +1,26 @@ +// 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.plaindate.compare +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const plainDate = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(arg, plainDate), + "String with UTC designator should not be valid as a PlainDate (first argument)" + ); + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(plainDate, arg), + "String with UTC designator should not be valid as a PlainDate (second argument)" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/from/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..10fa5a31263 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-with-utc-designator.js @@ -0,0 +1,20 @@ +// 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.plaindate.from +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..ce6eb2c9f04 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.equals +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..cac649374f9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.since +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..65c1bc1c82a --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.toplaindatetime +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..ee1fa639c02 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.tozoneddatetime +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..6b6198c8770 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindate.prototype.until +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..696793495b3 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-with-utc-designator.js @@ -0,0 +1,26 @@ +// 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.plaindatetime.compare +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const dateTime = new Temporal.PlainDateTime(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, dateTime), + "String with UTC designator should not be valid as a PlainDateTime (first argument)" + ); + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, dateTime), + "String with UTC designator should not be valid as a PlainDateTime (second argument)" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..bb4495586d7 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-with-utc-designator.js @@ -0,0 +1,20 @@ +// 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.plaindatetime.from +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..b5e50fab421 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.equals +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..f2ec0252b64 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.since +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..1964e576c16 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.until +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..1e7bb2021b4 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.withplaindate +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..80baeb2ea52 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaindatetime.prototype.withplaintime +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..a02040a02a0 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-with-utc-designator.js @@ -0,0 +1,20 @@ +// 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.plainmonthday.from +description: RangeError thrown if a string with UTC designator is used as a PlainMonthDay +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainMonthDay.from(arg), + "String with UTC designator should not be valid as a PlainMonthDay" + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js b/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js index 618e654049b..8386dcd1cbd 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/fields-string.js @@ -12,8 +12,6 @@ const tests = [ "10-01", "1001", "1965-10-01", - "2019-10-01T09:00:00Z", - "2019-10-01T00:00:00Z", "1976-10-01T152330.1+00:00", "19761001T15:23:30.1+00:00", "1976-10-01T15:23:30.1+0000", @@ -28,6 +26,7 @@ const tests = [ "+0019761001T15:23:30.1+0000", "+0019761001T152330.1+00:00", "+0019761001T152330.1+0000", + "1976-10-01T15:23:00", "1976-10-01T15:23", "1976-10-01T15", "1976-10-01", diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..c022733553e --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plainmonthday.prototype.equals +description: RangeError thrown if a string with UTC designator is used as a PlainMonthDay +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainMonthDay(5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + "String with UTC designator should not be valid as a PlainMonthDay" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..61b28a61f59 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js @@ -0,0 +1,26 @@ +// 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.plaintime.compare +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const plainTime = new Temporal.PlainTime(); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(arg, plainTime), + "String with UTC designator should not be valid as a PlainTime (first argument)" + ); + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(plainTime, arg), + "String with UTC designator should not be valid as a PlainTime (second argument)" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..70e7b22506b --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js @@ -0,0 +1,20 @@ +// 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.plaintime.from +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.from(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..8ea64a6f57f --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.equals +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..ccc946fbc56 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.since +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..eae48d0ee22 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.toplaindatetime +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..7af7b65a9a5 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.tozoneddatetime +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainDate: arg }), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..a64138a1a1e --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.until +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..d1bd7ab5253 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator.js @@ -0,0 +1,26 @@ +// 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.plainyearmonth.compare +description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const yearMonth = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(arg, yearMonth), + "String with UTC designator should not be valid as a PlainYearMonth (first argument)" + ); + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(yearMonth, arg), + "String with UTC designator should not be valid as a PlainYearMonth (second argument)" + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..96aa55f278f --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-with-utc-designator.js @@ -0,0 +1,20 @@ +// 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.plainyearmonth.from +description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(arg), + "String with UTC designator should not be valid as a PlainYearMonth" + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..a98dd0f502f --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plainyearmonth.prototype.equals +description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + "String with UTC designator should not be valid as a PlainYearMonth" + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..0ad1f56edbb --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plainyearmonth.prototype.since +description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + "String with UTC designator should not be valid as a PlainYearMonth" + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..1fab4ff184d --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.plainyearmonth.prototype.until +description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + "String with UTC designator should not be valid as a PlainYearMonth" + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..d607c549b08 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getInstantFor(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-with-utc-designator.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..c6032d465ba --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getpossibleinstantsfor +description: RangeError thrown if a string with UTC designator is used as a PlainDateTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPossibleInstantsFor(arg), + "String with UTC designator should not be valid as a PlainDateTime" + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..19b30f77335 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.prototype.withplaindate +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..f821197cc46 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.prototype.withplaintime +description: RangeError thrown if a string with UTC designator is used as a PlainTime +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + "String with UTC designator should not be valid as a PlainTime" + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..4ad95a15f89 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.era +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.era(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js new file mode 100644 index 00000000000..a02303876a9 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js @@ -0,0 +1,21 @@ +// 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.calendar.prototype.erayear +description: RangeError thrown if a string with UTC designator is used as a PlainDate +features: [Temporal, arrow-function] +---*/ + +const invalidStrings = [ + "2019-10-01T09:00:00Z", + "2019-10-01T09:00:00Z[UTC]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.eraYear(arg), + "String with UTC designator should not be valid as a PlainDate" + ); +});