mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibJS: Implement String.prototype.lastIndexOf with UTF-16 code units
This commit is contained in:
parent
5ac964d841
commit
f920e121b3
Notes:
sideshowbarker
2024-07-18 08:35:31 +09:00
Author: https://github.com/trflynn89
Commit: f920e121b3
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 40 additions and 21 deletions
|
@ -20,3 +20,11 @@ test("basic functionality", () => {
|
|||
expect("hello friends serenity".lastIndexOf("s", 13)).toBe(12);
|
||||
expect("hello".lastIndexOf("serenity")).toBe(-1);
|
||||
});
|
||||
|
||||
test("UTF-16", () => {
|
||||
var s = "😀";
|
||||
expect(s.lastIndexOf("😀")).toBe(0);
|
||||
expect(s.lastIndexOf("\ud83d")).toBe(0);
|
||||
expect(s.lastIndexOf("\ude00")).toBe(1);
|
||||
expect(s.lastIndexOf("a")).toBe(-1);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue