forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibJS: Implement Temporal.PlainYearMonth.prototype.toLocaleString()
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...s/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.toLocaleString.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe("correct behavior", () => { | ||
test("length is 0", () => { | ||
expect(Temporal.PlainYearMonth.prototype.toLocaleString).toHaveLength(0); | ||
}); | ||
|
||
test("basic functionality", () => { | ||
let plainYearMonth; | ||
|
||
plainYearMonth = new Temporal.PlainYearMonth(2021, 7); | ||
expect(plainYearMonth.toLocaleString()).toBe("2021-07"); | ||
|
||
plainYearMonth = new Temporal.PlainYearMonth(2021, 7, { toString: () => "foo" }, 6); | ||
expect(plainYearMonth.toLocaleString()).toBe("2021-07-06[u-ca=foo]"); | ||
}); | ||
}); | ||
|
||
describe("errors", () => { | ||
test("this value must be a Temporal.PlainYearMonth object", () => { | ||
expect(() => { | ||
Temporal.PlainYearMonth.prototype.toLocaleString.call("foo"); | ||
}).toThrowWithMessage(TypeError, "Not a Temporal.PlainYearMonth"); | ||
}); | ||
}); |