diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation.js index 90decf88f5..f1410a3bec 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..a379e8440b --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateadd +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateAdd(arg, new Temporal.Duration()), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation.js index 0817c8e16b..12548196ef 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..59ecbccad7 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-multiple-calendar.js @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateuntil +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation.js index f32c36f8e4..622017206e 100644 --- a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..54c4b3fe5e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.day +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.day(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation.js index ce9230d65f..3f8737b22d 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..51d52285af --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfWeek(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation.js index 0d0e1511b6..0235ad75be 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..f66c4785e2 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation.js index 28feba274d..059c2aea60 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..2738cd5d66 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinmonth +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInMonth(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation.js index 00da31048a..e0867649e5 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..3b0bc93a04 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinweek +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInWeek(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation.js index 20880a6f06..b55d840850 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..fbfda521df --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinyear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation.js index e82961e7be..357c21fa02 100644 --- a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..5830790c2b --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.inleapyear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.inLeapYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation.js index f7da6d3d50..2bc9f9a474 100644 --- a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..43cf9d0e5e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.month +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.month(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation.js index 4505d52dbf..b98f969fb3 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..64b96901f0 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthcode +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthCode(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation.js index ee88ab9824..c19e1d7a05 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..9ec5f1eb75 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthsinyear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthsInYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation.js index 9bf2a29566..d56595ab72 100644 --- a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..f5261c6cbb --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.weekofyear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.weekOfYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation.js index 7132ec6e10..422ec49498 100644 --- a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..da117a163e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.year +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.year(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation.js index cefe90e1f5..ec34837843 100644 --- a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..364a43c6d0 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.yearofweek +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.yearOfWeek(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation.js index 4c11f5f832..7336725aac 100644 --- a/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Instant/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..a8aac8fff6 --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-multiple-calendar.js @@ -0,0 +1,32 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +const epoch = new Temporal.Instant(0n); + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.Instant.compare(arg, epoch), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.Instant.compare(epoch, arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation.js index 3b5310c090..aaec43e11b 100644 --- a/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/Instant/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Instant/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..0785a6e894 --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.Instant.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation.js index fb4f3a39cf..4387ed259d 100644 --- a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.Instant(0n); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..d1acb1976c --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation.js index 8056b73b98..fcab109a3c 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.Instant(0n); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..812e7f16ee --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation.js index 7887c61513..f6b6e40978 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.Instant(0n); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..1990e24e92 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation.js index 2b6387d693..96abd031e9 100644 --- a/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..2b6d69efe3 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-multiple-calendar.js @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation.js index 617ac7eb7e..bc2ad03ebe 100644 --- a/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..cba13a6aec --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation.js index f92904cc57..5e047f19f4 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDate(2000, 5, 2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..3de0227eaf --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation.js index 68279b7f3d..598fb0946b 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDate(2000, 5, 2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..4ea7fbfc52 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation.js index 68df2aa4f9..de2186fc6f 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation.js @@ -25,7 +25,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDate(2000, 5, 2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..dec111baca --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.toplaindatetime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation.js index eff862ee0e..71908e657d 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation.js @@ -24,7 +24,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDate(2000, 5, 2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..2cec8e3590 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.tozoneddatetime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation.js index a324273222..07e858c043 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDate(2000, 5, 2); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..a94fbe8d56 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation.js index f98f1b7757..cab70a3216 100644 --- a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..50b2d4ff51 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-multiple-calendar.js @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation.js index e5709ad371..adda008756 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..94e3228adf --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation.js index 1a09f0aad5..c5bb3fcb7b 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..a2d403dd13 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation.js index aa14181bf7..320a373038 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..3168687432 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation.js index 56d241fdd5..8ce263c82a 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..021f66ecde --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js index aa414240bf..6aed52f85d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..7d236f9fe5 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaindate +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js index 9ec7b9476b..9994b2d60a 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js @@ -25,7 +25,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..9a7fed3df4 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaintime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation.js index 54dcdfe9e2..9fbe773924 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["1976-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..31b45f0946 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainMonthDay.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation.js index 1da1eb37d7..1145898536 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["1976-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainMonthDay(5, 2); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..af0173597d --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainMonthDay(5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation.js index ea387f7d83..a24129cc3b 100644 --- a/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation.js @@ -21,7 +21,6 @@ const tests = [ ["1970-01-01T12:34:56.987654321[!u-ca=iso8601]", "with !, date, and no time zone"], ["1970-01-01T12:34:56.987654321[UTC][!u-ca=iso8601]", "with !, date, and time zone"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..be05ad6f43 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-multiple-calendar.js @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(arg, new Temporal.PlainTime(12, 34, 56, 987, 654, 321)), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(new Temporal.PlainTime(12, 34, 56, 987, 654, 321), arg), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation.js index af52c96a02..8375464ecc 100644 --- a/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation.js @@ -25,7 +25,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..b6f2e20ceb --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation.js index f71e86f970..597aa0c7fe 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation.js @@ -24,7 +24,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..f4801ffffb --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation.js index 64025684aa..8b19127246 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation.js @@ -25,7 +25,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..9b7c4ac82c --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation.js index 40950a0b99..a0d745c9ae 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..ee035cef28 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.toplaindatetime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation.js index c32a12c35a..028035f122 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..42894d3285 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tozoneddatetime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation.js index 2f518f9ea7..b295301780 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation.js @@ -25,7 +25,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..c69a68ba49 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation.js index ca15d7067d..4e0d4b9edd 100644 --- a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["2019-12-15T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2019-12-15T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2019-12-15T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2019-12-15T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..be8ea1019a --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-multiple-calendar.js @@ -0,0 +1,34 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation.js index c0a5c4dc2a..6eac644aa0 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["2019-12-15T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2019-12-15T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2019-12-15T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2019-12-15T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..778e3480ca --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation.js index e94d368392..09ee7e189a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["2019-12-15T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2019-12-15T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2019-12-15T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2019-12-15T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainYearMonth(2019, 12); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..f645286cf6 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation.js index be7dc5dcd0..5e40a87534 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["2019-12-15T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2019-12-15T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2019-12-15T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2019-12-15T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainYearMonth(2019, 12); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..29b0e33a63 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation.js index f764083c59..37e2e3fa84 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["2019-12-15T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2019-12-15T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2019-12-15T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2019-12-15T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.PlainYearMonth(2019, 12); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..7a5603e125 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation.js index 1ae9e99b8b..118f11679e 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation.js @@ -13,7 +13,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..1d1e6ef70f --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getInstantFor(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js index e655390e68..db98cdb83d 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..5adbdb1fa9 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getnexttransition +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getNextTransition(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation.js index 8bb055bb2b..684f02a478 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..4301e8e77b --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetnanosecondsfor +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getOffsetNanosecondsFor(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation.js index 17b5c0076e..dfd5bc0d03 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..d190bbdcdb --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetstringfor +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getOffsetStringFor(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation.js index 4a7191a146..c5a032b404 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation.js @@ -16,7 +16,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..eeb2ce24b4 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getplaindatetimefor +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPlainDateTimeFor(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation.js index 313685f5ba..4b18b0f3e4 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation.js @@ -14,7 +14,6 @@ const tests = [ ["1976-11-18T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["1976-11-18T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["1976-11-18T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1976-11-18T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..6115c8e6d3 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getpossibleinstantsfor +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPossibleInstantsFor(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js index e01352ea53..6ede7be636 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["1970-01-01T00:00Z[u-ca=discord]", "annotation is ignored"], ["1970-01-01T00:00Z[!u-ca=discord]", "annotation with ! is ignored"], ["1970-01-01T00:00Z[u-ca=iso8601][u-ca=discord]", "two annotations are ignored"], - ["1970-01-01T00:00Z[u-ca=iso8601][!u-ca=discord]", "two annotations are ignored even with !"], ]; const instance = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..090cfc0e4d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getprevioustransition +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00Z[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00Z[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPreviousTransition(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation.js index 63075d2efa..57b0ceff3c 100644 --- a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation.js @@ -11,7 +11,6 @@ const tests = [ ["1970-01-01T00:00[UTC][u-ca=iso8601]", "without !"], ["1970-01-01T00:00[UTC][!u-ca=iso8601]", "with !"], ["1970-01-01T00:00[UTC][u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..bf1c1ebebb --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-multiple-calendar.js @@ -0,0 +1,31 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[UTC][!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +const datetime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(arg, datetime), + `reject more than one calendar annotation if any critical: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(datetime, arg), + `reject more than one calendar annotation if any critical: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js index c6c27b56b4..197ef49f8e 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation.js @@ -11,7 +11,6 @@ const tests = [ ["1970-01-01T00:00[UTC][u-ca=iso8601]", "without !"], ["1970-01-01T00:00[UTC][!u-ca=iso8601]", "with !"], ["1970-01-01T00:00[UTC][u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; tests.forEach(([arg, description]) => { diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..996aa7ddcf --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-multiple-calendar.js @@ -0,0 +1,24 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[UTC][!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation.js index ada074e5d4..72352bbc3b 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation.js @@ -11,7 +11,6 @@ const tests = [ ["1970-01-01T00:00[UTC][u-ca=iso8601]", "without !"], ["1970-01-01T00:00[UTC][!u-ca=iso8601]", "with !"], ["1970-01-01T00:00[UTC][u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const timeZone = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..7627303897 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[UTC][!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation.js index 1797eb7b50..575382d8ed 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation.js @@ -12,7 +12,6 @@ const tests = [ ["1970-01-01T00:00[UTC][u-ca=iso8601]", "without !"], ["1970-01-01T00:00[UTC][!u-ca=iso8601]", "with !"], ["1970-01-01T00:00[UTC][u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const timeZone = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..4e6737e183 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[UTC][!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation.js index eebcfa79b7..832a57b7c5 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation.js @@ -12,7 +12,6 @@ const tests = [ ["1970-01-01T00:00[UTC][u-ca=iso8601]", "without !"], ["1970-01-01T00:00[UTC][!u-ca=iso8601]", "with !"], ["1970-01-01T00:00[UTC][u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const timeZone = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..1d028c5482 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-multiple-calendar.js @@ -0,0 +1,25 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[UTC][!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js index 0d25c4c3d0..37e63c1489 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const timeZone = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..e28544dc36 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-multiple-calendar.js @@ -0,0 +1,30 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaindate +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js index b63b578cd6..fc696e7975 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation.js @@ -24,7 +24,6 @@ const tests = [ ["12:34:56.987654321[u-ca=unknown]", "calendar annotation ignored even if unknown calendar"], ["12:34:56.987654321[!u-ca=unknown]", "calendar annotation ignored even if unknown calendar with !"], ["1970-01-01T12:34:56.987654321[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["1970-01-01T12:34:56.987654321[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const timeZone = new Temporal.TimeZone("UTC"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..7b83150ee5 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-multiple-calendar.js @@ -0,0 +1,30 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaintime +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[u-ca=iso8601][!u-ca=iso8601]", + "00:00[!u-ca=iso8601][u-ca=iso8601]", + "00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation.js index 68b6b81534..86214a5587 100644 --- a/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation.js +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-multiple-calendar.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..6c1da80f38 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.era +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.era(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation.js index e2221c807e..d2d6ed0a2c 100644 --- a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation.js +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation.js @@ -15,7 +15,6 @@ const tests = [ ["2000-05-02T15:23[!u-ca=iso8601]", "with ! and no time zone"], ["2000-05-02T15:23[UTC][!u-ca=iso8601]", "with ! and time zone"], ["2000-05-02T15:23[u-ca=iso8601][u-ca=discord]", "second annotation ignored"], - ["2000-05-02T15:23[u-ca=iso8601][!u-ca=discord]", "second annotation ignored even with !"], ]; const instance = new Temporal.Calendar("iso8601"); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-multiple-calendar.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-multiple-calendar.js new file mode 100644 index 0000000000..7886e01eb0 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-multiple-calendar.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.erayear +description: > + More than one calendar annotation is not syntactical if any have the criical + flag +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", + "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.eraYear(arg), + `reject more than one calendar annotation if any critical: ${arg}` + ); +});