1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

tr: operate on bytes instead of chars

This commit is contained in:
Terts Diepraam 2023-12-11 13:35:17 +01:00
parent 4442b35370
commit bc5b5e013a
5 changed files with 115 additions and 151 deletions

View file

@ -29,12 +29,12 @@ fn test_small_set2() {
}
#[test]
fn test_unicode() {
fn test_invalid_unicode() {
new_ucmd!()
.args(&[", ┬─┬", "╯︵┻━┻"])
.pipe_in("(,°□°), ┬─┬")
.run()
.stdout_is("(╯°□°)╯︵┻━┻");
.args(&["-dc", "abc"])
.pipe_in([0o200, b'a', b'b', b'c'])
.succeeds()
.stdout_is("abc");
}
#[test]
@ -733,10 +733,11 @@ fn check_against_gnu_tr_tests_w() {
// {IN=>"\300\301\377\345\345\350\345"},
// {OUT=>"\300\301\377\345"}],
new_ucmd!()
.args(&["-ds", "\u{350}", "\u{345}"])
.pipe_in("\u{300}\u{301}\u{377}\u{345}\u{345}\u{350}\u{345}")
.arg("-ds")
.args(&["\\350", "\\345"])
.pipe_in([0o300, 0o301, 0o377, 0o345, 0o345, 0o350, 0o345])
.succeeds()
.stdout_is("\u{300}\u{301}\u{377}\u{345}");
.stdout_is_bytes([0o300, 0o301, 0o377, 0o345]);
}
#[test]