1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

ptx: use char count instead of byte index to handle utf-8 characters

This commit is contained in:
Aaron Ang 2025-05-06 23:16:11 -07:00
parent 31e57502a3
commit 1cfb19a936
2 changed files with 63 additions and 32 deletions

View file

@ -174,3 +174,17 @@ fn test_failed_write_is_reported() {
.fails()
.stderr_is("ptx: write failed: No space left on device\n");
}
#[test]
fn test_utf8() {
new_ucmd!()
.args(&["-G"])
.pipe_in("its disabled\n")
.succeeds()
.stdout_only(".xx \"\" \"its\" \"disabled\" \"\"\n.xx \"\" \"\" \"its disabled\" \"\"\n");
new_ucmd!()
.args(&["-G", "-T"])
.pipe_in("its disabled\n")
.succeeds()
.stdout_only("\\xx {}{its}{disabled}{}{}\n\\xx {}{}{its}{ disabled}{}\n");
}