mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Add reference ISO days to PlainYearMonth assertions
I missed adding these in 27f0104bc65693959d85c0bdb41a4937e796abba
This commit is contained in:
parent
06fafd794b
commit
a44a97a09a
@ -13,8 +13,10 @@ assert.throws(RangeError, () => new Temporal.PlainYearMonth(275760, 10), "max");
|
|||||||
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4),
|
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4),
|
||||||
-271821, 4, "M04", "min");
|
-271821, 4, "M04", "min");
|
||||||
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4, "iso8601", 18),
|
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4, "iso8601", 18),
|
||||||
-271821, 4, "M04", "min with referenceISODay");
|
-271821, 4, "M04", "min with referenceISODay",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 18);
|
||||||
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9),
|
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9),
|
||||||
275760, 9, "M09", "max");
|
275760, 9, "M09", "max");
|
||||||
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9, "iso8601", 14),
|
TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(275760, 9, "iso8601", 14),
|
||||||
275760, 9, "M09", "max with referenceISODay");
|
275760, 9, "M09", "max with referenceISODay",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 14);
|
||||||
|
@ -90,11 +90,17 @@ const month2 = Temporal.PlainYearMonth.from({ year: 2022, month: 2, calendar });
|
|||||||
const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35);
|
const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35);
|
||||||
const oneMonth = new Temporal.Duration(0, 0, 0, 36);
|
const oneMonth = new Temporal.Duration(0, 0, 0, 36);
|
||||||
|
|
||||||
|
// Reference ISO dates in the custom calendar:
|
||||||
|
// M01 = 01-01
|
||||||
|
// M02 = 02-06
|
||||||
|
// M03 = 03-14
|
||||||
|
|
||||||
calendar.dateFromFieldsCalls = [];
|
calendar.dateFromFieldsCalls = [];
|
||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.add(lessThanOneMonth),
|
month2.add(lessThanOneMonth),
|
||||||
2022, 2, "M02",
|
2022, 2, "M02",
|
||||||
"adding positive less than one month's worth of days yields the same month"
|
"adding positive less than one month's worth of days yields the same month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 6
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -108,7 +114,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.add(oneMonth),
|
month2.add(oneMonth),
|
||||||
2022, 3, "M03",
|
2022, 3, "M03",
|
||||||
"adding positive one month's worth of days yields the following month"
|
"adding positive one month's worth of days yields the following month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 14
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -122,7 +129,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.add(lessThanOneMonth.negated()),
|
month2.add(lessThanOneMonth.negated()),
|
||||||
2022, 2, "M02",
|
2022, 2, "M02",
|
||||||
"adding negative less than one month's worth of days yields the same month"
|
"adding negative less than one month's worth of days yields the same month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 6
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -136,7 +144,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.add(oneMonth.negated()),
|
month2.add(oneMonth.negated()),
|
||||||
2022, 1, "M01",
|
2022, 1, "M01",
|
||||||
"adding negative one month's worth of days yields the previous month"
|
"adding negative one month's worth of days yields the previous month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 1
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
@ -90,11 +90,17 @@ const month2 = Temporal.PlainYearMonth.from({ year: 2022, month: 2, calendar });
|
|||||||
const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35);
|
const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35);
|
||||||
const oneMonth = new Temporal.Duration(0, 0, 0, 36);
|
const oneMonth = new Temporal.Duration(0, 0, 0, 36);
|
||||||
|
|
||||||
|
// Reference ISO dates in the custom calendar:
|
||||||
|
// M01 = 01-01
|
||||||
|
// M02 = 02-06
|
||||||
|
// M03 = 03-14
|
||||||
|
|
||||||
calendar.dateFromFieldsCalls = [];
|
calendar.dateFromFieldsCalls = [];
|
||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.subtract(lessThanOneMonth),
|
month2.subtract(lessThanOneMonth),
|
||||||
2022, 2, "M02",
|
2022, 2, "M02",
|
||||||
"subtracting positive less than one month's worth of days yields the same month"
|
"subtracting positive less than one month's worth of days yields the same month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 6
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -108,7 +114,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.subtract(oneMonth),
|
month2.subtract(oneMonth),
|
||||||
2022, 1, "M01",
|
2022, 1, "M01",
|
||||||
"subtracting positive one month's worth of days yields the previous month"
|
"subtracting positive one month's worth of days yields the previous month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 1
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -122,7 +129,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.subtract(lessThanOneMonth.negated()),
|
month2.subtract(lessThanOneMonth.negated()),
|
||||||
2022, 2, "M02",
|
2022, 2, "M02",
|
||||||
"subtracting negative less than one month's worth of days yields the same month"
|
"subtracting negative less than one month's worth of days yields the same month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 6
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -136,7 +144,8 @@ calendar.dateFromFieldsCalls = [];
|
|||||||
TemporalHelpers.assertPlainYearMonth(
|
TemporalHelpers.assertPlainYearMonth(
|
||||||
month2.subtract(oneMonth.negated()),
|
month2.subtract(oneMonth.negated()),
|
||||||
2022, 3, "M03",
|
2022, 3, "M03",
|
||||||
"subtracting negative one month's worth of days yields the following month"
|
"subtracting negative one month's worth of days yields the following month",
|
||||||
|
/* era = */ undefined, /* eraYear = */ undefined, /* referenceISODay = */ 14
|
||||||
);
|
);
|
||||||
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
assert.sameValue(calendar.dateFromFieldsCalls.length, 1, "dateFromFields was called");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user