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

tr: correctly detected matched [:upper:]

tr detects if a class in set2 is matched by a class at the correct position in set1 after it has expanded everything before the class in both sets:

So

tr 'abcd[:upper:]' 'a-d[:lower:]'

should not fail
This commit is contained in:
Christian von Elm 2024-06-30 14:17:13 +02:00
parent cb5111c1b8
commit 866366a874
2 changed files with 55 additions and 81 deletions

View file

@ -1375,6 +1375,13 @@ fn check_class_in_set2_must_be_matched_in_set1() {
new_ucmd!().args(&["-t", "1[:upper:]", "[:upper:]"]).fails();
}
#[test]
fn check_class_in_set2_must_be_matched_in_set1_right_length_check() {
new_ucmd!()
.args(&["-t", "a-z[:upper:]", "abcdefghijklmnopqrstuvwxyz[:upper:]"])
.succeeds();
}
#[test]
fn check_set1_longer_set2_ends_in_class() {
new_ucmd!().args(&["[:lower:]a", "[:upper:]"]).fails();