mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
LibJS: Implement String.prototype.replace with UTF-16 code units
This commit is contained in:
parent
bdbe716547
commit
06208aaa15
3 changed files with 64 additions and 23 deletions
|
@ -232,3 +232,13 @@ test("override exec with non-function", () => {
|
|||
re.exec = 3;
|
||||
expect("test".replace(re, "x")).toBe("x");
|
||||
});
|
||||
|
||||
test("UTF-16", () => {
|
||||
expect("😀".replace("😀", "")).toBe("");
|
||||
expect("😀".replace("\ud83d", "")).toBe("\ude00");
|
||||
expect("😀".replace("\ude00", "")).toBe("\ud83d");
|
||||
|
||||
// FIXME: RegExp.prototype [ @@replace ] also needs to support UTF-16.
|
||||
// expect("😀".replace(/\ud83d/, "")).toBe("\ude00");
|
||||
// expect("😀".replace(/\ude00/, "")).toBe("\ud83d");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue