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:
parent
f920e121b3
commit
d2e63a641f
2 changed files with 26 additions and 9 deletions
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue