mirror of https://github.com/tc39/test262.git
Add Temporal era/eraYear tests
This commit is contained in:
parent
c4d8f01d3d
commit
53e5ef817e
16
test/built-ins/Temporal/Calendar/prototype/dateFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/dateFromFields/one-of-era-erayear-undefined.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.datefromfields
|
||||
description: Does not throw a RangeError if only one of era/eraYear fields is present
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
|
||||
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
|
||||
const instance = new Temporal.Calendar('iso8601');
|
||||
TemporalHelpers.assertPlainDate(instance.dateFromFields({ ...base }), 2000, 5, 'M05', 2);
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
TemporalHelpers.assertPlainDate(instance.dateFromFields({ ...base }), 2000, 5, 'M05', 2);
|
16
test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/one-of-era-erayear-undefined.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.monthDayFromFields
|
||||
description: Does not throw a RangeError if only one of era/eraYear fields is present
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
|
||||
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
|
||||
const instance = new Temporal.Calendar('iso8601');
|
||||
TemporalHelpers.assertPlainMonthDay(instance.monthDayFromFields({ ...base }), 'M05', 2);
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
TemporalHelpers.assertPlainMonthDay(instance.monthDayFromFields({ ...base }), 'M05', 2);
|
16
test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
16
test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/one-of-era-erayear-undefined.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.yearMonthFromFields
|
||||
description: Does not throw a RangeError if only one of era/eraYear fields is present
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
|
||||
const base = { year: 2000, month: 5, day: 2, era: 'ce' };
|
||||
const instance = new Temporal.Calendar('iso8601');
|
||||
TemporalHelpers.assertPlainYearMonth(instance.yearMonthFromFields({ ...base }), 2000, 5, 'M05');
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
TemporalHelpers.assertPlainYearMonth(instance.yearMonthFromFields({ ...base }), 2000, 5, 'M05');
|
19
test/intl402/Temporal/Calendar/prototype/dateFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
19
test/intl402/Temporal/Calendar/prototype/dateFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// 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.datefromfields
|
||||
description: Throw a RangeError 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, () => {
|
||||
instance.dateFromFields({ ...base });
|
||||
});
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
assert.throws(RangeError, () => {
|
||||
instance.dateFromFields({ ...base2 });
|
||||
});
|
19
test/intl402/Temporal/Calendar/prototype/monthDayFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
19
test/intl402/Temporal/Calendar/prototype/monthDayFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// 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.monthdayfromfields
|
||||
description: Throw a RangeError 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, () => {
|
||||
instance.monthDayFromFields({ ...base });
|
||||
});
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
assert.throws(RangeError, () => {
|
||||
instance.dateFromFields({ ...base2 });
|
||||
});
|
19
test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
19
test/intl402/Temporal/Calendar/prototype/yearMonthFromFields/one-of-era-erayear-undefined.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// 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.yearmonthfromfields
|
||||
description: Throw a RangeError 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, () => {
|
||||
instance.yearMonthFromFields({ ...base });
|
||||
});
|
||||
|
||||
const base2 = { year: 2000, month: 5, day: 2, eraYear: 1 };
|
||||
assert.throws(RangeError, () => {
|
||||
instance.yearMonthFromFields({ ...base2 });
|
||||
});
|
Loading…
Reference in New Issue