Skip to content

Commit f570cdb

Browse files
committed
Add testcase
1 parent 08717c3 commit f570cdb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/by-util/test_tr.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,3 +1374,23 @@ fn check_disallow_blank_in_set2_when_translating() {
13741374
fn check_class_in_set2_must_be_matched_in_set1() {
13751375
new_ucmd!().args(&["-t", "1[:upper:]", "[:upper:]"]).fails();
13761376
}
1377+
1378+
#[test]
1379+
fn check_complement_2_unique_in_set2() {
1380+
let x226 = std::iter::repeat("x").take(226).collect::<String>();
1381+
1382+
// [y*] is expanded tp "y" here
1383+
let arg = x226 + "[y*]xxx";
1384+
new_ucmd!().args(&["-c", "[:upper:]", arg.as_str()]).fails();
1385+
}
1386+
1387+
#[test]
1388+
fn check_complement_1_unique_in_set2() {
1389+
let x226 = std::iter::repeat("x").take(226).collect::<String>();
1390+
1391+
// [y*] is expanded to "" here
1392+
let arg = x226 + "[y*]xxxx";
1393+
new_ucmd!()
1394+
.args(&["-c", "[:upper:]", arg.as_str()])
1395+
.succeeds();
1396+
}

0 commit comments

Comments
 (0)