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

Refuse to translate if set2 contains more than one unique characters and set1 contains a character class (#6472)

* Refuse to translate if set2 contains > 1 unique characters
This commit is contained in:
Christian von Elm 2024-06-22 19:30:39 +02:00 committed by GitHub
parent 7766257aee
commit 0ae6d43536
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 1 deletions

View file

@ -1386,3 +1386,23 @@ fn check_set1_longer_set2_ends_in_class_with_trunc() {
.args(&["-t", "[:lower:]a", "[:upper:]"])
.succeeds();
}
#[test]
fn check_complement_2_unique_in_set2() {
let x226 = "x".repeat(226);
// [y*] is expanded tp "y" here
let arg = x226 + "[y*]xxx";
new_ucmd!().args(&["-c", "[:upper:]", arg.as_str()]).fails();
}
#[test]
fn check_complement_1_unique_in_set2() {
let x226 = "x".repeat(226);
// [y*] is expanded to "" here
let arg = x226 + "[y*]xxxx";
new_ucmd!()
.args(&["-c", "[:upper:]", arg.as_str()])
.succeeds();
}