mirror of https://github.com/tc39/test262.git
Temporal: Fix test to check for TypeError with only one of era/eraYear
These tests were incorrect, in checking for a RangeError when only one of the era/eraYear fields were given. From CalendarResolveFields: "The operation throws a *TypeError* exception if the properties of _fields_ are internally inconsistent within the calendar or insufficient to identify a unique instance of _type_ in the calendar."
This commit is contained in:
parent
dab8ccc5df
commit
f4377a7cf0
|
@ -3,17 +3,17 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.datefromfields
|
||||
description: Throw a RangeError if only one of era/eraYear fields is present
|
||||
description: Throw a TypeError if only one of era/eraYear fields is present
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
|
||||
const instance = new Temporal.Calendar('gregory');
|
||||
assert.throws(RangeError, () => {
|
||||
assert.throws(TypeError, () => {
|
||||
instance.dateFromFields({ ...base });
|
||||
});
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
assert.throws(RangeError, () => {
|
||||
assert.throws(TypeError, () => {
|
||||
instance.dateFromFields({ ...base2 });
|
||||
});
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.yearmonthfromfields
|
||||
description: Throw a RangeError if only one of era/eraYear fields is present
|
||||
description: Throw a TypeError if only one of era/eraYear fields is present
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
|
||||
const instance = new Temporal.Calendar('gregory');
|
||||
assert.throws(RangeError, () => {
|
||||
assert.throws(TypeError, () => {
|
||||
instance.yearMonthFromFields({ ...base });
|
||||
});
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
assert.throws(RangeError, () => {
|
||||
assert.throws(TypeError, () => {
|
||||
instance.yearMonthFromFields({ ...base2 });
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue