diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..d285863cbd5 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-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.dateadd +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dateAdd(arg, new Temporal.Duration()); + + TemporalHelpers.assertPlainDate( + result, + 2000, 5, "M05", 2, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..3b83c67e5fb --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dateUntil(arg, arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..40038e90dac --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-string-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.calendar.prototype.day +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.day(arg); + + assert.sameValue( + result, + 2, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..806494ecf37 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-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.calendar.prototype.dayofweek +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dayOfWeek(arg); + + assert.sameValue( + result, + 2, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..dbeb37d96f8 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-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.calendar.prototype.dayofyear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.dayOfYear(arg); + + assert.sameValue( + result, + 123, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..8541062e59f --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-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.calendar.prototype.daysinmonth +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInMonth(arg); + + assert.sameValue( + result, + 31, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..56f900bb369 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-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.calendar.prototype.daysinweek +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInWeek(arg); + + assert.sameValue( + result, + 7, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..12c900339c3 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-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.calendar.prototype.daysinyear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.daysInYear(arg); + + assert.sameValue( + result, + 366, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..539fe4533a8 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-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.calendar.prototype.inleapyear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.inLeapYear(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..6a966dfced8 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-string-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.calendar.prototype.month +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.month(arg); + + assert.sameValue( + result, + 5, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..ed3ef4d428e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-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.calendar.prototype.monthcode +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.monthCode(arg); + + assert.sameValue( + result, + "M05", + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..118150626ed --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-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.calendar.prototype.monthsinyear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.monthsInYear(arg); + + assert.sameValue( + result, + 12, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..951d276a1c8 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-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.calendar.prototype.weekofyear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.weekOfYear(arg); + + assert.sameValue( + result, + 18, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..e6ab34eeeeb --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-string-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.calendar.prototype.year +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.year(arg); + + assert.sameValue( + result, + 2000, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Instant/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..08c761a6dd1 --- /dev/null +++ b/test/built-ins/Temporal/Instant/compare/argument-string-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.instant.compare +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.Instant.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Instant/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..f51a241adca --- /dev/null +++ b/test/built-ins/Temporal/Instant/from/argument-string-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.instant.from +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.Instant.from(arg); + + assert.sameValue( + result.epochNanoseconds, + 0n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..2d1ee64f9f3 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..0c032c524aa --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/argument-string-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.instant.prototype.since +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/Instant/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/Instant/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..2816b6035af --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/argument-string-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.instant.prototype.until +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Instant(0n); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..9bd1428f74f --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-string-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.plaindate.compare +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDate.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..f08ca2ca9fd --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDate.from(arg); + + TemporalHelpers.assertPlainDate( + result, + 2000, 5, "M05", 2, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..9eefcba2125 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-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.plaindate.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..a1f9dab3850 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-string-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.prototype.since +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..482a705eeba --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-unknown-annotation.js @@ -0,0 +1,37 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.toPlainDateTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..3ac8970b0a0 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-unknown-annotation.js @@ -0,0 +1,36 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }); + + assert.sameValue( + result.epochNanoseconds, + 957_270_896_987_654_321n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..221f1cf733e --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-string-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.prototype.until +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDate(2000, 5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..f4be81345ff --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-string-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.compare +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDateTime.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..49b2dfc4336 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-string-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.plaindatetime.from +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainDateTime.from(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1976, 11, "M11", 18, 15, 23, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..eceefb2b92e --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..28220cd8e3d --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-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.prototype.since +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..e5cb615127a --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-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.prototype.until +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..1071909235b --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-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.plaindatetime.prototype.withplaindate +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainDate(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 15, 23, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..307b1ba9ab9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js @@ -0,0 +1,37 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..263377f4a36 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-string-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.plainmonthday.from +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1976-05-02T15:23[foo=bar]", "alone"], + ["1976-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["1976-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainMonthDay.from(arg); + + TemporalHelpers.assertPlainMonthDay( + result, + "M05", 2, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..bbed2a0c751 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1976-05-02T15:23[foo=bar]", "alone"], + ["1976-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["1976-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainMonthDay(5, 2); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..0c7069446aa --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/compare/argument-string-unknown-annotation.js @@ -0,0 +1,34 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainTime.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..9ef22988fb3 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/from/argument-string-unknown-annotation.js @@ -0,0 +1,35 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainTime.from(arg); + + TemporalHelpers.assertPlainTime( + result, + 12, 34, 56, 987, 654, 321, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..4c4323d0695 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,36 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..8cf94c1edc5 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/argument-string-unknown-annotation.js @@ -0,0 +1,37 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..e8814197582 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-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.plaintime.prototype.toplaindatetime +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.toPlainDateTime(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..2c829f70769 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-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.plaintime.prototype.tozoneddatetime +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); + + assert.sameValue( + result.epochNanoseconds, + 957_270_896_987_654_321n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..2a6f5ff3cc0 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/argument-string-unknown-annotation.js @@ -0,0 +1,37 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..af273efc943 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-string-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.plainyearmonth.compare +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2019-12-15T15:23[foo=bar]", "alone"], + ["2019-12-15T15:23[UTC][foo=bar]", "with time zone"], + ["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainYearMonth.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..7a1a5b915e7 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-string-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.plainyearmonth.from +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[foo=bar]", "alone"], + ["2019-12-15T15:23[UTC][foo=bar]", "with time zone"], + ["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.PlainYearMonth.from(arg); + + TemporalHelpers.assertPlainYearMonth( + result, + 2019, 12, "M12", + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..7a6a52aa5a1 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2019-12-15T15:23[foo=bar]", "alone"], + ["2019-12-15T15:23[UTC][foo=bar]", "with time zone"], + ["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..60870ca4827 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-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.prototype.since +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[foo=bar]", "alone"], + ["2019-12-15T15:23[UTC][foo=bar]", "with time zone"], + ["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..365c2bd84de --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-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.prototype.until +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["2019-12-15T15:23[foo=bar]", "alone"], + ["2019-12-15T15:23[UTC][foo=bar]", "with time zone"], + ["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.PlainYearMonth(2019, 12); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..91bb85df9f5 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getInstantFor(arg); + + assert.sameValue( + result.epochNanoseconds, + 217_178_580_000_000_000n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..53f49b74b99 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getnexttransition +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getNextTransition(arg); + + assert.sameValue( + result, + null, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..1534172c6ac --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetnanosecondsfor +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getOffsetNanosecondsFor(arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..46666bda446 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getoffsetstringfor +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getOffsetStringFor(arg); + + assert.sameValue( + result, + "+00:00", + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..89983064f38 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-string-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.timezone.prototype.getplaindatetimefor +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPlainDateTimeFor(arg); + + TemporalHelpers.assertPlainDateTime( + result, + 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..dd94565cc5c --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-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.timezone.prototype.getpossibleinstantsfor +description: Various forms of unknown annotation +features: [Temporal] +includes: [compareArray.js] +---*/ + +const tests = [ + ["1976-11-18T15:23[foo=bar]", "alone"], + ["1976-11-18T15:23[UTC][foo=bar]", "with time zone"], + ["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPossibleInstantsFor(arg); + + assert.compareArray( + result.map(i => i.epochNanoseconds), + [217_178_580_000_000_000n], + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..7d964fba19a --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getprevioustransition +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00Z[foo=bar]", "alone"], + ["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"], + ["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.TimeZone("UTC"); + +tests.forEach(([arg, description]) => { + const result = instance.getPreviousTransition(arg); + + assert.sameValue( + result, + null, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..8c9b5800814 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-string-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.zoneddatetime.compare +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"], + ["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"], + ["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.ZonedDateTime.compare(arg, arg); + + assert.sameValue( + result, + 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..229abfa2205 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-string-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.zoneddatetime.from +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"], + ["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"], + ["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +tests.forEach(([arg, description]) => { + const result = Temporal.ZonedDateTime.from(arg); + + assert.sameValue( + result.epochNanoseconds, + 0n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..eb815b4d71f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-unknown-annotation.js @@ -0,0 +1,28 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"], + ["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"], + ["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.equals(arg); + + assert.sameValue( + result, + true, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..8e3b643be9c --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-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.zoneddatetime.prototype.since +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"], + ["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"], + ["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.since(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..471ef894156 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-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.zoneddatetime.prototype.until +description: Various forms of unknown annotation +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const tests = [ + ["1970-01-01T00:00[UTC][foo=bar]", "with time zone"], + ["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"], + ["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"], + ["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.until(arg); + + TemporalHelpers.assertDuration( + result, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..d07b5c627e5 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-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.prototype.withplaindate +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainDate(arg); + + assert.sameValue( + result.epochNanoseconds, + 957_225_600_000_000_000n, + `unknown annotation (${description})` + ); +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..f5e4e9395c2 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-unknown-annotation.js @@ -0,0 +1,37 @@ +// 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: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["12:34:56.987654321[foo=bar]", "alone"], + ["12:34:56.987654321[UTC][foo=bar]", "with time zone"], + ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"], + ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["T12:34:56.987654321[foo=bar]", "with T"], + ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"], + ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"], + ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"], + ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"], + ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"], + ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +tests.forEach(([arg, description]) => { + const result = instance.withPlainTime(arg); + + assert.sameValue( + result.epochNanoseconds, + 45_296_987_654_321n, + `unknown annotation (${description})` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-string-unknown-annotation.js b/test/intl402/Temporal/Calendar/prototype/era/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..940ea78fa38 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-string-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.calendar.prototype.era +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.era(arg); + + assert.sameValue( + result, + undefined, + `unknown annotation (${description})` + ); +}); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-unknown-annotation.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-unknown-annotation.js new file mode 100644 index 00000000000..d98a8537b09 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-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.calendar.prototype.erayear +description: Various forms of unknown annotation +features: [Temporal] +---*/ + +const tests = [ + ["2000-05-02[foo=bar]", "without time"], + ["2000-05-02T15:23[foo=bar]", "alone"], + ["2000-05-02T15:23[UTC][foo=bar]", "with time zone"], + ["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"], + ["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"], + ["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"], +]; + +const instance = new Temporal.Calendar("iso8601"); + +tests.forEach(([arg, description]) => { + const result = instance.eraYear(arg); + + assert.sameValue( + result, + undefined, + `unknown annotation (${description})` + ); +});