Temporal: Consistently test that calendar is copied in X.from()

We did this inconsistently in PlainDate and ZonedDateTime, and not in the
other calendar-carrying types. Additionally, we don't have to create the
calendar explicitly in PlainDate.
This commit is contained in:
Philip Chimento 2022-09-20 11:22:56 -07:00 committed by Ms2ger
parent c335322537
commit 8b5dc0b1ef
4 changed files with 8 additions and 7 deletions

View File

@ -8,8 +8,7 @@ includes: [temporalHelpers.js]
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
const orig = new Temporal.PlainDate(2000, 5, 2, calendar);
const orig = new Temporal.PlainDate(2000, 5, 2);
const result = Temporal.PlainDate.from(orig);
TemporalHelpers.assertPlainDate(
@ -18,11 +17,7 @@ TemporalHelpers.assertPlainDate(
"PlainDate is copied"
);
assert.sameValue(
result.calendar,
calendar,
"Calendar is copied"
);
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
assert.notSameValue(
result,

View File

@ -17,6 +17,8 @@ TemporalHelpers.assertPlainDateTime(
"PlainDateTime is copied"
);
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
assert.notSameValue(
result,
orig,

View File

@ -18,6 +18,8 @@ TemporalHelpers.assertPlainMonthDay(
/* isoYear = */ 2000
);
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
assert.notSameValue(
result,
orig,

View File

@ -18,6 +18,8 @@ TemporalHelpers.assertPlainYearMonth(
/* era = */ undefined, /* eraYear = */ undefined, /* isoDay = */ 7
);
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
assert.notSameValue(
result,
orig,