fix: avoid panic on -fprintf with missing arguments (#698)

Fixes #696
This commit is contained in:
Sylvestre Ledru
2026-06-04 20:41:58 +02:00
committed by GitHub
parent 5269e233a6
commit 9a1e379a9d
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -985,6 +985,21 @@ fn find_fprintf() {
assert!(contents.contains("test_data/simple"));
}
#[test]
fn find_fprintf_missing_arguments() {
// Regression test: `-fprintf` with no file/format argument must report a
// missing-argument error instead of panicking (see issue #696).
ucmd()
.args(&["-fprintf"])
.fails()
.stderr_contains("missing argument to -fprintf");
ucmd()
.args(&["-fprintf", "/tmp/find_fprintf_out"])
.fails()
.stderr_contains("missing argument to -fprintf");
}
#[test]
fn find_ls() {
ucmd()