1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

LibJS: Implement parsing of TemporalCalendarString

This commit is contained in:
Linus Groh 2021-11-20 01:28:46 +00:00
parent 1583c7257c
commit 79a18b058f
6 changed files with 33 additions and 9 deletions

View file

@ -22,6 +22,6 @@ describe("normal behavior", () => {
expect(Temporal.Calendar.from(calendarLike)).toBe(calendarLike);
expect(Temporal.Calendar.from(withCalendarLike)).toBe(withCalendarLike.calendar);
expect(Temporal.Calendar.from("iso8601").id).toBe("iso8601");
// TODO: test Temporal.Calendar.from("TemporalCalendarString") once ParseTemporalCalendarString is working
expect(Temporal.Calendar.from("2021-07-06[u-ca=iso8601]").id).toBe("iso8601");
});
});

View file

@ -31,13 +31,11 @@ describe("errors", () => {
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
// FIXME: Enable this when calendar string parsing is implemented.
test.skip("from invalid calendar string", () => {
test("from invalid calendar string", () => {
const zonedDateTime = new Temporal.ZonedDateTime(1n, {}, {});
// FIXME: Use "toThrowWithMessage" once this has an error message.
expect(() => {
zonedDateTime.withCalendar("iso8602foobar");
}).toThrow(RangeError);
}).toThrowWithMessage(RangeError, "Invalid calendar string 'iso8602foobar'");
});
});