-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for the new PrepareTemporalFields behavior for all direct callers See tc39/proposal-temporal#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
- Loading branch information
Showing
196 changed files
with
2,847 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
.../built-ins/Temporal/Calendar/prototype/dateAdd/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
...uilt-ins/Temporal/Calendar/prototype/dateUntil/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 17 additions & 0 deletions
17
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/day/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/day/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/day/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
...uilt-ins/Temporal/Calendar/prototype/dayOfWeek/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
...uilt-ins/Temporal/Calendar/prototype/dayOfYear/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
14 changes: 14 additions & 0 deletions
14
...lt-ins/Temporal/Calendar/prototype/daysInMonth/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
...ilt-ins/Temporal/Calendar/prototype/daysInWeek/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-proto-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 14 additions & 0 deletions
14
...ilt-ins/Temporal/Calendar/prototype/daysInYear/argument-constructor-in-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 16 additions & 0 deletions
16
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-duplicate-calendar-fields.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} |
Oops, something went wrong.