Skip to content

Commit 5182478

Browse files
committed
2025-10-16: find_cmd_tests.rs
1 parent a821295 commit 5182478

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

tests/find_cmd_tests.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,27 +264,28 @@ fn files0_pipe_double_nul() {
264264
#[serial(working_dir)]
265265
#[test]
266266
fn files0_no_file() {
267+
let scene = TestScenario::new("find");
268+
let option: Vec<_> = "-files0-from xyz.nonexistentFile"
269+
.split(' ')
270+
.collect::<Vec<_>>();
271+
267272
#[cfg(unix)]
268273
{
269-
Command::cargo_bin("find")
270-
.expect("found binary")
271-
.args(["-files0-from", "xyz.nonexistentFile"])
272-
.assert()
273-
.failure()
274-
.stderr(predicate::str::contains("No such file or directory"))
275-
.stdout(predicate::str::is_empty());
274+
scene
275+
.ucmd()
276+
.args(&option)
277+
.fails_with_code(1)
278+
.stderr_contains("No such file or directory")
279+
.no_stdout();
276280
}
277281
#[cfg(windows)]
278282
{
279-
Command::cargo_bin("find")
280-
.expect("found binary")
281-
.args(["-files0-from", "xyz.nonexistantFile"])
282-
.assert()
283-
.failure()
284-
.stderr(predicate::str::contains(
285-
"The system cannot find the file specified.",
286-
))
287-
.stdout(predicate::str::is_empty());
283+
scene
284+
.ucmd()
285+
.args(&option)
286+
.fails_with_code(1)
287+
.stderr_contains("The system cannot find the file specified.")
288+
.no_stdout();
288289
}
289290
}
290291

0 commit comments

Comments
 (0)