mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:37:34 +00:00
AK: Track byte length, rather than code point length, in Utf8View::trim
Utf8View::trim uses Utf8View::substring_view to return its result, which requires the input to be a byte offset/length rather than code point length.
This commit is contained in:
parent
660a8982e7
commit
87848cdf7d
3 changed files with 49 additions and 8 deletions
|
@ -56,3 +56,9 @@ test("trimEnd", () => {
|
|||
expect("\r\nhello friends".trimEnd()).toBe("\r\nhello friends");
|
||||
expect("\rhello friends\r\n".trimEnd()).toBe("\rhello friends");
|
||||
});
|
||||
|
||||
test("multi-byte code point", () => {
|
||||
expect("_\u180E".trim()).toBe("_\u180E");
|
||||
expect("\u180E".trim()).toBe("\u180E");
|
||||
expect("\u180E_".trim()).toBe("\u180E_");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue