Skip to content

Commit

Permalink
Temporal: Fix Japanese era test
Browse files Browse the repository at this point in the history
This mistakenly used a previous name for the helper function. Also adds
a couple of debugging messages.
  • Loading branch information
ptomato committed Jul 25, 2024
1 parent 7f81bb2 commit e793276
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions harness/temporalHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions test/staging/Intl402/Temporal/old/japanese-era.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

0 comments on commit e793276

Please sign in to comment.