Function assert_cli::assert_cli_output_error [] [src]

pub fn assert_cli_output_error<S>(cmd: &str, args: &[S], error_code: Option<i32>, expected_output: &str) -> Result<OutputBox<Error>> where S: AsRef<OsStr>

Assert a CLI call that fails the expected stderr output and error code.

To test that

bash -c $BLACK_BOX

fails with an exit code of 42 after printing this to stderr

error no 42!

you would call it like this:

assert_cli::assert_cli_output_error("bash", &["-c", BLACK_BOX], Some(42), "error no 42!");