diff --git a/test/built-ins/Temporal/Duration/prototype/round/smallestunit-invalid-string.js b/test/built-ins/Temporal/Duration/prototype/round/smallestunit-invalid-string.js index 3d5d884b52..0904c0ccc8 100644 --- a/test/built-ins/Temporal/Duration/prototype/round/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Duration/prototype/round/smallestunit-invalid-string.js @@ -8,4 +8,20 @@ features: [Temporal] ---*/ const duration = new Temporal.Duration(0, 0, 0, 0, 12, 34, 56, 123, 987, 500); -assert.throws(RangeError, () => duration.round({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => duration.round({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js b/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js index 046b4a99f7..5405996c5d 100644 --- a/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js @@ -8,7 +8,32 @@ features: [Temporal] ---*/ const duration = new Temporal.Duration(0, 0, 0, 0, 12, 34, 56, 123, 987, 500); -const values = ["eras", "years", "months", "weeks", "days", "hours", "minutes", "nonsense", "other string", "mill\u0131seconds", "SECONDS"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => duration.toString({ smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "hour", + "minute", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "hours", + "minutes", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => duration.toString({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/Instant/prototype/round/smallestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/round/smallestunit-invalid-string.js index 298c3ce64d..3756037909 100644 --- a/test/built-ins/Temporal/Instant/prototype/round/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/round/smallestunit-invalid-string.js @@ -8,4 +8,28 @@ features: [Temporal] ---*/ const instant = new Temporal.Instant(1_000_000_000_123_987_500n); -assert.throws(RangeError, () => instant.round({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => instant.round({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/Instant/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/since/largestunit-invalid-string.js index 57aa9977ef..48befae125 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.Instant(1_000_000_000_000_000_000n); const later = new Temporal.Instant(1_000_090_061_987_654_321n); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/Instant/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/since/smallestunit-invalid-string.js index 0e91f3e745..25f795a89a 100644 --- a/test/built-ins/Temporal/Instant/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.Instant(1_000_000_000_000_000_000n); const later = new Temporal.Instant(1_000_090_061_987_654_321n); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js index f6ba6e30cc..10b0b72baa 100644 --- a/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js @@ -8,4 +8,30 @@ features: [Temporal] ---*/ const instant = new Temporal.Instant(1_000_000_000_123_987_500n); -assert.throws(RangeError, () => instant.toString({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "hour", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "hours", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => instant.toString({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/Instant/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/until/largestunit-invalid-string.js index 9d288cd6d6..0837ea1dbb 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.Instant(1_000_000_000_000_000_000n); const later = new Temporal.Instant(1_000_090_061_987_654_321n); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/Instant/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/Instant/prototype/until/smallestunit-invalid-string.js index 145ea2b808..146b390014 100644 --- a/test/built-ins/Temporal/Instant/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/Instant/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.Instant(1_000_000_000_000_000_000n); const later = new Temporal.Instant(1_000_090_061_987_654_321n); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/since/largestunit-invalid-string.js index 9b31fbaabc..3b047aa86a 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,30 @@ features: [Temporal] const earlier = new Temporal.PlainDate(2000, 5, 2); const later = new Temporal.PlainDate(2001, 6, 3); -const values = ["era", "eraYear", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/since/smallestunit-invalid-string.js index b06b57f530..2bc9968ca6 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,30 @@ features: [Temporal] const earlier = new Temporal.PlainDate(2000, 5, 2); const later = new Temporal.PlainDate(2001, 6, 3); -const values = ["era", "eraYear", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/until/largestunit-invalid-string.js index b06f5d6ed8..379dd28424 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,30 @@ features: [Temporal] const earlier = new Temporal.PlainDate(2000, 5, 2); const later = new Temporal.PlainDate(2001, 6, 3); -const values = ["era", "eraYear", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDate/prototype/until/smallestunit-invalid-string.js index 3eb01aaee8..8382c5c924 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,30 @@ features: [Temporal] const earlier = new Temporal.PlainDate(2000, 5, 2); const later = new Temporal.PlainDate(2001, 6, 3); -const values = ["era", "eraYear", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-invalid-string.js index e4d8f8503c..f37ebe513c 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-invalid-string.js @@ -8,4 +8,26 @@ features: [Temporal] ---*/ const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 987, 500); -assert.throws(RangeError, () => datetime.round({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => datetime.round({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/largestunit-invalid-string.js index 1e8f9c8054..547667d70d 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0); const later = new Temporal.PlainDateTime(2001, 6, 3, 13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-invalid-string.js index a031b3f0ff..6fc80aa6a0 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0); const later = new Temporal.PlainDateTime(2000, 5, 3, 13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js index 1d1a6aaeca..10e19530c1 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js @@ -8,4 +8,30 @@ features: [Temporal] ---*/ const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 987, 500); -assert.throws(RangeError, () => datetime.toString({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "hour", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "hours", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => datetime.toString({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/largestunit-invalid-string.js index a3cf0f6aff..aa7ca9a4c3 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0); const later = new Temporal.PlainDateTime(2001, 6, 3, 13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-invalid-string.js index 781434f7af..d12bb40e32 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0); const later = new Temporal.PlainDateTime(2000, 5, 3, 13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/round/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/round/smallestunit-invalid-string.js index 1da2034e11..917a5a409d 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/round/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/round/smallestunit-invalid-string.js @@ -8,7 +8,28 @@ features: [Temporal] ---*/ const time = new Temporal.PlainTime(12, 34, 56, 123, 987, 500); -const values = ["era", "year", "month", "week", "day", "years", "months", "weeks", "days", "nonsense", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => time.round({ smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => time.round({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/since/largestunit-invalid-string.js index f74105aba5..0faa16156a 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0); const later = new Temporal.PlainTime(13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/since/smallestunit-invalid-string.js index de440191cf..b375626bf5 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0); const later = new Temporal.PlainTime(13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js index d5ea0a7b3e..d093928a48 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js @@ -8,6 +8,30 @@ features: [Temporal] ---*/ const time = new Temporal.PlainTime(12, 34, 56, 123, 987, 500); -for (const smallestUnit of ["era", "year", "month", "day", "hour", "nonsense", "other string", "m\u0131nute", "SECOND"]) { - assert.throws(RangeError, () => time.toString({ smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "hour", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "hours", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => time.toString({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/until/largestunit-invalid-string.js index 7fcf10a557..ff95f0e783 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0); const later = new Temporal.PlainTime(13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainTime/prototype/until/smallestunit-invalid-string.js index 7225494a21..62ca4957d2 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainTime/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,28 @@ features: [Temporal] const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0); const later = new Temporal.PlainTime(13, 35, 57, 987, 654, 321); -const values = ["era", "eraYear", "years", "months", "weeks", "days", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-invalid-string.js index 09b7687f26..00a668d252 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,34 @@ features: [Temporal] const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2001, 6); -const values = ["era", "eraYear", "weeks", "days", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "week", + "day", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-invalid-string.js index 21b0c4b698..f8e1f541a0 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,34 @@ features: [Temporal] const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2001, 6); -const values = ["era", "eraYear", "weeks", "days", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "week", + "day", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-invalid-string.js index bb243a8991..e3055ec8c4 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,34 @@ features: [Temporal] const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2001, 6); -const values = ["era", "eraYear", "weeks", "days", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "week", + "day", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-invalid-string.js index 9e49430507..07095eaf3f 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,34 @@ features: [Temporal] const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2001, 6); -const values = ["era", "eraYear", "weeks", "days", "hours", "minutes", "seconds", "milliseconds", "microseconds", "nanoseconds", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "week", + "day", + "hour", + "minute", + "second", + "millisecond", + "microsecond", + "nanosecond", + "month\0", + "YEAR", + "eras", + "eraYears", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + "months\0", + "YEARS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-invalid-string.js index bee6892ba9..cf8831a975 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-invalid-string.js @@ -8,4 +8,26 @@ features: [Temporal] ---*/ const datetime = new Temporal.ZonedDateTime(1_000_000_000_123_987_500n, "UTC"); -assert.throws(RangeError, () => datetime.round({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => datetime.round({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-invalid-string.js index 61dd7f3ad3..9e96e8a496 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const later = new Temporal.ZonedDateTime(1_000_090_061_987_654_321n, "UTC"); -const values = ["era", "eraYear", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-invalid-string.js index 5735fba65e..a116e24074 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const later = new Temporal.ZonedDateTime(1_000_090_061_987_654_321n, "UTC"); -const values = ["era", "eraYear", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => later.since(earlier, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => later.since(earlier, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js index d394046481..1ba9732789 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js @@ -8,4 +8,30 @@ features: [Temporal] ---*/ const datetime = new Temporal.ZonedDateTime(1_000_000_000_123_987_500n, "UTC"); -assert.throws(RangeError, () => datetime.toString({ smallestUnit: "other string" })); +const badValues = [ + "era", + "eraYear", + "year", + "month", + "week", + "day", + "hour", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "years", + "months", + "weeks", + "days", + "hours", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => datetime.toString({ smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); +} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-invalid-string.js index a59c2f2e43..2be916f177 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const later = new Temporal.ZonedDateTime(1_000_090_061_987_654_321n, "UTC"); -const values = ["era", "eraYear", "other string"]; -for (const largestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { largestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string" +]; +for (const largestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { largestUnit }), + `"${largestUnit}" is not a valid value for largestUnit`); } diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-invalid-string.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-invalid-string.js index 42f55bc850..4f09f10f68 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-invalid-string.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-invalid-string.js @@ -9,7 +9,20 @@ features: [Temporal] const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); const later = new Temporal.ZonedDateTime(1_000_090_061_987_654_321n, "UTC"); -const values = ["era", "eraYear", "other string"]; -for (const smallestUnit of values) { - assert.throws(RangeError, () => earlier.until(later, { smallestUnit })); +const badValues = [ + "era", + "eraYear", + "millisecond\0", + "mill\u0131second", + "SECOND", + "eras", + "eraYears", + "milliseconds\0", + "mill\u0131seconds", + "SECONDS", + "other string", +]; +for (const smallestUnit of badValues) { + assert.throws(RangeError, () => earlier.until(later, { smallestUnit }), + `"${smallestUnit}" is not a valid value for smallest unit`); }