Skip to content

Commit d2c6c48

Browse files
tr: finish converting operations to streaming
1 parent a71e5c5 commit d2c6c48

File tree

2 files changed

+1503
-1265
lines changed

2 files changed

+1503
-1265
lines changed

text/tests/tr/mod.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,13 @@ fn tr_ross_1b() {
288288

289289
#[test]
290290
fn tr_ross_2() {
291-
tr_test(&["-dcs", "[:lower:]", "n-rs-z"], "amzAMZ123.-+amz", "amzam");
291+
// Modified expected output to match other implementations
292+
// "amzam" -> "amzamz"
293+
tr_test(
294+
&["-dcs", "[:lower:]", "n-rs-z"],
295+
"amzAMZ123.-+amz",
296+
"amzamz",
297+
);
292298
}
293299

294300
#[test]
@@ -531,7 +537,7 @@ fn tr_octal_above_one_byte_value() {
531537
expected_out: "Ł)".to_owned(),
532538
expected_err: r"tr: warning: the ambiguous octal escape \501 is being interpreted as the 2-byte sequence \050, 1
533539
".to_owned(),
534-
expected_exit_code: 0,
540+
expected_exit_code: 0_i32,
535541
});
536542
}
537543

@@ -609,3 +615,16 @@ fn tr_ranges_with_invalid_escape_sequences() {
609615
// Similar to above
610616
tr_test(&["-d", r"\7-\A"], INPUT, r"abcdefBCDEF\\");
611617
}
618+
619+
// Make sure state is persisted through multiple calls to `transform`
620+
#[test]
621+
fn tr_streaming_state() {
622+
let a_s = "a".repeat(16_usize * 1_024_usize);
623+
624+
tr_test(&["-s", "a", "b"], &a_s, "b");
625+
}
626+
627+
#[test]
628+
fn tr_minimal_d_s() {
629+
tr_test(&["-d", "-s", "", "A"], "1AA", "1A");
630+
}

0 commit comments

Comments
 (0)