Skip to content

Commit 48b5439

Browse files
Misakaitcakebaker
authored andcommitted
test(ptx): Add regression tests for TeX and chunking bugs
Adds two fixture-based tests to verify GNU-compatible behavior: - `test_tex_format_no_truncation_markers`: Ensures TeX format does not display truncation markers. - `gnu_ext_disabled_chunk_no_over_reading`: Verifies that text chunks do not over-read at boundaries in traditional mode.
1 parent 6327810 commit 48b5439

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

tests/by-util/test_ptx.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ fn test_invalid_arg() {
1111
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
1212
}
1313

14+
#[test]
15+
fn test_tex_format_no_truncation_markers() {
16+
let input = "Hello world Rust is a fun language";
17+
new_ucmd!()
18+
.args(&["-G", "-w", "30", "--format=tex"])
19+
.pipe_in(input)
20+
.succeeds()
21+
.stdout_only_fixture("test_tex_format_no_truncation_markers.expected");
22+
}
23+
#[test]
24+
fn gnu_ext_disabled_chunk_no_over_reading() {
25+
let input = "Hello World Rust is a fun language";
26+
new_ucmd!()
27+
.args(&["-G", "-w", "30"])
28+
.pipe_in(input)
29+
.succeeds()
30+
.stdout_only_fixture("gnu_ext_disabled_chunk_no_over_reading.expected");
31+
}
32+
1433
#[test]
1534
fn test_truncation_no_extra_space_in_after() {
1635
new_ucmd!()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.xx "Rust is/" "" "Hello World" ""
2+
.xx "" "Hello World" "Rust is a/" ""
3+
.xx "is/" "Hello" "World Rust" ""
4+
.xx "" "/Rust is" "a fun/" ""
5+
.xx "" "/Rust is a" "fun language" ""
6+
.xx "" "/World Rust" "is a fun/" ""
7+
.xx "" "/is a fun" "language" ""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
\xx {Rust is}{}{Hello}{ world}{}
2+
\xx {}{Hello world}{Rust}{ is a}{}
3+
\xx {}{Rust is}{a}{ fun}{}
4+
\xx {}{Rust is a}{fun}{ language}{}
5+
\xx {}{world Rust}{is}{ a fun}{}
6+
\xx {}{is a fun}{language}{}{}
7+
\xx {is}{Hello}{world}{ Rust}{}

0 commit comments

Comments
 (0)