diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/branding.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/branding.js index 003cf490ab..4cde009d42 100644 --- a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/branding.js @@ -11,14 +11,14 @@ const inLeapYear = Temporal.Calendar.prototype.inLeapYear; assert.sameValue(typeof inLeapYear, "function"); -const arg = new Temporal.PlainDate(2021, 3, 4); +const args = [new Temporal.PlainDate(2021, 3, 4)]; -assert.throws(TypeError, () => inLeapYear.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => inLeapYear.call(null, arg), "null"); -assert.throws(TypeError, () => inLeapYear.call(true, arg), "true"); -assert.throws(TypeError, () => inLeapYear.call("", arg), "empty string"); -assert.throws(TypeError, () => inLeapYear.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => inLeapYear.call(1, arg), "1"); -assert.throws(TypeError, () => inLeapYear.call({}, arg), "plain object"); -assert.throws(TypeError, () => inLeapYear.call(Temporal.Calendar, arg), "Temporal.Calendar"); -assert.throws(TypeError, () => inLeapYear.call(Temporal.Calendar.prototype, arg), "Temporal.Calendar.prototype"); +assert.throws(TypeError, () => inLeapYear.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => inLeapYear.apply(null, args), "null"); +assert.throws(TypeError, () => inLeapYear.apply(true, args), "true"); +assert.throws(TypeError, () => inLeapYear.apply("", args), "empty string"); +assert.throws(TypeError, () => inLeapYear.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => inLeapYear.apply(1, args), "1"); +assert.throws(TypeError, () => inLeapYear.apply({}, args), "plain object"); +assert.throws(TypeError, () => inLeapYear.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => inLeapYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/branding.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/branding.js index 4d16a00078..8db1850443 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/branding.js @@ -11,14 +11,14 @@ const monthsInYear = Temporal.Calendar.prototype.monthsInYear; assert.sameValue(typeof monthsInYear, "function"); -const arg = new Temporal.PlainDate(2021, 3, 4); +const args = [new Temporal.PlainDate(2021, 3, 4)]; -assert.throws(TypeError, () => monthsInYear.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => monthsInYear.call(null, arg), "null"); -assert.throws(TypeError, () => monthsInYear.call(true, arg), "true"); -assert.throws(TypeError, () => monthsInYear.call("", arg), "empty string"); -assert.throws(TypeError, () => monthsInYear.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => monthsInYear.call(1, arg), "1"); -assert.throws(TypeError, () => monthsInYear.call({}, arg), "plain object"); -assert.throws(TypeError, () => monthsInYear.call(Temporal.Calendar, arg), "Temporal.Calendar"); -assert.throws(TypeError, () => monthsInYear.call(Temporal.Calendar.prototype, arg), "Temporal.Calendar.prototype"); +assert.throws(TypeError, () => monthsInYear.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => monthsInYear.apply(null, args), "null"); +assert.throws(TypeError, () => monthsInYear.apply(true, args), "true"); +assert.throws(TypeError, () => monthsInYear.apply("", args), "empty string"); +assert.throws(TypeError, () => monthsInYear.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => monthsInYear.apply(1, args), "1"); +assert.throws(TypeError, () => monthsInYear.apply({}, args), "plain object"); +assert.throws(TypeError, () => monthsInYear.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => monthsInYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/branding.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/branding.js index d6b5a0f0cf..dc217eaa7b 100644 --- a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/branding.js @@ -11,14 +11,14 @@ const weekOfYear = Temporal.Calendar.prototype.weekOfYear; assert.sameValue(typeof weekOfYear, "function"); -const arg = new Temporal.PlainDate(2021, 7, 20); +const args = [new Temporal.PlainDate(2021, 7, 20)]; -assert.throws(TypeError, () => weekOfYear.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => weekOfYear.call(null, arg), "null"); -assert.throws(TypeError, () => weekOfYear.call(true, arg), "true"); -assert.throws(TypeError, () => weekOfYear.call("", arg), "empty string"); -assert.throws(TypeError, () => weekOfYear.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => weekOfYear.call(1, arg), "1"); -assert.throws(TypeError, () => weekOfYear.call({}, arg), "plain object"); -assert.throws(TypeError, () => weekOfYear.call(Temporal.Calendar, arg), "Temporal.Calendar"); -assert.throws(TypeError, () => weekOfYear.call(Temporal.Calendar.prototype, arg), "Temporal.Calendar.prototype"); +assert.throws(TypeError, () => weekOfYear.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => weekOfYear.apply(null, args), "null"); +assert.throws(TypeError, () => weekOfYear.apply(true, args), "true"); +assert.throws(TypeError, () => weekOfYear.apply("", args), "empty string"); +assert.throws(TypeError, () => weekOfYear.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => weekOfYear.apply(1, args), "1"); +assert.throws(TypeError, () => weekOfYear.apply({}, args), "plain object"); +assert.throws(TypeError, () => weekOfYear.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => weekOfYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js index 7212b7f1d6..8fdd4c91bb 100644 --- a/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js @@ -11,14 +11,14 @@ const yearMonthFromFields = Temporal.Calendar.prototype.yearMonthFromFields; assert.sameValue(typeof yearMonthFromFields, "function"); -const arg = { year: 2021, month: 1 }; +const args = [{ year: 2021, month: 1 }]; -assert.throws(TypeError, () => yearMonthFromFields.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => yearMonthFromFields.call(null, arg), "null"); -assert.throws(TypeError, () => yearMonthFromFields.call(true, arg), "true"); -assert.throws(TypeError, () => yearMonthFromFields.call("", arg), "empty string"); -assert.throws(TypeError, () => yearMonthFromFields.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => yearMonthFromFields.call(1, arg), "1"); -assert.throws(TypeError, () => yearMonthFromFields.call({}, arg), "plain object"); -assert.throws(TypeError, () => yearMonthFromFields.call(Temporal.Calendar, arg), "Temporal.Calendar"); -assert.throws(TypeError, () => yearMonthFromFields.call(Temporal.Calendar.prototype, arg), "Temporal.Calendar.prototype"); +assert.throws(TypeError, () => yearMonthFromFields.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => yearMonthFromFields.apply(null, args), "null"); +assert.throws(TypeError, () => yearMonthFromFields.apply(true, args), "true"); +assert.throws(TypeError, () => yearMonthFromFields.apply("", args), "empty string"); +assert.throws(TypeError, () => yearMonthFromFields.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => yearMonthFromFields.apply(1, args), "1"); +assert.throws(TypeError, () => yearMonthFromFields.apply({}, args), "plain object"); +assert.throws(TypeError, () => yearMonthFromFields.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => yearMonthFromFields.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Duration/prototype/with/branding.js b/test/built-ins/Temporal/Duration/prototype/with/branding.js index b04b2fefd6..3df3c4f375 100644 --- a/test/built-ins/Temporal/Duration/prototype/with/branding.js +++ b/test/built-ins/Temporal/Duration/prototype/with/branding.js @@ -11,14 +11,14 @@ const with_ = Temporal.Duration.prototype.with; assert.sameValue(typeof with_, "function"); -const arg = { years: 3 }; +const args = [{ years: 3 }]; -assert.throws(TypeError, () => with_.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => with_.call(null, arg), "null"); -assert.throws(TypeError, () => with_.call(true, arg), "true"); -assert.throws(TypeError, () => with_.call("", arg), "empty string"); -assert.throws(TypeError, () => with_.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => with_.call(1, arg), "1"); -assert.throws(TypeError, () => with_.call({}, arg), "plain object"); -assert.throws(TypeError, () => with_.call(Temporal.Duration, arg), "Temporal.Duration"); -assert.throws(TypeError, () => with_.call(Temporal.Duration.prototype, arg), "Temporal.Duration.prototype"); +assert.throws(TypeError, () => with_.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => with_.apply(null, args), "null"); +assert.throws(TypeError, () => with_.apply(true, args), "true"); +assert.throws(TypeError, () => with_.apply("", args), "empty string"); +assert.throws(TypeError, () => with_.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => with_.apply(1, args), "1"); +assert.throws(TypeError, () => with_.apply({}, args), "plain object"); +assert.throws(TypeError, () => with_.apply(Temporal.Duration, args), "Temporal.Duration"); +assert.throws(TypeError, () => with_.apply(Temporal.Duration.prototype, args), "Temporal.Duration.prototype"); diff --git a/test/built-ins/Temporal/Instant/prototype/add/branding.js b/test/built-ins/Temporal/Instant/prototype/add/branding.js index cccdbf63ef..996c907c1b 100644 --- a/test/built-ins/Temporal/Instant/prototype/add/branding.js +++ b/test/built-ins/Temporal/Instant/prototype/add/branding.js @@ -11,14 +11,14 @@ const add = Temporal.Instant.prototype.add; assert.sameValue(typeof add, "function"); -const arg = new Temporal.Duration(0, 0, 0, 0, 5); +const args = [new Temporal.Duration(0, 0, 0, 0, 5)]; -assert.throws(TypeError, () => add.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => add.call(null, arg), "null"); -assert.throws(TypeError, () => add.call(true, arg), "true"); -assert.throws(TypeError, () => add.call("", arg), "empty string"); -assert.throws(TypeError, () => add.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => add.call(1, arg), "1"); -assert.throws(TypeError, () => add.call({}, arg), "plain object"); -assert.throws(TypeError, () => add.call(Temporal.Instant, arg), "Temporal.Instant"); -assert.throws(TypeError, () => add.call(Temporal.Instant.prototype, arg), "Temporal.Instant.prototype"); +assert.throws(TypeError, () => add.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => add.apply(null, args), "null"); +assert.throws(TypeError, () => add.apply(true, args), "true"); +assert.throws(TypeError, () => add.apply("", args), "empty string"); +assert.throws(TypeError, () => add.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => add.apply(1, args), "1"); +assert.throws(TypeError, () => add.apply({}, args), "plain object"); +assert.throws(TypeError, () => add.apply(Temporal.Instant, args), "Temporal.Instant"); +assert.throws(TypeError, () => add.apply(Temporal.Instant.prototype, args), "Temporal.Instant.prototype"); diff --git a/test/built-ins/Temporal/Instant/prototype/subtract/branding.js b/test/built-ins/Temporal/Instant/prototype/subtract/branding.js index a7aac12b9c..55c7e453d5 100644 --- a/test/built-ins/Temporal/Instant/prototype/subtract/branding.js +++ b/test/built-ins/Temporal/Instant/prototype/subtract/branding.js @@ -11,14 +11,14 @@ const subtract = Temporal.Instant.prototype.subtract; assert.sameValue(typeof subtract, "function"); -const arg = new Temporal.Duration(0, 0, 0, 0, 5); +const args = [new Temporal.Duration(0, 0, 0, 0, 5)]; -assert.throws(TypeError, () => subtract.call(undefined, arg), "undefined"); -assert.throws(TypeError, () => subtract.call(null, arg), "null"); -assert.throws(TypeError, () => subtract.call(true, arg), "true"); -assert.throws(TypeError, () => subtract.call("", arg), "empty string"); -assert.throws(TypeError, () => subtract.call(Symbol(), arg), "symbol"); -assert.throws(TypeError, () => subtract.call(1, arg), "1"); -assert.throws(TypeError, () => subtract.call({}, arg), "plain object"); -assert.throws(TypeError, () => subtract.call(Temporal.Instant, arg), "Temporal.Instant"); -assert.throws(TypeError, () => subtract.call(Temporal.Instant.prototype, arg), "Temporal.Instant.prototype"); +assert.throws(TypeError, () => subtract.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => subtract.apply(null, args), "null"); +assert.throws(TypeError, () => subtract.apply(true, args), "true"); +assert.throws(TypeError, () => subtract.apply("", args), "empty string"); +assert.throws(TypeError, () => subtract.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => subtract.apply(1, args), "1"); +assert.throws(TypeError, () => subtract.apply({}, args), "plain object"); +assert.throws(TypeError, () => subtract.apply(Temporal.Instant, args), "Temporal.Instant"); +assert.throws(TypeError, () => subtract.apply(Temporal.Instant.prototype, args), "Temporal.Instant.prototype"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/round/branding.js b/test/built-ins/Temporal/PlainTime/prototype/round/branding.js index c92f5647d8..58e36e852c 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/round/branding.js +++ b/test/built-ins/Temporal/PlainTime/prototype/round/branding.js @@ -11,12 +11,14 @@ const round = Temporal.PlainTime.prototype.round; assert.sameValue(typeof round, "function"); -assert.throws(TypeError, () => round.call(undefined, "hour"), "undefined"); -assert.throws(TypeError, () => round.call(null, "hour"), "null"); -assert.throws(TypeError, () => round.call(true, "hour"), "true"); -assert.throws(TypeError, () => round.call("", "hour"), "empty string"); -assert.throws(TypeError, () => round.call(Symbol(), "hour"), "symbol"); -assert.throws(TypeError, () => round.call(1, "hour"), "1"); -assert.throws(TypeError, () => round.call({}, "hour"), "plain object"); -assert.throws(TypeError, () => round.call(Temporal.PlainTime, "hour"), "Temporal.PlainTime"); -assert.throws(TypeError, () => round.call(Temporal.PlainTime.prototype, "hour"), "Temporal.PlainTime.prototype"); +const args = ["hour"]; + +assert.throws(TypeError, () => round.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => round.apply(null, args), "null"); +assert.throws(TypeError, () => round.apply(true, args), "true"); +assert.throws(TypeError, () => round.apply("", args), "empty string"); +assert.throws(TypeError, () => round.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => round.apply(1, args), "1"); +assert.throws(TypeError, () => round.apply({}, args), "plain object"); +assert.throws(TypeError, () => round.apply(Temporal.PlainTime, args), "Temporal.PlainTime"); +assert.throws(TypeError, () => round.apply(Temporal.PlainTime.prototype, args), "Temporal.PlainTime.prototype"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/branding.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/branding.js index 8abff57e43..8da0b7e0c6 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/branding.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/branding.js @@ -11,12 +11,14 @@ const toZonedDateTime = Temporal.PlainTime.prototype.toZonedDateTime; assert.sameValue(typeof toZonedDateTime, "function"); -assert.throws(TypeError, () => toZonedDateTime.call(undefined, { plainDate: "2022-05-19", timeZone: "UTC" }), "undefined"); -assert.throws(TypeError, () => toZonedDateTime.call(null, { plainDate: "2022-05-19", timeZone: "UTC" }), "null"); -assert.throws(TypeError, () => toZonedDateTime.call(true, { plainDate: "2022-05-19", timeZone: "UTC" }), "true"); -assert.throws(TypeError, () => toZonedDateTime.call("", { plainDate: "2022-05-19", timeZone: "UTC" }), "empty string"); -assert.throws(TypeError, () => toZonedDateTime.call(Symbol(), { plainDate: "2022-05-19", timeZone: "UTC" }), "symbol"); -assert.throws(TypeError, () => toZonedDateTime.call(1, { plainDate: "2022-05-19", timeZone: "UTC" }), "1"); -assert.throws(TypeError, () => toZonedDateTime.call({}, { plainDate: "2022-05-19", timeZone: "UTC" }), "plain object"); -assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime, { plainDate: "2022-05-19", timeZone: "UTC" }), "Temporal.PlainTime"); -assert.throws(TypeError, () => toZonedDateTime.call(Temporal.PlainTime.prototype, { plainDate: "2022-05-19", timeZone: "UTC" }), "Temporal.PlainTime.prototype"); +const args = [{ plainDate: "2022-05-19", timeZone: "UTC" }]; + +assert.throws(TypeError, () => toZonedDateTime.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => toZonedDateTime.apply(null, args), "null"); +assert.throws(TypeError, () => toZonedDateTime.apply(true, args), "true"); +assert.throws(TypeError, () => toZonedDateTime.apply("", args), "empty string"); +assert.throws(TypeError, () => toZonedDateTime.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => toZonedDateTime.apply(1, args), "1"); +assert.throws(TypeError, () => toZonedDateTime.apply({}, args), "plain object"); +assert.throws(TypeError, () => toZonedDateTime.apply(Temporal.PlainTime, args), "Temporal.PlainTime"); +assert.throws(TypeError, () => toZonedDateTime.apply(Temporal.PlainTime.prototype, args), "Temporal.PlainTime.prototype"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/with/branding.js b/test/built-ins/Temporal/PlainTime/prototype/with/branding.js index becff7918b..c60d544d76 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/with/branding.js +++ b/test/built-ins/Temporal/PlainTime/prototype/with/branding.js @@ -11,12 +11,14 @@ const with_ = Temporal.PlainTime.prototype.with; assert.sameValue(typeof with_, "function"); -assert.throws(TypeError, () => with_.call(undefined, { hour: 7 }), "undefined"); -assert.throws(TypeError, () => with_.call(null, { hour: 7 }), "null"); -assert.throws(TypeError, () => with_.call(true, { hour: 7 }), "true"); -assert.throws(TypeError, () => with_.call("", { hour: 7 }), "empty string"); -assert.throws(TypeError, () => with_.call(Symbol(), { hour: 7 }), "symbol"); -assert.throws(TypeError, () => with_.call(1, { hour: 7 }), "1"); -assert.throws(TypeError, () => with_.call({}, { hour: 7 }), "plain object"); -assert.throws(TypeError, () => with_.call(Temporal.PlainTime, { hour: 7 }), "Temporal.PlainTime"); -assert.throws(TypeError, () => with_.call(Temporal.PlainTime.prototype, { hour: 7 }), "Temporal.PlainTime.prototype"); +const args = [{ hour: 7 }]; + +assert.throws(TypeError, () => with_.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => with_.apply(null, args), "null"); +assert.throws(TypeError, () => with_.apply(true, args), "true"); +assert.throws(TypeError, () => with_.apply("", args), "empty string"); +assert.throws(TypeError, () => with_.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => with_.apply(1, args), "1"); +assert.throws(TypeError, () => with_.apply({}, args), "plain object"); +assert.throws(TypeError, () => with_.apply(Temporal.PlainTime, args), "Temporal.PlainTime"); +assert.throws(TypeError, () => with_.apply(Temporal.PlainTime.prototype, args), "Temporal.PlainTime.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js index 9027fd129c..55dce1041c 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js @@ -9,7 +9,9 @@ features: [Symbol, Temporal] const getPlainDateTimeFor = Temporal.TimeZone.prototype.getPlainDateTimeFor; - const args = [new Temporal.Instant(0n)]; +assert.sameValue(typeof getPlainDateTimeFor, "function"); + +const args = [new Temporal.Instant(0n)]; assert.throws(TypeError, () => getPlainDateTimeFor.apply(undefined, args), "undefined"); assert.throws(TypeError, () => getPlainDateTimeFor.apply(null, args), "null");