test: cover -T line-number width on the file (not stdin) path

This commit is contained in:
Sylvestre Ledru
2026-05-30 09:47:31 +02:00
parent 6c5b7dc9e3
commit 89aec4a45a
+9
View File
@@ -626,6 +626,15 @@ fn line_number_and_byte_offset_prefixes() {
.pipe_in("x\n")
.succeeds()
.stdout_contains("1:\tx\n");
// -T against a real file (not stdin): the line-number field width is
// derived from the file size, which only happens on the `File` path in
// `process_file` (src/searcher.rs), not the stdin path.
let (scene, mut c) = ucmd();
scene.fixtures.write("f", "x\n");
c.args(&["-T", "-n", "x", "f"])
.succeeds()
.stdout_contains("1:\tx\n");
}
#[test]