summaryrefslogtreecommitdiffstats
path: root/tests/by-util
diff options
context:
space:
mode:
authorChristian von Elm <cvonelm@cvonelm.de>2024-06-22 19:30:39 +0200
committerGitHub <noreply@github.com>2024-06-22 19:30:39 +0200
commit0ae6d43536a9f075d0c5697858b1886cd8ce3df7 (patch)
treedc37b7ab3ee16b5fbbb8ec476c56adc671fa8ab2 /tests/by-util
parent7766257aee3a9631dfb8245e1c4d18d17641ae31 (diff)
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
Diffstat (limited to 'tests/by-util')
-rw-r--r--tests/by-util/test_tr.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs
index a68a793bc..4179e21fb 100644
--- a/tests/by-util/test_tr.rs
+++ b/tests/by-util/test_tr.rs
@@ -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();
+}