mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibJS: Implement String.prototype.lastIndexOf with UTF-16 code units
This commit is contained in:
parent
5ac964d841
commit
f920e121b3
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