1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:28:11 +00:00

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

This commit is contained in:
Timothy Flynn 2021-07-19 16:01:35 -04:00 committed by Andreas Kling
parent d2e63a641f
commit bdbe716547
2 changed files with 25 additions and 14 deletions

View file

@ -40,3 +40,11 @@ test("basic functionality", () => {
);
expect(s.endsWith("bar", undefined)).toBeTrue();
});
test("UTF-16", () => {
var s = "😀";
expect(s.endsWith("😀")).toBeTrue();
expect(s.endsWith("\ud83d")).toBeFalse();
expect(s.endsWith("\ude00")).toBeTrue();
expect(s.endsWith("a")).toBeFalse();
});