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

tr: add truncate flag

This commit is contained in:
shutefan 2017-10-06 00:20:41 +02:00
parent 618531b366
commit ddbfafa684
2 changed files with 35 additions and 4 deletions

View file

@ -57,3 +57,27 @@ fn test_delete_and_squeeze_complement() {
new_ucmd!()
.args(&["-dsc", "a-z", "A-Z"]).pipe_in("abBcB").run().stdout_is("abc");
}
#[test]
fn test_set1_longer_than_set2() {
new_ucmd!()
.args(&["abc", "xy"]).pipe_in("abcde").run().stdout_is("xyyde");
}
#[test]
fn test_set1_shorter_than_set2() {
new_ucmd!()
.args(&["ab", "xyz"]).pipe_in("abcde").run().stdout_is("xycde");
}
#[test]
fn test_truncate() {
new_ucmd!()
.args(&["-t", "abc", "xy"]).pipe_in("abcde").run().stdout_is("xycde");
}
#[test]
fn test_truncate_with_set1_shorter_than_set2() {
new_ucmd!()
.args(&["-t", "ab", "xyz"]).pipe_in("abcde").run().stdout_is("xycde");
}