From a44a97a09a908cf40f6d578f36a875b9104fb4f1 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 3 May 2022 10:35:41 -0700 Subject: [PATCH] Add reference ISO days to PlainYearMonth assertions I missed adding these in 27f0104bc65693959d85c0bdb41a4937e796abba --- .../built-ins/Temporal/PlainYearMonth/limits.js | 6 ++++-- .../add/calendar-datefromfields-called.js | 17 +++++++++++++---- .../subtract/calendar-datefromfields-called.js | 17 +++++++++++++---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/test/built-ins/Temporal/PlainYearMonth/limits.js b/test/built-ins/Temporal/PlainYearMonth/limits.js index 696184b990..5bc38a4107 100644 --- a/test/built-ins/Temporal/PlainYearMonth/limits.js +++ b/test/built-ins/Temporal/PlainYearMonth/limits.js @@ -13,8 +13,10 @@ assert.throws(RangeError, () => new Temporal.PlainYearMonth(275760, 10), "max"); TemporalHelpers.assertPlainYearMonth(new Temporal.PlainYearMonth(-271821, 4), -271821, 4, "M04", "min"); 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), 275760, 9, "M09", "max"); 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); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/add/calendar-datefromfields-called.js b/test/built-ins/Temporal/PlainYearMonth/prototype/add/calendar-datefromfields-called.js index de0bee72b0..40f5dd1b73 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/add/calendar-datefromfields-called.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/add/calendar-datefromfields-called.js @@ -90,11 +90,17 @@ const month2 = Temporal.PlainYearMonth.from({ year: 2022, month: 2, calendar }); const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35); 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 = []; TemporalHelpers.assertPlainYearMonth( month2.add(lessThanOneMonth), 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.deepEqual( @@ -108,7 +114,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.add(oneMonth), 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.deepEqual( @@ -122,7 +129,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.add(lessThanOneMonth.negated()), 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.deepEqual( @@ -136,7 +144,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.add(oneMonth.negated()), 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.deepEqual( diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-datefromfields-called.js b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-datefromfields-called.js index 7e717222a8..fda7e4bbac 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-datefromfields-called.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-datefromfields-called.js @@ -90,11 +90,17 @@ const month2 = Temporal.PlainYearMonth.from({ year: 2022, month: 2, calendar }); const lessThanOneMonth = new Temporal.Duration(0, 0, 0, 35); 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 = []; TemporalHelpers.assertPlainYearMonth( month2.subtract(lessThanOneMonth), 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.deepEqual( @@ -108,7 +114,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.subtract(oneMonth), 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.deepEqual( @@ -122,7 +129,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.subtract(lessThanOneMonth.negated()), 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.deepEqual( @@ -136,7 +144,8 @@ calendar.dateFromFieldsCalls = []; TemporalHelpers.assertPlainYearMonth( month2.subtract(oneMonth.negated()), 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.deepEqual(