mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:27:35 +00:00
LibJS: Implement String.prototype.includes with UTF-16 code units
This also implements String.prototype.includes more closely to the spec (such as returning false when the search string is a RegExp object).
This commit is contained in:
parent
a05ce330b8
commit
70f9c7e1c7
2 changed files with 52 additions and 12 deletions
|
@ -10,3 +10,11 @@ test("basic functionality", () => {
|
|||
expect("hello 10 friends".includes(10)).toBeTrue();
|
||||
expect("hello friends undefined".includes()).toBeTrue();
|
||||
});
|
||||
|
||||
test("UTF-16", () => {
|
||||
var s = "😀";
|
||||
expect(s.includes("😀")).toBeTrue();
|
||||
expect(s.includes("\ud83d")).toBeTrue();
|
||||
expect(s.includes("\ude00")).toBeTrue();
|
||||
expect(s.includes("a")).toBeFalse();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue