diff --git a/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-coptic.js b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-coptic.js new file mode 100644 index 0000000000..63aeb5b5af --- /dev/null +++ b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-coptic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (coptic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "coptic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-coptic.js +// Months + +const common1230 = Temporal.PlainDate.from({ year: 1738, monthCode: "M12", day: 30, calendar }, options); +const leap1230 = Temporal.PlainDate.from({ year: 1739, monthCode: "M12", day: 30, calendar }, options); + +TemporalHelpers.assertPlainDate( + common1230.with({ monthCode: "M13" }), + 1738, 13, "M13", 5, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 1738); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDate( + leap1230.with({ monthCode: "M13" }), + 1739, 13, "M13", 6, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 1739); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethioaa.js b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethioaa.js new file mode 100644 index 0000000000..8e5fcf49f8 --- /dev/null +++ b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethioaa.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethioaa calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethioaa"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethioaa.js +// Months + +const common1230 = Temporal.PlainDate.from({ year: 7514, monthCode: "M12", day: 30, calendar }, options); +const leap1230 = Temporal.PlainDate.from({ year: 7515, monthCode: "M12", day: 30, calendar }, options); + +TemporalHelpers.assertPlainDate( + common1230.with({ monthCode: "M13" }), + 7514, 13, "M13", 5, "Changing month constrains to day 5 of common-year epagomenal month", + "aa", 7514); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDate( + leap1230.with({ monthCode: "M13" }), + 7515, 13, "M13", 6, "Changing month constrains to day 6 of leap-year epagomenal month", + "aa", 7515); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethiopic.js b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethiopic.js new file mode 100644 index 0000000000..c18dc4cc1e --- /dev/null +++ b/test/intl402/Temporal/PlainDate/prototype/with/constrain-day-ethiopic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethiopic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethiopic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethiopic.js +// Months + +const common1230 = Temporal.PlainDate.from({ year: 2014, monthCode: "M12", day: 30, calendar }, options); +const leap1230 = Temporal.PlainDate.from({ year: 2015, monthCode: "M12", day: 30, calendar }, options); + +TemporalHelpers.assertPlainDate( + common1230.with({ monthCode: "M13" }), + 2014, 13, "M13", 5, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 2014); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDate( + leap1230.with({ monthCode: "M13" }), + 2015, 13, "M13", 6, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 2015); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-coptic.js b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-coptic.js new file mode 100644 index 0000000000..1ff0412c21 --- /dev/null +++ b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-coptic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (coptic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "coptic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-coptic.js +// Months + +const common1230 = Temporal.PlainDateTime.from({ year: 1738, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); +const leap1230 = Temporal.PlainDateTime.from({ year: 1739, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }), + 1738, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 1738); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }), + 1739, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 1739); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethioaa.js b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethioaa.js new file mode 100644 index 0000000000..40f1734ccb --- /dev/null +++ b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethioaa.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethioaa calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethioaa"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethioaa.js +// Months + +const common1230 = Temporal.PlainDateTime.from({ year: 7514, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); +const leap1230 = Temporal.PlainDateTime.from({ year: 7515, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }), + 7514, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "aa", 7514); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }), + 7515, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "aa", 7515); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethiopic.js b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethiopic.js new file mode 100644 index 0000000000..42640127db --- /dev/null +++ b/test/intl402/Temporal/PlainDateTime/prototype/with/constrain-day-ethiopic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethiopic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethiopic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethiopic.js +// Months + +const common1230 = Temporal.PlainDateTime.from({ year: 2014, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); +const leap1230 = Temporal.PlainDateTime.from({ year: 2015, monthCode: "M12", day: 30, hour: 12, minute: 34, calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }), + 2014, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 2014); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }), + 2015, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 2015); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-coptic.js b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-coptic.js new file mode 100644 index 0000000000..a0a4296897 --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-coptic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (coptic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "coptic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-coptic.js +// Months + +const common1230 = Temporal.ZonedDateTime.from({ year: 1738, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); +const leap1230 = Temporal.ZonedDateTime.from({ year: 1739, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }).toPlainDateTime(), + 1738, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 1738); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }).toPlainDateTime(), + 1739, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 1739); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethioaa.js b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethioaa.js new file mode 100644 index 0000000000..a8aaa6e75d --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethioaa.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethioaa calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethioaa"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethioaa.js +// Months + +const common1230 = Temporal.ZonedDateTime.from({ year: 7514, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); +const leap1230 = Temporal.ZonedDateTime.from({ year: 7515, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }).toPlainDateTime(), + 7514, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "aa", 7514); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }).toPlainDateTime(), + 7515, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "aa", 7515); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethiopic.js b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethiopic.js new file mode 100644 index 0000000000..3b31e3bb84 --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/with/constrain-day-ethiopic.js @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.with +description: > + Check various basic calculations involving constraining days to the end of the + epagomenal month (ethiopic calendar) +features: [Temporal, Intl.Era-monthcode] +includes: [temporalHelpers.js] +---*/ + +const calendar = "ethiopic"; +const options = { overflow: "reject" }; + +// Years - see leap-year-ethiopic.js +// Months + +const common1230 = Temporal.ZonedDateTime.from({ year: 2014, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); +const leap1230 = Temporal.ZonedDateTime.from({ year: 2015, monthCode: "M12", day: 30, hour: 12, minute: 34, timeZone: "UTC", calendar }, options); + +TemporalHelpers.assertPlainDateTime( + common1230.with({ monthCode: "M13" }).toPlainDateTime(), + 2014, 13, "M13", 5, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 5 of common-year epagomenal month", + "am", 2014); +assert.throws(RangeError, function () { + common1230.with({ monthCode: "M13" }, options); +}, "Changing month to common-year epagomenal month rejects"); + +TemporalHelpers.assertPlainDateTime( + leap1230.with({ monthCode: "M13" }).toPlainDateTime(), + 2015, 13, "M13", 6, 12, 34, 0, 0, 0, 0, "Changing month constrains to day 6 of leap-year epagomenal month", + "am", 2015); +assert.throws(RangeError, function () { + leap1230.with({ monthCode: "M13" }, options); +}, "Changing month to leap-year epagomenal month rejects");