mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
tr: fix complement if set2 is range
This commit is contained in:
parent
83eb704415
commit
34c22dc3ad
2 changed files with 21 additions and 1 deletions
|
@ -149,7 +149,7 @@ impl TranslateOperation {
|
||||||
TranslateOperation {
|
TranslateOperation {
|
||||||
translate_map: map,
|
translate_map: map,
|
||||||
complement,
|
complement,
|
||||||
s2_last: s2_prev,
|
s2_last: set2.last().unwrap_or(s2_prev),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,26 @@ fn test_complement3() {
|
||||||
.stdout_is("3he3ca33a3d33he3ba3");
|
.stdout_is("3he3ca33a3d33he3ba3");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_complement4() {
|
||||||
|
// $ echo -n '0x1y2z3' | tr -c '0-@' '*-~'
|
||||||
|
// 0~1~2~3
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["-c", "0-@", "*-~"])
|
||||||
|
.pipe_in("0x1y2z3")
|
||||||
|
.run()
|
||||||
|
.stdout_is("0~1~2~3");
|
||||||
|
|
||||||
|
// TODO: fix this
|
||||||
|
// $ echo '0x1y2z3' | tr -c '\0-@' '*-~'
|
||||||
|
// 0a1b2c3
|
||||||
|
// new_ucmd!()
|
||||||
|
// .args(&["-c", "\\0-@", "*-~"])
|
||||||
|
// .pipe_in("0x1y2z3")
|
||||||
|
// .run()
|
||||||
|
// .stdout_is("0a1b2c3");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_squeeze() {
|
fn test_squeeze() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue