assertables

Module assert_command

source
Expand description

Assert for comparing commands and their stdout & stderr.

These macros help with calling external commands, then capturing the standard output stream and standard error stream.

These macros have corresponding the macros in the module assert_program_args.

§Command standard output

Compare command standard output to another command standard output:

Compare command standard output to an expression:

Assert command standard output as a string:

§Command standard error

Compare command standard error to another command standard error:

Compare command standard error to an expression:

Assert standard error as a string:

§Example

use assertables::*;
use std::process::Command;

let mut a = Command::new("bin/printf-stdout");
a.args(["%s", "alfa"]);
let mut b = Command::new("bin/printf-stdout");
b.args(["%s%s%s%s", "a", "l", "f", "a"]);
assert_command_stdout_eq2!(a, b);

Modules§