mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
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:
parent
c335322537
commit
8b5dc0b1ef
@ -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,
|
||||
|
@ -17,6 +17,8 @@ TemporalHelpers.assertPlainDateTime(
|
||||
"PlainDateTime is copied"
|
||||
);
|
||||
|
||||
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
|
||||
|
||||
assert.notSameValue(
|
||||
result,
|
||||
orig,
|
||||
|
@ -18,6 +18,8 @@ TemporalHelpers.assertPlainMonthDay(
|
||||
/* isoYear = */ 2000
|
||||
);
|
||||
|
||||
assert.sameValue(result.calendar, orig.calendar, "Calendar is copied");
|
||||
|
||||
assert.notSameValue(
|
||||
result,
|
||||
orig,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user