diff --git a/harness/temporalHelpers.js b/harness/temporalHelpers.js index 113db3da67..91f05cbd8a 100644 --- a/harness/temporalHelpers.js +++ b/harness/temporalHelpers.js @@ -2020,6 +2020,9 @@ var TemporalHelpers = { "11-18junk", "11-18[u-ca=gregory]", "11-18[u-ca=hebrew]", + "11-18[U-CA=iso8601]", + "11-18[u-CA=iso8601]", + "11-18[FOO=bar]", ]; }, @@ -2107,6 +2110,11 @@ var TemporalHelpers = { plainYearMonthStringsInvalid() { return [ "2020-13", + "1976-11[u-ca=gregory]", + "1976-11[u-ca=hebrew]", + "1976-11[U-CA=iso8601]", + "1976-11[u-CA=iso8601]", + "1976-11[FOO=bar]", ]; }, diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..718b83c6bd --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateadd +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.dateAdd(arg, new Temporal.Duration()), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..28260458d4 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,27 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateuntil +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..c883f62f1e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.day +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.day(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..67defe4d91 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.dayOfWeek(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..11583c2699 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.dayOfYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..be5615d56f --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinmonth +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.daysInMonth(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ea1697559e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinweek +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.daysInWeek(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8720589b58 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinyear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.daysInYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8c3d445d7f --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.inleapyear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.inLeapYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..872a8dd73d --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.month +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.month(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..829eda0614 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthcode +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.monthCode(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..d04ea566ed --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthsinyear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.monthsInYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..0587d163db --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.weekofyear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.weekOfYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..b6d34e38fe --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.year +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.year(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..b379ca8373 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.yearofweek +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.yearOfWeek(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..47b63154ee --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const epoch = new Temporal.Instant(0n); + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.Instant.compare(arg, epoch), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.Instant.compare(epoch, arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..f965e0da01 --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.Instant.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..c6b4928850 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..44a78f0567 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..217e034564 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Instant(0n); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8004b62da9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,27 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..d96700ba6a --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..a63e7b419c --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ba42ce2430 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8fb5465b94 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.toplaindatetime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8fd9ea7756 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.tozoneddatetime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..148b04e1f7 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDate(2000, 5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..3f80f31711 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,27 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..b735be7854 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..4f4bd62ab6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..dc2929175c --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..9fdf98b7d5 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..231a4bdefb --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaindate +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..bde8161a9f --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaintime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..21cd225fba --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainMonthDay.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..2d70e98e42 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainMonthDay(5, 2); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..6d6431aa1a --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,33 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(arg, new Temporal.PlainTime(12, 34, 56, 987, 654, 321)), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainTime.compare(new Temporal.PlainTime(12, 34, 56, 987, 654, 321), arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..51a4c42e60 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainTime.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..c109c395ad --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..f267f393c2 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..a43626e456 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.toplaindatetime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.toPlainDateTime(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ca20c7806e --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tozoneddatetime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..eeaaebf082 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..d845def48d --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,27 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..962cb8a391 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8444ffd1dd --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ebdec3dd0a --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ff05b679cb --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.PlainYearMonth(2000, 5); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..0ab9cb35bc --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getInstantFor(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..c70b2259b5 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getnexttransition +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getNextTransition(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..72093a11d8 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetnanosecondsfor +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getOffsetNanosecondsFor(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..85567f5e5d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetstringfor +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getOffsetStringFor(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..2708de707a --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getplaindatetimefor +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getPlainDateTimeFor(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ebbf696eac --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getpossibleinstantsfor +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getPossibleInstantsFor(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..24c567b1df --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getprevioustransition +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00Z[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00Z[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00Z[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.TimeZone("UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.getPreviousTransition(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..932470864a --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const datetime = new Temporal.ZonedDateTime(0n, "UTC"); + +const invalidStrings = [ + ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(arg, datetime), + `annotation keys must be lowercase: ${arg} - ${descr} (first argument)` + ); + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.compare(datetime, arg), + `annotation keys must be lowercase: ${arg} - ${descr} (second argument)` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..b73df83840 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"], +]; + +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); + for (const offset of ["use", "prefer", "ignore", "reject"]) { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(arg, { offset }), + `annotation keys must be lowercase: ${arg} - ${descr} (offset ${offset})` + ); + } +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..5384695e4f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.ZonedDateTime(0n, "UTC"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.equals(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..c1705471d4 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"], +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.since(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..4375637118 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"], +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.until(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..4afe3bf794 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,23 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaindate +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.withPlainDate(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..32b59887c0 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,29 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaintime +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"], + ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"], + ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"], + ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"], + ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"], + ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"], + ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"], + ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"], + ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.withPlainTime(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation-invalid-key.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..8d570e5b22 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.era +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.era(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation-invalid-key.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation-invalid-key.js new file mode 100644 index 0000000000..ac1c686e8b --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-calendar-annotation-invalid-key.js @@ -0,0 +1,22 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.erayear +description: Annotation keys are lowercase-only +features: [Temporal] +---*/ + +const invalidStrings = [ + ["1970-01-01[U-CA=iso8601]", "invalid capitalized key"], + ["1970-01-01[u-CA=iso8601]", "invalid partially-capitalized key"], + ["1970-01-01[FOO=bar]", "invalid capitalized unrecognized key"], +]; +const instance = new Temporal.Calendar("iso8601"); +invalidStrings.forEach(([arg, descr]) => { + assert.throws( + RangeError, + () => instance.eraYear(arg), + `annotation keys must be lowercase: ${arg} - ${descr}` + ); +});