mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
allow ignoring stdin write errors in tests
* if we want to test an irregular scenario, ignoring errors caused by writing to stdin of the command can be uselful. * for example, when writing some text to stdin of cksum in a scenario where it doesn't consume this input, the child process might have exited before the text was written. therefore, this test sometimes fails with a 'Broken pipe'.
This commit is contained in:
parent
9ae4928b7b
commit
d51ca40986
2 changed files with 31 additions and 7 deletions
|
@ -35,14 +35,19 @@ fn test_empty() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_arg_overrides_stdin() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let input = "foobarfoobar";
|
||||
|
||||
at.touch("a");
|
||||
|
||||
let result = ucmd.arg("a").pipe_in(input.as_bytes()).run();
|
||||
let result = ucmd
|
||||
.arg("a")
|
||||
.pipe_in(input.as_bytes())
|
||||
// the command might have exited before all bytes have been pipe in.
|
||||
// in that case, we don't care about the error (broken pipe)
|
||||
.ignore_stdin_write_error()
|
||||
.run();
|
||||
|
||||
println!("{}, {}", result.stdout, result.stderr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue