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

LibJS: Implement String.prototype.startsWith with UTF-16 code units

This commit is contained in:
Timothy Flynn 2021-07-19 15:57:05 -04:00 committed by Andreas Kling
parent f920e121b3
commit d2e63a641f
2 changed files with 26 additions and 9 deletions

View file

@ -34,3 +34,11 @@ test("basic functionality", () => {
expect(s.startsWith("", -1)).toBeTrue();
expect(s.startsWith("", 42)).toBeTrue();
});
test("UTF-16", () => {
var s = "😀";
expect(s.startsWith("😀")).toBeTrue();
expect(s.startsWith("\ud83d")).toBeTrue();
expect(s.startsWith("\ude00")).toBeFalse();
expect(s.startsWith("a")).toBeFalse();
});