tr: fix graph/print character class mapping (#11405)

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
Can Bölük
2026-03-26 16:21:28 +01:00
committed by GitHub
co-authored by Sylvestre Ledru
parent 230e0cfd65
commit 358063f336
2 changed files with 35 additions and 3 deletions
+32
View File
@@ -65,6 +65,38 @@ fn test_delete() {
.stdout_is("BD");
}
#[test]
fn test_delete_graph_and_print_match_gnu() {
let input = [b' ', b'A', b'!', b'\t', b'\n'];
new_ucmd!()
.args(&["-d", "[:graph:]"])
.pipe_in(input)
.succeeds()
.stdout_is_bytes([b' ', b'\t', b'\n']);
new_ucmd!()
.args(&["-d", "[:print:]"])
.pipe_in(input)
.succeeds()
.stdout_is_bytes([b'\t', b'\n']);
}
#[test]
fn test_delete_complement_graph_and_print_match_gnu() {
let input = [b' ', b'A', b'!', b'\t', b'\n'];
new_ucmd!()
.args(&["-d", "-c", "[:graph:]"])
.pipe_in(input)
.succeeds()
.stdout_is_bytes([b'A', b'!']);
new_ucmd!()
.args(&["-d", "-c", "[:print:]"])
.pipe_in(input)
.succeeds()
.stdout_is_bytes([b' ', b'A', b'!']);
}
#[test]
fn test_delete_afterwards_is_not_flag() {
new_ucmd!()