Skip to content

Commit e131d31

Browse files
committed
test(ptx): Add regression test for stdin reference format
1 parent 124d787 commit e131d31

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/by-util/test_ptx.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,25 @@ use uutests::new_ucmd;
1010
fn test_invalid_arg() {
1111
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
1212
}
13-
13+
#[test]
14+
fn test_reference_format_for_stdin() {
15+
let input = "Rust is good language";
16+
let expected_output = concat!(
17+
r#".xx "" "" "Rust is good language" "" ":1""#,
18+
"\n",
19+
r#".xx "" "Rust is" "good language" "" ":1""#,
20+
"\n",
21+
r#".xx "" "Rust" "is good language" "" ":1""#,
22+
"\n",
23+
r#".xx "" "Rust is good" "language" "" ":1""#,
24+
"\n",
25+
);
26+
new_ucmd!()
27+
.args(&["-G", "-A"])
28+
.pipe_in(input)
29+
.succeeds()
30+
.stdout_only(expected_output);
31+
}
1432
#[test]
1533
fn test_tex_format_no_truncation_markers() {
1634
let input = "Hello world Rust is a fun language";

0 commit comments

Comments
 (0)