Temporal: Fix Japanese era test

This mistakenly used a previous name for the helper function. Also adds
a couple of debugging messages.
This commit is contained in:
Philip Chimento 2024-07-25 13:35:01 -07:00 committed by Ms2ger
parent 242f6f98f0
commit 3b89be9c5d
2 changed files with 6 additions and 6 deletions

View File

@ -127,7 +127,7 @@ var TemporalHelpers = {
* Return the canonical era code.
*/
canonicalizeCalendarEra(calendarId, eraName) {
assert.sameValue(typeof calendarId, "string");
assert.sameValue(typeof calendarId, "string", "calendar must be string in canonicalizeCalendarEra");
if (calendarId === "iso8601") {
assert.sameValue(eraName, undefined);
@ -138,7 +138,7 @@ var TemporalHelpers = {
if (eraName === undefined) {
return undefined;
}
assert.sameValue(typeof eraName, "string");
assert.sameValue(typeof eraName, "string", "eraName must be string or undefined in canonicalizeCalendarEra");
for (let {era, aliases = []} of TemporalHelpers.CalendarEras[calendarId]) {
if (era === eraName || aliases.includes(eraName)) {

View File

@ -69,8 +69,8 @@ date = Temporal.PlainDate.from({
});
assert.sameValue(`${date}`, "1000-01-01[u-ca=japanese]");
assert.sameValue(
TemporalHelpers.canonicalizeEraInCalendar(date, date.era),
TemporalHelpers.canonicalizeEraInCalendar(date, "ce"),
TemporalHelpers.canonicalizeCalendarEra(date.calendarId, date.era),
TemporalHelpers.canonicalizeCalendarEra(date.calendarId, "ce"),
);
assert.sameValue(date.eraYear, 1000);
@ -83,7 +83,7 @@ date = Temporal.PlainDate.from({
});
assert.sameValue(`${date}`, "0000-01-01[u-ca=japanese]");
assert.sameValue(
TemporalHelpers.canonicalizeEraInCalendar(date, date.era),
TemporalHelpers.canonicalizeEraInCalendar(date, "bce"),
TemporalHelpers.canonicalizeCalendarEra(date.calendarId, date.era),
TemporalHelpers.canonicalizeCalendarEra(date.calendarId, "bce"),
);
assert.sameValue(date.eraYear, 1);