diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/branding.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/branding.js index 29972471fed..86a9fb592fd 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/branding.js @@ -11,12 +11,14 @@ const dateAdd = Temporal.Calendar.prototype.dateAdd; assert.sameValue(typeof dateAdd, "function"); -assert.throws(TypeError, () => dateAdd.call(undefined), "undefined"); -assert.throws(TypeError, () => dateAdd.call(null), "null"); -assert.throws(TypeError, () => dateAdd.call(true), "true"); -assert.throws(TypeError, () => dateAdd.call(""), "empty string"); -assert.throws(TypeError, () => dateAdd.call(Symbol()), "symbol"); -assert.throws(TypeError, () => dateAdd.call(1), "1"); -assert.throws(TypeError, () => dateAdd.call({}), "plain object"); -assert.throws(TypeError, () => dateAdd.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => dateAdd.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1), new Temporal.Duration(1)]; + +assert.throws(TypeError, () => dateAdd.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => dateAdd.apply(null, args), "null"); +assert.throws(TypeError, () => dateAdd.apply(true, args), "true"); +assert.throws(TypeError, () => dateAdd.apply("", args), "empty string"); +assert.throws(TypeError, () => dateAdd.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => dateAdd.apply(1, args), "1"); +assert.throws(TypeError, () => dateAdd.apply({}, args), "plain object"); +assert.throws(TypeError, () => dateAdd.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => dateAdd.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-RequireInternalSlot.js deleted file mode 100644 index d136a12e776..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-RequireInternalSlot.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.dateadd -description: Temporal.Calendar.prototype.dateAdd should throw if calendar does not have required internal slot -info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { dateAdd: cal.dateAdd }; -assert.throws(TypeError, - () => badCal.dateAdd("2020-02-29", new Temporal.Duration(1)), - 'badCal.dateAdd("2020-02-29", new Temporal.Duration(1)) throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/branding.js b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/branding.js index bd5250194a4..c9aba85a099 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/branding.js @@ -11,12 +11,14 @@ const dateFromFields = Temporal.Calendar.prototype.dateFromFields; assert.sameValue(typeof dateFromFields, "function"); -assert.throws(TypeError, () => dateFromFields.call(undefined), "undefined"); -assert.throws(TypeError, () => dateFromFields.call(null), "null"); -assert.throws(TypeError, () => dateFromFields.call(true), "true"); -assert.throws(TypeError, () => dateFromFields.call(""), "empty string"); -assert.throws(TypeError, () => dateFromFields.call(Symbol()), "symbol"); -assert.throws(TypeError, () => dateFromFields.call(1), "1"); -assert.throws(TypeError, () => dateFromFields.call({}), "plain object"); -assert.throws(TypeError, () => dateFromFields.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => dateFromFields.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [{ year: 2000, month: 1, day: 1 }]; + +assert.throws(TypeError, () => dateFromFields.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => dateFromFields.apply(null, args), "null"); +assert.throws(TypeError, () => dateFromFields.apply(true, args), "true"); +assert.throws(TypeError, () => dateFromFields.apply("", args), "empty string"); +assert.throws(TypeError, () => dateFromFields.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => dateFromFields.apply(1, args), "1"); +assert.throws(TypeError, () => dateFromFields.apply({}, args), "plain object"); +assert.throws(TypeError, () => dateFromFields.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => dateFromFields.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/throw-type-error-from-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dateFromFields/throw-type-error-from-RequireInternalSlot.js deleted file mode 100644 index deeb41d5eb9..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/dateFromFields/throw-type-error-from-RequireInternalSlot.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.datefromfields -description: Temporal.Calendar.prototype.dateFromFields should throw TypeError while calendar has no [[InitializedTemporalCalendar]] -info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601") -let badCal = {dateFromFields: cal.dateFromFields}; - -assert.throws(TypeError, () => badCal.dateFromFields({}), - 'badCal.dateFromFields({}) throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/branding.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/branding.js index b6da8916a39..992cc02b9c2 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dateUntil/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/branding.js @@ -11,12 +11,14 @@ const dateUntil = Temporal.Calendar.prototype.dateUntil; assert.sameValue(typeof dateUntil, "function"); -assert.throws(TypeError, () => dateUntil.call(undefined), "undefined"); -assert.throws(TypeError, () => dateUntil.call(null), "null"); -assert.throws(TypeError, () => dateUntil.call(true), "true"); -assert.throws(TypeError, () => dateUntil.call(""), "empty string"); -assert.throws(TypeError, () => dateUntil.call(Symbol()), "symbol"); -assert.throws(TypeError, () => dateUntil.call(1), "1"); -assert.throws(TypeError, () => dateUntil.call({}), "plain object"); -assert.throws(TypeError, () => dateUntil.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => dateUntil.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2021, 7, 16), new Temporal.PlainDate(2021, 7, 17)]; + +assert.throws(TypeError, () => dateUntil.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => dateUntil.apply(null, args), "null"); +assert.throws(TypeError, () => dateUntil.apply(true, args), "true"); +assert.throws(TypeError, () => dateUntil.apply("", args), "empty string"); +assert.throws(TypeError, () => dateUntil.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => dateUntil.apply(1, args), "1"); +assert.throws(TypeError, () => dateUntil.apply({}, args), "plain object"); +assert.throws(TypeError, () => dateUntil.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => dateUntil.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/throws-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/throws-type-error-RequireInternalSlot.js deleted file mode 100644 index 11cec1895ac..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/dateUntil/throws-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.dateuntil -description: Temporal.Calendar.prototype.dateUntil throw TypeError on RequireInternalSlot -info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); -let badCal = { dateUntil: cal.dateUntil }; - -assert.throws(TypeError, () => badCal.dateUntil("2021-07-16", "2021-07-17"), - 'badCal.dateUntil("2021-07-16", "2021-07-17") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/branding.js b/test/built-ins/Temporal/Calendar/prototype/day/branding.js index eafea5fcfe8..775ecf6fd1b 100644 --- a/test/built-ins/Temporal/Calendar/prototype/day/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/day/branding.js @@ -11,12 +11,14 @@ const day = Temporal.Calendar.prototype.day; assert.sameValue(typeof day, "function"); -assert.throws(TypeError, () => day.call(undefined), "undefined"); -assert.throws(TypeError, () => day.call(null), "null"); -assert.throws(TypeError, () => day.call(true), "true"); -assert.throws(TypeError, () => day.call(""), "empty string"); -assert.throws(TypeError, () => day.call(Symbol()), "symbol"); -assert.throws(TypeError, () => day.call(1), "1"); -assert.throws(TypeError, () => day.call({}), "plain object"); -assert.throws(TypeError, () => day.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => day.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => day.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => day.apply(null, args), "null"); +assert.throws(TypeError, () => day.apply(true, args), "true"); +assert.throws(TypeError, () => day.apply("", args), "empty string"); +assert.throws(TypeError, () => day.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => day.apply(1, args), "1"); +assert.throws(TypeError, () => day.apply({}, args), "plain object"); +assert.throws(TypeError, () => day.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => day.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/day/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/day/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 6e20d92532a..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/day/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.day -description: Temporal.Calendar.prototype.day throws TypeError on RequireInternalSlot if object has no internal slot. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { day: cal.day } -assert.throws(TypeError, () => badCal.day("2021-03-04"), - 'badCal.day("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js index bbcfc7fb25d..daf44df8342 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js @@ -11,12 +11,14 @@ const dayOfWeek = Temporal.Calendar.prototype.dayOfWeek; assert.sameValue(typeof dayOfWeek, "function"); -assert.throws(TypeError, () => dayOfWeek.call(undefined), "undefined"); -assert.throws(TypeError, () => dayOfWeek.call(null), "null"); -assert.throws(TypeError, () => dayOfWeek.call(true), "true"); -assert.throws(TypeError, () => dayOfWeek.call(""), "empty string"); -assert.throws(TypeError, () => dayOfWeek.call(Symbol()), "symbol"); -assert.throws(TypeError, () => dayOfWeek.call(1), "1"); -assert.throws(TypeError, () => dayOfWeek.call({}), "plain object"); -assert.throws(TypeError, () => dayOfWeek.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => dayOfWeek.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => dayOfWeek.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => dayOfWeek.apply(null, args), "null"); +assert.throws(TypeError, () => dayOfWeek.apply(true, args), "true"); +assert.throws(TypeError, () => dayOfWeek.apply("", args), "empty string"); +assert.throws(TypeError, () => dayOfWeek.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => dayOfWeek.apply(1, args), "1"); +assert.throws(TypeError, () => dayOfWeek.apply({}, args), "plain object"); +assert.throws(TypeError, () => dayOfWeek.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => dayOfWeek.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 4789506a234..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.dayOfWeek -description: > - Temporal.Calendar.prototype.dayOfWeek throws TypeError - when the internal lot is not presented. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { dayOfWeek: cal.dayOfWeek } -assert.throws(TypeError, () => badCal.dayOfWeek("2021-03-04"), - 'badCal.dayOfWeek("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js index b60323ae658..93ccd917845 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js @@ -11,12 +11,14 @@ const dayOfYear = Temporal.Calendar.prototype.dayOfYear; assert.sameValue(typeof dayOfYear, "function"); -assert.throws(TypeError, () => dayOfYear.call(undefined), "undefined"); -assert.throws(TypeError, () => dayOfYear.call(null), "null"); -assert.throws(TypeError, () => dayOfYear.call(true), "true"); -assert.throws(TypeError, () => dayOfYear.call(""), "empty string"); -assert.throws(TypeError, () => dayOfYear.call(Symbol()), "symbol"); -assert.throws(TypeError, () => dayOfYear.call(1), "1"); -assert.throws(TypeError, () => dayOfYear.call({}), "plain object"); -assert.throws(TypeError, () => dayOfYear.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => dayOfYear.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => dayOfYear.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => dayOfYear.apply(null, args), "null"); +assert.throws(TypeError, () => dayOfYear.apply(true, args), "true"); +assert.throws(TypeError, () => dayOfYear.apply("", args), "empty string"); +assert.throws(TypeError, () => dayOfYear.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => dayOfYear.apply(1, args), "1"); +assert.throws(TypeError, () => dayOfYear.apply({}, args), "plain object"); +assert.throws(TypeError, () => dayOfYear.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => dayOfYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 5a20fc24550..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.dayOfYear -description: > - Temporal.Calendar.prototype.dayOfYear throws TypeError - when the internal lot is not presented. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { dayOfYear: cal.dayOfYear } -assert.throws(TypeError, () => badCal.dayOfYear("2021-03-04"), - 'badCal.dayOfYear("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js index 84f76e7aaa5..167035dcad4 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js @@ -11,12 +11,14 @@ const daysInMonth = Temporal.Calendar.prototype.daysInMonth; assert.sameValue(typeof daysInMonth, "function"); -assert.throws(TypeError, () => daysInMonth.call(undefined), "undefined"); -assert.throws(TypeError, () => daysInMonth.call(null), "null"); -assert.throws(TypeError, () => daysInMonth.call(true), "true"); -assert.throws(TypeError, () => daysInMonth.call(""), "empty string"); -assert.throws(TypeError, () => daysInMonth.call(Symbol()), "symbol"); -assert.throws(TypeError, () => daysInMonth.call(1), "1"); -assert.throws(TypeError, () => daysInMonth.call({}), "plain object"); -assert.throws(TypeError, () => daysInMonth.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => daysInMonth.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => daysInMonth.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => daysInMonth.apply(null, args), "null"); +assert.throws(TypeError, () => daysInMonth.apply(true, args), "true"); +assert.throws(TypeError, () => daysInMonth.apply("", args), "empty string"); +assert.throws(TypeError, () => daysInMonth.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => daysInMonth.apply(1, args), "1"); +assert.throws(TypeError, () => daysInMonth.apply({}, args), "plain object"); +assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 687183a66b5..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.daysInMonth -description: > - Temporal.Calendar.prototype.daysInMonth throws TypeError - when the internal lot is not presented. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { daysInMonth: cal.daysInMonth } -assert.throws(TypeError, () => badCal.daysInMonth("2021-03-04"), - 'badCal.daysInMonth("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js index 1d1c859bb5a..cb0da2bd22a 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js @@ -11,12 +11,14 @@ const daysInWeek = Temporal.Calendar.prototype.daysInWeek; assert.sameValue(typeof daysInWeek, "function"); -assert.throws(TypeError, () => daysInWeek.call(undefined), "undefined"); -assert.throws(TypeError, () => daysInWeek.call(null), "null"); -assert.throws(TypeError, () => daysInWeek.call(true), "true"); -assert.throws(TypeError, () => daysInWeek.call(""), "empty string"); -assert.throws(TypeError, () => daysInWeek.call(Symbol()), "symbol"); -assert.throws(TypeError, () => daysInWeek.call(1), "1"); -assert.throws(TypeError, () => daysInWeek.call({}), "plain object"); -assert.throws(TypeError, () => daysInWeek.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => daysInWeek.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => daysInWeek.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => daysInWeek.apply(null, args), "null"); +assert.throws(TypeError, () => daysInWeek.apply(true, args), "true"); +assert.throws(TypeError, () => daysInWeek.apply("", args), "empty string"); +assert.throws(TypeError, () => daysInWeek.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => daysInWeek.apply(1, args), "1"); +assert.throws(TypeError, () => daysInWeek.apply({}, args), "plain object"); +assert.throws(TypeError, () => daysInWeek.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => daysInWeek.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 13809d09128..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.daysInWeek -description: > - Temporal.Calendar.prototype.daysInWeek throws TypeError - when the internal lot is not presented. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { daysInWeek: cal.daysInWeek } -assert.throws(TypeError, () => badCal.daysInWeek("2021-03-04"), - 'badCal.daysInWeek("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/branding.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/branding.js index e7bf10dbf64..24a8b829b4d 100644 --- a/test/built-ins/Temporal/Calendar/prototype/daysInYear/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/branding.js @@ -11,12 +11,14 @@ const daysInYear = Temporal.Calendar.prototype.daysInYear; assert.sameValue(typeof daysInYear, "function"); -assert.throws(TypeError, () => daysInYear.call(undefined), "undefined"); -assert.throws(TypeError, () => daysInYear.call(null), "null"); -assert.throws(TypeError, () => daysInYear.call(true), "true"); -assert.throws(TypeError, () => daysInYear.call(""), "empty string"); -assert.throws(TypeError, () => daysInYear.call(Symbol()), "symbol"); -assert.throws(TypeError, () => daysInYear.call(1), "1"); -assert.throws(TypeError, () => daysInYear.call({}), "plain object"); -assert.throws(TypeError, () => daysInYear.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => daysInYear.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => daysInYear.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => daysInYear.apply(null, args), "null"); +assert.throws(TypeError, () => daysInYear.apply(true, args), "true"); +assert.throws(TypeError, () => daysInYear.apply("", args), "empty string"); +assert.throws(TypeError, () => daysInYear.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => daysInYear.apply(1, args), "1"); +assert.throws(TypeError, () => daysInYear.apply({}, args), "plain object"); +assert.throws(TypeError, () => daysInYear.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => daysInYear.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 0a474d52f54..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/daysInYear/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.calendar.prototype.daysInYear -description: > - Temporal.Calendar.prototype.daysInYear throws TypeError - when the internal lot is not presented. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { daysInYear: cal.daysInYear } -assert.throws(TypeError, () => badCal.daysInYear("2021-03-04"), - 'badCal.daysInYear("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/branding.js b/test/built-ins/Temporal/Calendar/prototype/month/branding.js index 612b047b14b..4df376111fe 100644 --- a/test/built-ins/Temporal/Calendar/prototype/month/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/month/branding.js @@ -11,12 +11,14 @@ const month = Temporal.Calendar.prototype.month; assert.sameValue(typeof month, "function"); -assert.throws(TypeError, () => month.call(undefined), "undefined"); -assert.throws(TypeError, () => month.call(null), "null"); -assert.throws(TypeError, () => month.call(true), "true"); -assert.throws(TypeError, () => month.call(""), "empty string"); -assert.throws(TypeError, () => month.call(Symbol()), "symbol"); -assert.throws(TypeError, () => month.call(1), "1"); -assert.throws(TypeError, () => month.call({}), "plain object"); -assert.throws(TypeError, () => month.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => month.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => month.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => month.apply(null, args), "null"); +assert.throws(TypeError, () => month.apply(true, args), "true"); +assert.throws(TypeError, () => month.apply("", args), "empty string"); +assert.throws(TypeError, () => month.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => month.apply(1, args), "1"); +assert.throws(TypeError, () => month.apply({}, args), "plain object"); +assert.throws(TypeError, () => month.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => month.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/month/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/month/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 3cc23ad3d3f..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/month/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.month -description: Temporal.Calendar.prototype.month throws TypeError on RequireInternalSlot if object has no internal slot. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { month: cal.month } -assert.throws(TypeError, () => badCal.month("2021-03-04"), - 'badCal.month("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/branding.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/branding.js index 210291345da..cce6b714ca6 100644 --- a/test/built-ins/Temporal/Calendar/prototype/monthCode/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/branding.js @@ -11,12 +11,14 @@ const monthCode = Temporal.Calendar.prototype.monthCode; assert.sameValue(typeof monthCode, "function"); -assert.throws(TypeError, () => monthCode.call(undefined), "undefined"); -assert.throws(TypeError, () => monthCode.call(null), "null"); -assert.throws(TypeError, () => monthCode.call(true), "true"); -assert.throws(TypeError, () => monthCode.call(""), "empty string"); -assert.throws(TypeError, () => monthCode.call(Symbol()), "symbol"); -assert.throws(TypeError, () => monthCode.call(1), "1"); -assert.throws(TypeError, () => monthCode.call({}), "plain object"); -assert.throws(TypeError, () => monthCode.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => monthCode.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => monthCode.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => monthCode.apply(null, args), "null"); +assert.throws(TypeError, () => monthCode.apply(true, args), "true"); +assert.throws(TypeError, () => monthCode.apply("", args), "empty string"); +assert.throws(TypeError, () => monthCode.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => monthCode.apply(1, args), "1"); +assert.throws(TypeError, () => monthCode.apply({}, args), "plain object"); +assert.throws(TypeError, () => monthCode.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => monthCode.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index 8fdfbe2114b..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/monthCode/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.monthCode -description: Temporal.Calendar.prototype.monthCode throws TypeError on RequireInternalSlot if object has no internal slot. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { monthCode: cal.monthCode} -assert.throws(TypeError, () => badCal.monthCode("2021-03-04"), - 'badCal.monthCode("2021-03-04") throws a TypeError exception'); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/branding.js b/test/built-ins/Temporal/Calendar/prototype/year/branding.js index 17e9b710edb..6515d67d5a7 100644 --- a/test/built-ins/Temporal/Calendar/prototype/year/branding.js +++ b/test/built-ins/Temporal/Calendar/prototype/year/branding.js @@ -11,12 +11,14 @@ const year = Temporal.Calendar.prototype.year; assert.sameValue(typeof year, "function"); -assert.throws(TypeError, () => year.call(undefined), "undefined"); -assert.throws(TypeError, () => year.call(null), "null"); -assert.throws(TypeError, () => year.call(true), "true"); -assert.throws(TypeError, () => year.call(""), "empty string"); -assert.throws(TypeError, () => year.call(Symbol()), "symbol"); -assert.throws(TypeError, () => year.call(1), "1"); -assert.throws(TypeError, () => year.call({}), "plain object"); -assert.throws(TypeError, () => year.call(Temporal.Calendar), "Temporal.Calendar"); -assert.throws(TypeError, () => year.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); +const args = [new Temporal.PlainDate(2000, 1, 1)]; + +assert.throws(TypeError, () => year.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => year.apply(null, args), "null"); +assert.throws(TypeError, () => year.apply(true, args), "true"); +assert.throws(TypeError, () => year.apply("", args), "empty string"); +assert.throws(TypeError, () => year.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => year.apply(1, args), "1"); +assert.throws(TypeError, () => year.apply({}, args), "plain object"); +assert.throws(TypeError, () => year.apply(Temporal.Calendar, args), "Temporal.Calendar"); +assert.throws(TypeError, () => year.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/year/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/year/throw-type-error-RequireInternalSlot.js deleted file mode 100644 index cd8dd681fb8..00000000000 --- a/test/built-ins/Temporal/Calendar/prototype/year/throw-type-error-RequireInternalSlot.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2021 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.calendar.prototype.year -description: > - Temporal.Calendar.prototype.year throws TypeError on - RequireInternalSlot if object has no internal slot. -info: | - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). -features: [Temporal, arrow-function] ----*/ -let cal = new Temporal.Calendar("iso8601"); - -let badCal = { year: cal.year } -assert.throws(TypeError, () => badCal.year("2021-03-04"), - 'badCal.year("2021-03-04") throws a TypeError exception');