mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibJS: Implement String.prototype.charAt with UTF-16 code units
This commit is contained in:
parent
2bba20d123
commit
5d11614bc7
Notes:
sideshowbarker
2024-07-18 08:36:08 +09:00
Author: https://github.com/trflynn89
Commit: 5d11614bc7
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 24 additions and 4 deletions
|
@ -18,3 +18,11 @@ test("basic functionality", () => {
|
|||
expect(s.charAt("foo")).toBe("f");
|
||||
expect(s.charAt(undefined)).toBe("f");
|
||||
});
|
||||
|
||||
test("UTF-16", () => {
|
||||
var s = "😀";
|
||||
expect(s).toHaveLength(2);
|
||||
expect(s.charAt(0)).toBe("\ud83d");
|
||||
expect(s.charAt(1)).toBe("\ude00");
|
||||
expect(s.charAt(2)).toBe("");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue