diff --git a/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..5cd7c34500 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateadd +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.dateAdd(arg, new Temporal.Duration()); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..840fe7252e --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dateuntil +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)); +instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/day/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/day/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..7760bdf260 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.day +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.day(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..66dcdb5255 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.dayOfWeek(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c14286eb27 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.dayOfYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..86604156b7 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinmonth +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.daysInMonth(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..4affcad77d --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinweek +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.daysInWeek(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..853b733cfb --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.daysinyear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.daysInYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..712b350ca5 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.inleapyear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.inLeapYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/month/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/month/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..55d5db1e36 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/month/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.month +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.month(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..7dac75fde1 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthCode/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthcode +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.monthCode(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..f86fbfe1da --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.monthsinyear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.monthsInYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..545eecf635 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.weekofyear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.weekOfYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/year/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/year/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..2825650865 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/year/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.year +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.year(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..12d789751c --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.yearofweek +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.yearOfWeek(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..278e8054a6 --- /dev/null +++ b/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-builtin-calendar-no-array-iteration.js @@ -0,0 +1,23 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.compare +description: > + Calling the method with a relativeTo property bag with a builtin calendar + causes no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const relativeTo = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +const duration1 = new Temporal.Duration(0, 0, 1); +const duration2 = new Temporal.Duration(0, 0, 0, 7); +Temporal.Duration.compare(duration1, duration2, { relativeTo }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..1bcc1772e9 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.add +description: > + Calling the method with a relativeTo property bag with a builtin calendar + causes no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.Duration(1, 0, 0, 1); +const relativeTo = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..59da2e57c5 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: > + Calling the method with a relativeTo property bag with a builtin calendar + causes no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.Duration(1, 0, 0, 0, 24); +const relativeTo = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.round({ largestUnit: "years", relativeTo }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..a7020b87a0 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.subtract +description: > + Calling the method with a relativeTo property bag with a builtin calendar + causes no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.Duration(1, 0, 0, 1); +const relativeTo = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..5de36d9201 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.total +description: > + Calling the method with a relativeTo property bag with a builtin calendar + causes no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.Duration(1, 0, 0, 0, 24); +const relativeTo = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.total({ unit: "days", relativeTo }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/compare/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/compare/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c4d1fcdd40 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/compare/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.compare +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)); +Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/from/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/from/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..bac3f0a25b --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/from/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.from +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +Temporal.PlainDate.from(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/equals/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..8eb87a8709 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/equals/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.equals +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2000, 5, 2); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.equals(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/since/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..6386c38f46 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.since +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2000, 5, 2); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.since(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..6402736400 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.toplainmonthday +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2023, 5, 2, "iso8601"); +instance.toPlainMonthDay(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..0d9a3c72e6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.toplainyearmonth +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2023, 5, 2, "iso8601"); +instance.toPlainYearMonth(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/until/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..a71ec3efdc --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.until +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2000, 5, 2); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.until(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDate/prototype/with/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDate/prototype/with/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..5b10fe3d3e --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/with/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.with +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDate(2023, 5, 2, "iso8601"); +instance.with({ day: 5 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/compare/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/compare/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..dfcd0d2bd3 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/compare/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.compare +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)); +Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/from/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/from/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c1e98f5f4f --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/from/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.from +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +Temporal.PlainDateTime.from(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..f978ce07e0 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.equals +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +instance.equals(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3441f7b4ef --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +instance.since(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..45ec2afa55 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.toplainmonthday +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2023, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); +instance.toPlainMonthDay(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3d1818e043 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.toplainyearmonth +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2023, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); +instance.toPlainYearMonth(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..e0fec78cee --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +instance.until(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/with/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/with/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..880de09a03 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/with/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.with +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2023, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); +instance.with({ day: 5 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..8fe2d46828 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.withplaindate +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.withPlainDate(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainMonthDay/from/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainMonthDay/from/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..33d673966a --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/from/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.from +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { monthCode: "M11", day: 23, calendar: "iso8601" }; +Temporal.PlainMonthDay.from(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..1e62a18e6c --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.equals +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainMonthDay(5, 2); +const arg = { monthCode: "M11", day: 23, calendar: "iso8601" }; +instance.equals(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..8f758f3f34 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.toplaindate +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainMonthDay(5, 1, "iso8601"); +instance.toPlainDate({ year: 2005 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/with/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainMonthDay/prototype/with/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3745d15d85 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/with/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.with +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainMonthDay(5, 1, "iso8601"); +instance.with({ monthCode: "M04" }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..f338977a77 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.toplaindatetime +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.toPlainDateTime(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..27b29d272c --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tozoneddatetime +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/compare/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/compare/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..453c8e0d35 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/compare/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.compare +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, calendar: "iso8601" }; +Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)); +Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/from/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/from/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c2a2cbfcbb --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/from/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.from +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const arg = { year: 2000, month: 5, calendar: "iso8601" }; +Temporal.PlainYearMonth.from(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/add/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/add/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..b16d66c4ff --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/add/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.add +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.add({ years: 5, months: 2 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3808eea38d --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.equals +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2000, 5); +const arg = { year: 2000, month: 5, calendar: "iso8601" }; +instance.equals(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c29d8f1029 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2000, 5); +const arg = { year: 2000, month: 5, calendar: "iso8601" }; +instance.since(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..137692b6a5 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.since +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.since({ year: 2005, month: 3 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..122a146d01 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.subtract +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.subtract({ years: 5, months: 2 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..654196318c --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.toplaindate +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.toPlainDate({ day: 5 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..d28f97d939 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2000, 5); +const arg = { year: 2000, month: 5, calendar: "iso8601" }; +instance.until(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..2ae40e13b7 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.until +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.until({ year: 2070, month: 7 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/with/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/with/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..443c9b62ae --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/with/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.with +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.PlainYearMonth(2023, 5, "iso8601"); +instance.with({ month: 4 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..5170ae48fd --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,29 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getinstantfor +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.TimeZone("UTC"); +// Patch getPossibleInstantsFor to allow the spec-mandated observable array +// iteration in the GetPossibleInstantsFor AO. +instance.getPossibleInstantsFor = function (...args) { + const instants = Temporal.TimeZone.prototype.getPossibleInstantsFor.apply(this, args); + instants[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; + return instants; +} + +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +instance.getInstantFor(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..628f2b6b5a --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getpossibleinstantsfor +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.TimeZone("UTC"); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, calendar: "iso8601" }; +instance.getPossibleInstantsFor(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/compare/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/compare/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..c2a4f0437a --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/compare/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,23 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.compare +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const datetime = new Temporal.ZonedDateTime(0n, timeZone); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +Temporal.ZonedDateTime.compare(arg, datetime); +Temporal.ZonedDateTime.compare(datetime, arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/from/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/from/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3d275f4057 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/from/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.from +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +Temporal.ZonedDateTime.from(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..2059ed83eb --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.equals +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.ZonedDateTime(0n, timeZone); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.equals(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..ced06ddb0f --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.since +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.ZonedDateTime(0n, timeZone); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.since(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..104df08e68 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.toplainmonthday +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); +instance.toPlainMonthDay(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..e098d857ab --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); +instance.toPlainYearMonth(); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..ff93b0eec3 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,22 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.until +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const timeZone = "UTC"; +const instance = new Temporal.ZonedDateTime(0n, timeZone); +const arg = { year: 2000, month: 5, day: 2, hour: 21, minute: 43, second: 5, timeZone, calendar: "iso8601" }; +instance.until(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/with/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/with/builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..66bd9416a5 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/with/builtin-calendar-no-array-iteration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.with +description: > + Calling the method on an instance constructed with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); +instance.with({ day: 5 }); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..3df0eaf6e8 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.withplaindate +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.withPlainDate(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/intl402/Temporal/Calendar/prototype/era/argument-builtin-calendar-no-array-iteration.js b/test/intl402/Temporal/Calendar/prototype/era/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..95da8b9af2 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/era/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.era +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.era(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/intl402/Temporal/Calendar/prototype/eraYear/argument-builtin-calendar-no-array-iteration.js b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-builtin-calendar-no-array-iteration.js new file mode 100644 index 0000000000..66947a2b12 --- /dev/null +++ b/test/intl402/Temporal/Calendar/prototype/eraYear/argument-builtin-calendar-no-array-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.erayear +description: > + Calling the method with a property bag argument with a builtin calendar causes + no observable array iteration when getting the calendar fields. +features: [Temporal] +---*/ + +const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; +Array.prototype[Symbol.iterator] = function arrayIterator() { + throw new Test262Error("Array should not be iterated"); +} + +const instance = new Temporal.Calendar("iso8601"); +const arg = { year: 2000, month: 5, day: 2, calendar: "iso8601" }; +instance.eraYear(arg); + +Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal;