From 6685c6c81c264bbe94a3f07f9307ffe03e2073f4 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 28 Jul 2022 17:47:08 -0700 Subject: [PATCH] Temporal: Add tests for casting a calendar ID string to a Temporal.Calendar This adds tests to every entry point where a Temporal.Calendar is accepted, making sure that a calendar ID string is also accepted. --- .../Temporal/Calendar/from/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 21 +++++++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../toZonedDateTime/calendar-string.js | 15 +++++++++++++ .../Temporal/Now/plainDate/calendar-string.js | 13 ++++++++++++ .../Now/plainDateTime/calendar-string.js | 13 ++++++++++++ .../Now/zonedDateTime/calendar-string.js | 13 ++++++++++++ .../Temporal/PlainDate/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 18 ++++++++++++++++ .../argument-propertybag-calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../prototype/withCalendar/calendar-string.js | 15 +++++++++++++ .../Temporal/PlainDateTime/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 18 ++++++++++++++++ .../argument-propertybag-calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../prototype/withCalendar/calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../Temporal/PlainMonthDay/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../PlainYearMonth/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 18 ++++++++++++++++ .../argument-propertybag-calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../getPlainDateTimeFor/calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../Temporal/ZonedDateTime/calendar-string.js | 13 ++++++++++++ .../argument-propertybag-calendar-string.js | 20 ++++++++++++++++++ .../argument-propertybag-calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 18 ++++++++++++++++ .../argument-propertybag-calendar-string.js | 18 ++++++++++++++++ .../prototype/withCalendar/calendar-string.js | 15 +++++++++++++ .../argument-propertybag-calendar-string.js | 17 +++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ .../argument-propertybag-calendar-string.js | 16 ++++++++++++++ 58 files changed, 922 insertions(+) create mode 100644 test/built-ins/Temporal/Calendar/from/calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js create mode 100644 test/built-ins/Temporal/Now/plainDate/calendar-string.js create mode 100644 test/built-ins/Temporal/Now/plainDateTime/calendar-string.js create mode 100644 test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js create mode 100644 test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js create mode 100644 test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-string.js create mode 100644 test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-string.js diff --git a/test/built-ins/Temporal/Calendar/from/calendar-string.js b/test/built-ins/Temporal/Calendar/from/calendar-string.js new file mode 100644 index 0000000000..fbc7d5fe67 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/from/calendar-string.js @@ -0,0 +1,13 @@ +// 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.from +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = Temporal.Calendar.from(arg); +assert.sameValue(result.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..16947d3c8e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.dateAdd(arg, new Temporal.Duration()); +TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..30aa19220c --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-string.js @@ -0,0 +1,21 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; + +const result1 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 18)); +TemporalHelpers.assertDuration(result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${arg} (first argument)"`); + +const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), arg); +TemporalHelpers.assertDuration(result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${arg} (second argument)"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..72c2dea5cf --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.day(arg); +assert.sameValue(result, 18, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..ff85fc04f2 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.dayOfWeek(arg); +assert.sameValue(result, 4, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..8d56f169b4 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.dayOfYear(arg); +assert.sameValue(result, 323, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..5b27cf9e20 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.daysInMonth(arg); +assert.sameValue(result, 30, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..7f4f510557 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.daysInWeek(arg); +assert.sameValue(result, 7, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..3ce72bbc34 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.daysInYear(arg); +assert.sameValue(result, 366, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..69ee72c9af --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.inLeapYear(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..d62b7b932a --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.month(arg); +assert.sameValue(result, 11, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..cfd0da823e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.monthCode(arg); +assert.sameValue(result, "M11", `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..8c1930eb07 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.monthsInYear(arg); +assert.sameValue(result, 12, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..553543a140 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.weekOfYear(arg); +assert.sameValue(result, 47, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..178a13dfd1 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.year(arg); +assert.sameValue(result, 1976, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js new file mode 100644 index 0000000000..6984994a46 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-string.js @@ -0,0 +1,15 @@ +// 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.tozoneddatetime +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Instant(1_000_000_000_000_000_000n); + +const arg = "iso8601"; + +const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" }); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/plainDate/calendar-string.js b/test/built-ins/Temporal/Now/plainDate/calendar-string.js new file mode 100644 index 0000000000..5e411bfd35 --- /dev/null +++ b/test/built-ins/Temporal/Now/plainDate/calendar-string.js @@ -0,0 +1,13 @@ +// 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.now.plaindate +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = Temporal.Now.plainDate(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js b/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js new file mode 100644 index 0000000000..4a43867f52 --- /dev/null +++ b/test/built-ins/Temporal/Now/plainDateTime/calendar-string.js @@ -0,0 +1,13 @@ +// 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.now.plaindatetime +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = Temporal.Now.plainDateTime(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js new file mode 100644 index 0000000000..52c9084a23 --- /dev/null +++ b/test/built-ins/Temporal/Now/zonedDateTime/calendar-string.js @@ -0,0 +1,13 @@ +// 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.now.zoneddatetime +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = Temporal.Now.zonedDateTime(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/calendar-string.js b/test/built-ins/Temporal/PlainDate/calendar-string.js new file mode 100644 index 0000000000..252f3ae145 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/calendar-string.js @@ -0,0 +1,13 @@ +// 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.constructor +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = new Temporal.PlainDate(2000, 5, 2, arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..c400baee24 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-string.js @@ -0,0 +1,18 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; + +const result1 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)); +assert.sameValue(result1, 0, `Calendar created from string "${arg}" (first argument)`); + +const result2 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg); +assert.sameValue(result2, 0, `Calendar created from string "${arg}" (second argument)`); diff --git a/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..686f2dd052 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-propertybag-calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = Temporal.PlainDate.from(arg); +TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..dc7541cd26 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.equals(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..23dbd20dcb --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.since(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..7bbdea7cfc --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.until(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js new file mode 100644 index 0000000000..928e2979ca --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-string.js @@ -0,0 +1,15 @@ +// 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.withcalendar +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" }); + +const arg = "iso8601"; + +const result = instance.withCalendar(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/calendar-string.js new file mode 100644 index 0000000000..bde22b76bd --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/calendar-string.js @@ -0,0 +1,13 @@ +// 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.constructor +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..4fada99c0b --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-string.js @@ -0,0 +1,18 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; + +const result1 = Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)); +assert.sameValue(result1, 0, `Calendar created from string "${arg}" (first argument)`); + +const result2 = Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg); +assert.sameValue(result2, 0, `Calendar created from string "${arg}" (second argument)`); diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..8d5818e0eb --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-propertybag-calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = Temporal.PlainDateTime.from(arg); +TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..d97d621d54 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.equals(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..57ff169415 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.since(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..405c07db1c --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.until(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js new file mode 100644 index 0000000000..68f1313e47 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-string.js @@ -0,0 +1,15 @@ +// 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.withcalendar +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" }); + +const arg = "iso8601"; + +const result = instance.withCalendar(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..c44d1bb27f --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.withPlainDate(arg); +TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainMonthDay/calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js new file mode 100644 index 0000000000..cc41c4d0eb --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/calendar-string.js @@ -0,0 +1,13 @@ +// 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.constructor +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = new Temporal.PlainMonthDay(12, 15, arg, 1972); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..083758e034 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-propertybag-calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { monthCode: "M11", day: 18, calendar }; +const result = Temporal.PlainMonthDay.from(arg); +TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..0c0dbeabf3 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainMonthDay(11, 18); + +const calendar = "iso8601"; + +const arg = { monthCode: "M11", day: 18, calendar }; +const result = instance.equals(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..247205057e --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.toPlainDateTime(arg); +TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..1180aadc8b --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); +assert.sameValue(result.epochNanoseconds, 217_168_496_987_654_321n, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js new file mode 100644 index 0000000000..1c2be402ae --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/calendar-string.js @@ -0,0 +1,13 @@ +// 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.constructor +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = new Temporal.PlainYearMonth(2000, 5, arg, 1); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..c6c04f6c6e --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-propertybag-calendar-string.js @@ -0,0 +1,18 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 2019, monthCode: "M06", calendar }; + +const result1 = Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)); +assert.sameValue(result1, 0, `Calendar created from string "${arg}" (first argument)`); + +const result2 = Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg); +assert.sameValue(result2, 0, `Calendar created from string "${arg}" (second argument)`); diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..4b84505e6a --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-propertybag-calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const arg = { year: 2019, monthCode: "M06", calendar }; +const result = Temporal.PlainYearMonth.from(arg); +TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..8b3f682415 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2019, 6); + +const calendar = "iso8601"; + +const arg = { year: 2019, monthCode: "M06", calendar }; +const result = instance.equals(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..e0497eea12 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2019, 6); + +const calendar = "iso8601"; + +const arg = { year: 2019, monthCode: "M06", calendar }; +const result = instance.since(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..3e907d8f55 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2019, 6); + +const calendar = "iso8601"; + +const arg = { year: 2019, monthCode: "M06", calendar }; +const result = instance.until(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..c578c197c5 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.TimeZone("UTC"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.getInstantFor(arg); +assert.sameValue(result.epochNanoseconds, 217_123_200_000_000_000n, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js new file mode 100644 index 0000000000..f97f14a433 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.TimeZone("UTC"); + +const arg = "iso8601"; + +const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..1bdd88042d --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +includes: [compareArray.js] +features: [Temporal] +---*/ + +const instance = new Temporal.TimeZone("UTC"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.getPossibleInstantsFor(arg); +assert.compareArray(result.map(i => i.epochNanoseconds), [217_123_200_000_000_000n], `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js new file mode 100644 index 0000000000..783609253a --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/calendar-string.js @@ -0,0 +1,13 @@ +// 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.constructor +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const arg = "iso8601"; + +const result = new Temporal.ZonedDateTime(0n, "UTC", arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..07c9fa2e97 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-string.js @@ -0,0 +1,20 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const timeZone = new Temporal.TimeZone("UTC"); +const datetime = new Temporal.ZonedDateTime(0n, timeZone); +const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; + +const result1 = Temporal.ZonedDateTime.compare(arg, datetime); +assert.sameValue(result1, 0, `Calendar created from string "${arg}" (first argument)`); + +const result2 = Temporal.ZonedDateTime.compare(datetime, arg); +assert.sameValue(result2, 0, `Calendar created from string "${arg}" (second argument)`); diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..bbaff1285f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-calendar-string.js @@ -0,0 +1,15 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const calendar = "iso8601"; + +const timeZone = new Temporal.TimeZone("UTC"); +const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; +const result = Temporal.ZonedDateTime.from(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..f9d8641d73 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const calendar = "iso8601"; + +const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; +const result = instance.equals(arg); +assert.sameValue(result, true, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..ba81bd841d --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-calendar-string.js @@ -0,0 +1,18 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const calendar = "iso8601"; + +const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; +const result = instance.since(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..792f99d3e2 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-string.js @@ -0,0 +1,18 @@ +// 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: A calendar ID is valid input for Calendar +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(0n, timeZone); + +const calendar = "iso8601"; + +const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar }; +const result = instance.until(arg); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js new file mode 100644 index 0000000000..83b7743d84 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-string.js @@ -0,0 +1,15 @@ +// 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.withcalendar +description: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" }); + +const arg = "iso8601"; + +const result = instance.withCalendar(arg); +assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${arg}"`); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..1dae1d4b84 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-propertybag-calendar-string.js @@ -0,0 +1,17 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const timeZone = new Temporal.TimeZone("UTC"); +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, timeZone); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.withPlainDate(arg); +assert.sameValue(result.epochNanoseconds, 217_129_600_000_000_000n, `Calendar created from string "${calendar}"`); diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-string.js b/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..01f059cd64 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.era(arg); +assert.sameValue(result, undefined, `Calendar created from string "${calendar}"`); diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-string.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-string.js new file mode 100644 index 0000000000..dab3adfc1c --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-propertybag-calendar-string.js @@ -0,0 +1,16 @@ +// 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: A calendar ID is valid input for Calendar +features: [Temporal] +---*/ + +const instance = new Temporal.Calendar("iso8601"); + +const calendar = "iso8601"; + +const arg = { year: 1976, monthCode: "M11", day: 18, calendar }; +const result = instance.eraYear(arg); +assert.sameValue(result, undefined, `Calendar created from string "${calendar}"`);