mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibJS: Implement String.prototype.startsWith with UTF-16 code units
This commit is contained in:
parent
f920e121b3
commit
d2e63a641f
Notes:
sideshowbarker
2024-07-18 08:35:27 +09:00
Author: https://github.com/trflynn89
Commit: d2e63a641f
Pull-request: https://github.com/SerenityOS/serenity/pull/8897
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/davidot
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