mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 04:54:44 +02:00
Temporal Issue 2532 (#3858)
* Add tests for the new PrepareTemporalFields behavior for all direct callers See https://github.com/tc39/proposal-temporal/pull/2570 * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDate * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDateTime * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalZonedDateTime * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalYearMonth * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalMonthDay * Add tests for the new PrepareTemporalFields behavior for indirect callers through ToRelativeTemporalObject * Add tests for the new PrepareTemporalFields behavior for indirect callers through AddDurationToOrSubtractDurationFromPlainYearMonth
This commit is contained in:
parent
7ef1833109
commit
016e4bf8e8
@ -1360,6 +1360,25 @@ var TemporalHelpers = {
|
||||
return new CalendarMergeFieldsPrimitive(primitive);
|
||||
},
|
||||
|
||||
/*
|
||||
* A custom calendar whose fields() method returns the same value as the
|
||||
* iso8601 calendar, with the addition of extraFields provided as parameter.
|
||||
*/
|
||||
calendarWithExtraFields(fields) {
|
||||
class CalendarWithExtraFields extends Temporal.Calendar {
|
||||
constructor(extraFields) {
|
||||
super("iso8601");
|
||||
this._extraFields = extraFields;
|
||||
}
|
||||
|
||||
fields(fieldNames) {
|
||||
return super.fields(fieldNames).concat(this._extraFields);
|
||||
}
|
||||
}
|
||||
|
||||
return new CalendarWithExtraFields(fields);
|
||||
},
|
||||
|
||||
/*
|
||||
* crossDateLineTimeZone():
|
||||
*
|
||||
|
14
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateAdd(arg, new Temporal.Duration()));
|
16
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateAdd(arg, new Temporal.Duration()));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateAdd(arg, new Temporal.Duration()));
|
14
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)));
|
17
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-duplicate-calendar-fields.js
vendored
Normal file
17
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)));
|
||||
assert.throws(RangeError, () => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)));
|
14
test/built-ins/Temporal/Calendar/prototype/day/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/day/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.day(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/day/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/day/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.day(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/day/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/day/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.day(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfWeek(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfWeek(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfWeek(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfYear(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfYear(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.dayOfYear(arg));
|
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInMonth(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInMonth(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInMonth(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInWeek(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInWeek(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInWeek(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInYear(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInYear(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.daysInYear(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.inLeapYear(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.inLeapYear(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.inLeapYear(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/month/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/month/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.month(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/month/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/month/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.month(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/month/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/month/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.month(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthCode(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthCode(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthCode(arg));
|
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthsInYear(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthsInYear(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.monthsInYear(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.weekOfYear(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.weekOfYear(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.weekOfYear(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/year/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/year/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.year(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/year/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/year/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.year(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/year/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/year/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.year(arg));
|
14
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.yearOfWeek(arg));
|
16
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.yearOfWeek(arg));
|
||||
}
|
14
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Calendar/prototype/yearOfWeek/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(RangeError, () => instance.yearOfWeek(arg));
|
@ -0,0 +1,15 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const duration1 = new Temporal.Duration(1);
|
||||
const duration2 = new Temporal.Duration(0, 12);
|
||||
|
||||
assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, {relativeTo: relativeTo}));
|
@ -0,0 +1,18 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const duration1 = new Temporal.Duration(1);
|
||||
const duration2 = new Temporal.Duration(0, 12);
|
||||
|
||||
assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, {relativeTo: relativeTo}));
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const duration1 = new Temporal.Duration(1);
|
||||
const duration2 = new Temporal.Duration(0, 12);
|
||||
|
||||
assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, {relativeTo: relativeTo}));
|
14
test/built-ins/Temporal/Duration/prototype/add/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/add/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }));
|
16
test/built-ins/Temporal/Duration/prototype/add/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Duration/prototype/add/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }));
|
||||
}
|
14
test/built-ins/Temporal/Duration/prototype/add/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/add/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.add(new Temporal.Duration(0, 0, 0, 0, -24), { relativeTo }));
|
14
test/built-ins/Temporal/Duration/prototype/round/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/round/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }));
|
16
test/built-ins/Temporal/Duration/prototype/round/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Duration/prototype/round/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }));
|
||||
}
|
14
test/built-ins/Temporal/Duration/prototype/round/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/round/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }));
|
14
test/built-ins/Temporal/Duration/prototype/subtract/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/subtract/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }));
|
16
test/built-ins/Temporal/Duration/prototype/subtract/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Duration/prototype/subtract/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }));
|
||||
}
|
14
test/built-ins/Temporal/Duration/prototype/subtract/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/subtract/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 1);
|
||||
|
||||
assert.throws(RangeError, () => instance.subtract(new Temporal.Duration(0, 0, 0, 0, 24), { relativeTo }));
|
14
test/built-ins/Temporal/Duration/prototype/total/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/total/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }));
|
16
test/built-ins/Temporal/Duration/prototype/total/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/Duration/prototype/total/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }));
|
||||
}
|
14
test/built-ins/Temporal/Duration/prototype/total/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/Duration/prototype/total/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const relativeTo = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar, timeZone: 'Europe/Paris' };
|
||||
const instance = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||
|
||||
assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }));
|
@ -0,0 +1,13 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)));
|
@ -0,0 +1,16 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)));
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg));
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)));
|
@ -0,0 +1,13 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.from(arg));
|
@ -0,0 +1,15 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.from(arg));
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDate.from(arg));
|
14
test/built-ins/Temporal/PlainDate/prototype/equals/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/equals/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
16
test/built-ins/Temporal/PlainDate/prototype/equals/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/PlainDate/prototype/equals/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
||||
}
|
14
test/built-ins/Temporal/PlainDate/prototype/equals/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/equals/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
14
test/built-ins/Temporal/PlainDate/prototype/since/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/since/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
16
test/built-ins/Temporal/PlainDate/prototype/since/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/PlainDate/prototype/since/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
||||
}
|
14
test/built-ins/Temporal/PlainDate/prototype/since/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/since/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
13
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/constructor-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainMonthDay());
|
15
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/duplicate-calendar-fields.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['day']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainMonthDay());
|
||||
}
|
13
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/proto-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainMonthDay());
|
13
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/constructor-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainYearMonth());
|
15
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/duplicate-calendar-fields.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainYearMonth());
|
||||
}
|
13
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/proto-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.toPlainYearMonth());
|
14
test/built-ins/Temporal/PlainDate/prototype/until/argument-constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/until/argument-constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.until(arg));
|
16
test/built-ins/Temporal/PlainDate/prototype/until/argument-duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/PlainDate/prototype/until/argument-duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.until(arg));
|
||||
}
|
14
test/built-ins/Temporal/PlainDate/prototype/until/argument-proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDate/prototype/until/argument-proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(RangeError, () => instance.until(arg));
|
13
test/built-ins/Temporal/PlainDate/prototype/with/constructor-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/with/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.with({day: 15}));
|
15
test/built-ins/Temporal/PlainDate/prototype/with/duplicate-calendar-fields.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDate/prototype/with/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['day'], ['month'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.with({day: 15}));
|
||||
}
|
13
test/built-ins/Temporal/PlainDate/prototype/with/proto-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDate/prototype/with/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const date = new Temporal.PlainDate(2023, 5, 1, calendar);
|
||||
|
||||
assert.throws(RangeError, () => date.with({day: 15}));
|
@ -0,0 +1,14 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)));
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg));
|
@ -0,0 +1,17 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['hour'], ['microsecond'], ['millisecond'], ['minute'], ['month'], ['monthCode'], ['nanosecond'], ['second'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)));
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg));
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
// 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.compare
|
||||
description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)));
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg));
|
@ -0,0 +1,13 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.from(arg));
|
@ -0,0 +1,16 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['hour'], ['microsecond'], ['millisecond'], ['minute'], ['month'], ['monthCode'], ['nanosecond'], ['second'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.from(arg));
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// 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.from
|
||||
description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
|
||||
assert.throws(RangeError, () => Temporal.PlainDateTime.from(arg));
|
14
test/built-ins/Temporal/PlainDateTime/prototype/equals/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDateTime/prototype/equals/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
16
test/built-ins/Temporal/PlainDateTime/prototype/equals/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/PlainDateTime/prototype/equals/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['hour'], ['microsecond'], ['millisecond'], ['minute'], ['month'], ['monthCode'], ['nanosecond'], ['second'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
||||
}
|
14
test/built-ins/Temporal/PlainDateTime/prototype/equals/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDateTime/prototype/equals/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.equals(arg));
|
14
test/built-ins/Temporal/PlainDateTime/prototype/since/constructor-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDateTime/prototype/since/constructor-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
16
test/built-ins/Temporal/PlainDateTime/prototype/since/duplicate-calendar-fields.js
vendored
Normal file
16
test/built-ins/Temporal/PlainDateTime/prototype/since/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['day'], ['hour'], ['microsecond'], ['millisecond'], ['minute'], ['month'], ['monthCode'], ['nanosecond'], ['second'], ['year']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
||||
}
|
14
test/built-ins/Temporal/PlainDateTime/prototype/since/proto-in-calendar-fields.js
vendored
Normal file
14
test/built-ins/Temporal/PlainDateTime/prototype/since/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const arg = {year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar};
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(RangeError, () => instance.since(arg));
|
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']);
|
||||
const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar);
|
||||
|
||||
assert.throws(RangeError, () => datetime.toPlainMonthDay());
|
15
test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js
vendored
Normal file
15
test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// 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: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['day']]) {
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
|
||||
const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar);
|
||||
|
||||
assert.throws(RangeError, () => datetime.toPlainMonthDay());
|
||||
}
|
13
test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js
vendored
Normal file
13
test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// 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: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']);
|
||||
const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar);
|
||||
|
||||
assert.throws(RangeError, () => datetime.toPlainMonthDay());
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user