mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +00:00
LibJS: Implement String.prototype.at with UTF-16 code units
This commit is contained in:
parent
892bfdbbcf
commit
ef2ff5f88b
Notes:
sideshowbarker
2024-07-18 08:35:42 +09:00
Author: https://github.com/trflynn89
Commit: ef2ff5f88b
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 17 additions and 4 deletions
|
@ -13,3 +13,11 @@ test("basic functionality", () => {
|
|||
expect(string.at(-4)).toBeUndefined();
|
||||
expect(string.at(-Infinity)).toBeUndefined();
|
||||
});
|
||||
|
||||
test("UTF-16", () => {
|
||||
var s = "😀";
|
||||
expect(s).toHaveLength(2);
|
||||
expect(s.at(0)).toBe("\ud83d");
|
||||
expect(s.at(1)).toBe("\ude00");
|
||||
expect(s.at(2)).toBeUndefined();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue