From 705cf94429a76d1e210b581c47ed7f3469cd24d2 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 7 Oct 2022 16:27:15 -0700 Subject: [PATCH] Temporal: Add tests for unknown annotation with critical flag See https://github.com/tc39/proposal-temporal/pull/2397 Adds tests for ISO strings with unrecognized annotations with the critical flag. These strings should all be rejected. --- ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 30 ++++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 31 +++++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 30 ++++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 29 +++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 31 +++++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 29 +++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 30 ++++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 23 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 24 ++++++++++++++ ...ment-string-critical-unknown-annotation.js | 26 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 27 ++++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ ...ment-string-critical-unknown-annotation.js | 25 +++++++++++++++ 63 files changed, 1594 insertions(+) create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/month/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/year/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Instant/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Instant/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Instant/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Instant/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/Instant/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/compare/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/from/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js create mode 100644 test/intl402/Temporal/Calendar/prototype/era/argument-string-critical-unknown-annotation.js create mode 100644 test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-critical-unknown-annotation.js diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..f165c8f2ee --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateadd +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateAdd(arg, new Temporal.Duration()), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..1efacbd80e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-critical-unknown-annotation.js @@ -0,0 +1,30 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateuntil +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..028bdf0b94 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.day +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.day(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..8b24b8afd5 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfWeek(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..cdccc47fec --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.dayOfYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..bfd23689e3 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinmonth +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInMonth(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..d6a7f65475 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinweek +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInWeek(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..65a7981d01 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinyear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.daysInYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..6387d90667 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.inleapyear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.inLeapYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..0e7b9ed099 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.month +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.month(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..ee3e52cddb --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthcode +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthCode(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..f7de7fc936 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthsinyear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.monthsInYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..3912c15907 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.weekofyear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.weekOfYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..0d5e92f9fa --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.year +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.year(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Instant/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..31bde5409d --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,31 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +const epoch = new Temporal.Instant(0n); + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.Instant.compare(arg, epoch), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.Instant.compare(epoch, arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Instant/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..c994075bf4 --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.Instant.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..4aeff55683 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..464ee8e37e --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..b5c559a7af --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..555d4cf756 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,30 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..ea8840b036 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..5a2a62d35f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..a0f43b18e3 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..3b7c31e3d7 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.toplaindatetime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..bcfbd29488 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.tozoneddatetime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..e34303e8e6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..83e0c6763a --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,29 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..4862f56696 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..892e592a3f --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..38db547fa6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..2df877ccf0 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..54f071da91 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaindate +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..34c21eefd4 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaintime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..d0d71734cc --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainMonthDay.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..dfa7a3ace4 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainMonthDay(5, 2); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..4625312d09 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,31 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(arg, new Temporal.PlainTime(12, 34, 56, 987, 654, 321)), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(new Temporal.PlainTime(12, 34, 56, 987, 654, 321), arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..51df21a3aa --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..8ffe48133f --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..a41824557b --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..cc0677cf38 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.toplaindatetime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..243bedfad1 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tozoneddatetime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..769ef40e97 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..a6813f74e0 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,29 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)), + `reject unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..ab80f1122c --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..cf6c306d05 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..7bb6baaf89 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..f30c6b004f --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..561a17da8f --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getInstantFor(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..d805a9438d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getnexttransition +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getNextTransition(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..612c9cba7d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetnanosecondsfor +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getOffsetNanosecondsFor(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..bd0210330c --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetstringfor +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getOffsetStringFor(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..b527f247ad --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getplaindatetimefor +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPlainDateTimeFor(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..972e3b4e30 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getpossibleinstantsfor +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPossibleInstantsFor(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..527c45e2dd --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getprevioustransition +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00Z[!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar]", + "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.getPreviousTransition(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..fa21bffb8e --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-critical-unknown-annotation.js @@ -0,0 +1,30 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +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 unknown annotation with critical flag: ${arg} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(datetime, arg), + `reject unknown annotation with critical flag: ${arg} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..ba0a356876 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-critical-unknown-annotation.js @@ -0,0 +1,23 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; + +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..c1fcd5403a --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..b7b184ddd0 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.since(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..a29b7bc4c8 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-critical-unknown-annotation.js @@ -0,0 +1,24 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[UTC][u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.until(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..4be359871c --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-critical-unknown-annotation.js @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaindate +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..3ae28dfd0c --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-critical-unknown-annotation.js @@ -0,0 +1,27 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaintime +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "00:00[!foo=bar]", + "T00:00[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-critical-unknown-annotation.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..94613036ae --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.era +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.era(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-critical-unknown-annotation.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-critical-unknown-annotation.js new file mode 100644 index 0000000000..c1af895dc2 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-critical-unknown-annotation.js @@ -0,0 +1,25 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.erayear +description: Unknown annotations with critical flag are rejected +features: [Temporal] +---*/ + +const invalidStrings = [ + "1970-01-01[!foo=bar]", + "1970-01-01T00:00[!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar]", + "1970-01-01T00:00[u-ca=iso8601][!foo=bar]", + "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]", + "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]", +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach((arg) => { + assert.throws( + RangeError, + () => instance.eraYear(arg), + `reject unknown annotation with critical flag: ${arg}` + ); +});