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:
assert_command_stdout_eq2!(command1, command2)≈ command1 stdout = command2 stdoutassert_command_stdout_ne2!(command1, command2)≈ command1 stdout ≠ command2 stdoutassert_command_stdout_lt2!(command1, command2)≈ command1 stdout < command2 stdoutassert_command_stdout_le2!(command1, command2)≈ command1 stdout ≤ command2 stdoutassert_command_stdout_gt2!(command1, command2)≈ command1 stdout > command2 stdoutassert_command_stdout_ge2!(command1, command2)≈ command1 stdout ≥ command2 stdout
Compare command standard output to an expression:
assert_command_stdout_eq!(command, expr)≈ command stdout = exprassert_command_stdout_ne!(command, expr)≈ command stdout ≠ exprassert_command_stdout_lt!(command, expr)≈ command stdout < exprassert_command_stdout_le!(command, expr)≈ command stdout ≤ exprassert_command_stdout_gt!(command, expr)≈ command stdout > exprassert_command_stdout_ge!(command, expr)≈ command stdout ≥ expr
Assert command standard output as a string:
assert_command_stdout_string_contains!(command, containee)≈ command stdout string contains containeeassert_command_stdout_string_is_match!(command, matcher)≈ command stdout string is a matcher match
§Command standard error
Compare command standard error to another command standard error:
assert_command_stderr_eq2!(command1, command2)≈ command1 stderr = command2 stderrassert_command_stderr_ne2!(command1, command2)≈ command1 stderr ≠ command2 stderrassert_command_stderr_lt2!(command1, command2)≈ command1 stderr < command2 stderrassert_command_stderr_le2!(command1, command2)≈ command1 stderr ≤ command2 stderrassert_command_stderr_gt2!(command1, command2)≈ command1 stderr > command2 stderrassert_command_stderr_ge2!(command1, command2)≈ command1 stderr ≥ command2 stderr
Compare command standard error to an expression:
assert_command_stderr_eq!(command, expr)≈ command stderr = exprassert_command_stderr_ne!(command, expr)≈ command stderr ≠ exprassert_command_stderr_lt!(command, expr)≈ command stderr < exprassert_command_stderr_le!(command, expr)≈ command stderr ≤ exprassert_command_stderr_gt!(command, expr)≈ command stderr > exprassert_command_stderr_ge!(command, expr)≈ command stderr ≥ expr
Assert standard error as a string:
assert_command_stderr_string_contains!(command, containee)≈ command stderr string contains containeeassert_command_stderr_string_is_match!(command, matcher)≈ command stderr string is a matcher match
§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§
- Assert a command stderr string contains a given containee.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string is a match to a regex.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string is equal to an expression.
- Assert a command stderr string is equal to another.
- Assert a command stderr string contains a given containee.
- Assert a command stderr string is a match to a regex.
- Assert a command stdout string contains a given containee.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string is a match to a regex.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string is equal to an expression.
- Assert a command stdout string is equal to another.
- Assert a command stdout string contains a given containee.
- Assert a command stdout string is a match to a regex.