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

Refuse to translate if set1 is longer than set2 and set2 ends in a character class

tr [:lower:]a [:upper:]

fails in GNU tr, so print an error for tr too.
This commit is contained in:
Christian von Elm 2024-06-15 12:38:19 +02:00
parent 6a13c48085
commit a46e4fd290
2 changed files with 25 additions and 0 deletions

View file

@ -1374,3 +1374,15 @@ fn check_disallow_blank_in_set2_when_translating() {
fn check_class_in_set2_must_be_matched_in_set1() {
new_ucmd!().args(&["-t", "1[:upper:]", "[:upper:]"]).fails();
}
#[test]
fn check_set1_longer_set2_ends_in_class() {
new_ucmd!().args(&["[:lower:]a", "[:upper:]"]).fails();
}
#[test]
fn check_set1_longer_set2_ends_in_class_with_trunc() {
new_ucmd!()
.args(&["-t", "[:lower:]a", "[:upper:]"])
.succeeds();
}