diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js index 3197c54007c..df173c933f7 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js @@ -17,6 +17,11 @@ features: [Temporal, arrow-function] const calendar = new Temporal.Calendar("iso8601"); const date = new Temporal.PlainDate(2000, 5, 2, calendar); const duration = new Temporal.Duration(3, 3, 0, 3); -assert.throws(RangeError, - () => calendar.dateAdd(date, duration, { overflow: "other string" }), - "Value for overflow not one of the allowed string values"); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => calendar.dateAdd(date, duration, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js index 6cc0d01724d..28e81de7ceb 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js @@ -17,6 +17,12 @@ features: [Temporal, arrow-function] ---*/ const calendar = new Temporal.Calendar("iso8601"); -assert.throws(RangeError, () => calendar.dateFromFields({ year: 2000, month: 5, day: 2 }, - { overflow: "other string" }), - "Value for overflow not one of the allowed string values"); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => calendar.dateFromFields({ year: 2000, month: 5, day: 2 }, + { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js index 2e87dc1a67a..6844c7e3d2b 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js @@ -17,4 +17,11 @@ features: [Temporal] ---*/ const calendar = new Temporal.Calendar("iso8601"); -assert.throws(RangeError, () => calendar.monthDayFromFields({ year: 2000, month: 5, day: 2 }, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => calendar.monthDayFromFields({ year: 2000, month: 5, day: 2 }, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js index 99ffe6af277..77c14141097 100644 --- a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js +++ b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js @@ -17,4 +17,11 @@ features: [Temporal] ---*/ const calendar = new Temporal.Calendar("iso8601"); -assert.throws(RangeError, () => calendar.yearMonthFromFields({ year: 2000, month: 5 }, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => calendar.yearMonthFromFields({ year: 2000, month: 5 }, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/PlainDate/from/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDate/from/overflow-invalid-string.js index f04f77f745b..27e499961c5 100644 --- a/test/built-ins/Temporal/PlainDate/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/from/overflow-invalid-string.js @@ -34,8 +34,14 @@ const invalidOverflow = [ "CONSTRAIN", "constra\u0131n", ]; -validItems.forEach((item) => { - invalidOverflow.forEach((overflow) => { - assert.throws(RangeError, () => Temporal.PlainDate.from(item, { overflow })); - }); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const item of validItems) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.PlainDate.from(item, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js index 66282d2a6c3..6c7b65fd879 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js @@ -18,6 +18,12 @@ features: [Temporal] const date = new Temporal.PlainDate(2000, 5, 2); const duration = new Temporal.Duration(3, 3, 0, 3); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => date.add(duration, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => date.add(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js index d3cbd6e8074..9387c6aff46 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js @@ -18,6 +18,12 @@ features: [Temporal] const date = new Temporal.PlainDate(2000, 5, 2); const duration = new Temporal.Duration(3, 3, 0, 3); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => date.subtract(duration, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => date.subtract(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js index d35f66be86b..acef874825b 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js @@ -17,6 +17,12 @@ features: [Temporal] ---*/ const date = new Temporal.PlainDate(2000, 5, 2); -["", "CONSTRAIN", "balance", "other string"].forEach((overflow) => - assert.throws(RangeError, () => date.with({ month: 8 }, { overflow })) -); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => date.with({ month: 8 }, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js index 41673499f72..1786ed59049 100644 --- a/test/built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js @@ -31,6 +31,14 @@ const validValues = [ { year: 2000, month: 5, day: 2, hour: 12 }, "2000-05-02T12:00", ]; -validValues.forEach((value) => { - assert.throws(RangeError, () => Temporal.PlainDateTime.from(value, { overflow: "other string" })); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const value of validValues) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.PlainDateTime.from(value, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js index 40124a8f32d..6ce6ecc29de 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js @@ -21,11 +21,12 @@ features: [Temporal] const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12); const duration = new Temporal.Duration(3, 3, 0, 3, 3); -const badOverflows = ['', 'CONSTRAIN', 'balance', "other string"]; -badOverflows.forEach((overflow) => { + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { assert.throws( RangeError, () => datetime.add({ months: 1 }, { overflow }), `invalid overflow ("${overflow}")` ); -}); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js index 1e1f1761c81..c3e4b694f44 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js @@ -20,4 +20,11 @@ features: [Temporal] const date = new Temporal.PlainDateTime(2000, 5, 2, 12); const duration = new Temporal.Duration(3, 3, 0, 3, 3); -assert.throws(RangeError, () => date.subtract(duration, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => date.subtract(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js index c23b9e9e970..4d3b05b0eac 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js @@ -18,10 +18,12 @@ features: [Temporal] ---*/ const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12); -const badOverflows = ["", "CONSTRAIN", "balance", "other string"]; -badOverflows.forEach((overflow) => { + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { assert.throws( RangeError, () => datetime.with({ minute: 45 }, { overflow }), - `invalid overflow string (${overflow})`); -}); + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js b/test/built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js index c2427006fdc..48ccf843643 100644 --- a/test/built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js @@ -27,6 +27,14 @@ const validValues = [ { monthCode: "M05", day: 2 }, "05-02", ]; -validValues.forEach((value) => { - assert.throws(RangeError, () => Temporal.PlainMonthDay.from(value, { overflow: "other string" })); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const value of validValues) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.PlainMonthDay.from(value, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js index 5ed47e97538..0036dfe6380 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js @@ -17,6 +17,12 @@ features: [Temporal] ---*/ const monthday = new Temporal.PlainMonthDay(5, 2); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => monthday.with({ day: 8 }, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => monthday.with({ day: 8 }, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainTime/from/overflow-invalid-string.js b/test/built-ins/Temporal/PlainTime/from/overflow-invalid-string.js index 856d071453e..dcefde8a682 100644 --- a/test/built-ins/Temporal/PlainTime/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/from/overflow-invalid-string.js @@ -19,8 +19,14 @@ const validValues = [ { hour: 12 }, "12:00", ]; -validValues.forEach((value) => { - ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"].forEach((overflow) => { - assert.throws(RangeError, () => Temporal.PlainTime.from(value, { overflow })); - }); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const value of validValues) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.PlainTime.from(value, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js index 796cec5fcf3..dc50e7795bc 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js @@ -16,6 +16,12 @@ features: [Temporal] const time = new Temporal.PlainTime(12); const values = ["", "CONSTRAIN", "balance", "other string"]; -for (const overflow of values) { - assert.throws(RangeError, () => time.with({ minute: 45 }, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => time.with({ minute: 45 }, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js index d30774eece5..11335f2481a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js @@ -27,8 +27,14 @@ const validValues = [ { year: 2000, month: 5 }, "2000-05", ]; -validValues.forEach((value) => { - ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"].forEach((overflow) => { - assert.throws(RangeError, () => Temporal.PlainYearMonth.from(value, { overflow })); - }); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const value of validValues) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.PlainYearMonth.from(value, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js index 4913de46a29..1633f1b6544 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js @@ -20,6 +20,12 @@ features: [Temporal] const yearmonth = new Temporal.PlainYearMonth(2000, 5); const duration = new Temporal.Duration(1, 1); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => yearmonth.add(duration, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => yearmonth.add(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js index 8c2efb855a7..46286d5a6a2 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js @@ -20,6 +20,12 @@ features: [Temporal] const yearmonth = new Temporal.PlainYearMonth(2000, 5); const duration = new Temporal.Duration(1, 1); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => yearmonth.subtract(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js index 587c66754c8..4684d597f3e 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js @@ -17,6 +17,12 @@ features: [Temporal] ---*/ const yearmonth = new Temporal.PlainYearMonth(2000, 5); -for (const overflow of ["", "CONSTRAIN", "balance", "other string", "constra\u0131n"]) { - assert.throws(RangeError, () => yearmonth.with({ month: 8 }, { overflow })); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => yearmonth.with({ month: 8 }, { overflow }), + `invalid overflow ("${overflow}")` + ); } diff --git a/test/built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js index 5913d3e7f96..e8406c57e37 100644 --- a/test/built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js @@ -32,6 +32,14 @@ const validValues = [ { year: 2000, month: 5, day: 2, hour: 12, timeZone: "UTC" }, "2001-09-09T01:46:40.987654321+00:00[UTC]", ]; -validValues.forEach((value) => { - assert.throws(RangeError, () => Temporal.ZonedDateTime.from(value, { overflow: "other string" })); -}); + +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const value of validValues) { + for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => Temporal.ZonedDateTime.from(value, { overflow }), + `invalid overflow ("${overflow}")` + ); + } +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js index 4c88b568784..ede72ad4a96 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js @@ -20,4 +20,11 @@ features: [Temporal] const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC"); const duration = new Temporal.Duration(0, 0, 0, 1); -assert.throws(RangeError, () => datetime.add(duration, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => datetime.add(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js index 8c144ef70d0..7a7d4fd1206 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js @@ -20,4 +20,11 @@ features: [Temporal] const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC"); const duration = new Temporal.Duration(0, 0, 0, 1); -assert.throws(RangeError, () => datetime.subtract(duration, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => datetime.subtract(duration, { overflow }), + `invalid overflow ("${overflow}")` + ); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js index 96d5ab3799d..843437f59fd 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js @@ -18,4 +18,11 @@ features: [Temporal] ---*/ const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC"); -assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: "other string" })); +const badOverflows = ["", "CONSTRAIN", "balance", "other string", "constra\u0131n", "reject\0"]; +for (const overflow of badOverflows) { + assert.throws( + RangeError, + () => datetime.with({ minute: 45 }, { overflow }), + `invalid overflow ("${overflow}")` + ); +}