Expand description
Assert for comparing status concepts.
These macros help with commands, program, processes, and anything else that
provides a method status()
, and optionally status methods such as:
success() => bool
code() => Result(T, E)
Try success/failure:
assert_status_success!(a)
≈ a.status().success() = true``assert_status_success_false!(a)
≈ a.status().success() = false``
Compare a status code with another status code:
assert_status_code_value_eq!(a, b)
≈ a.len() = b.len()assert_status_code_value_ne!(a, b)
≈ a.len() ≠ b.len()assert_status_code_value_lt!(a, b)
≈ a.len() < b.len()assert_status_code_value_le!(a, b)
≈ a.len() ≤ b.len()assert_status_code_value_gt!(a, b)
≈ a.len() > b.len()assert_status_code_value_ge!(a, b)
≈ a.len() ≥ b.len()
Compare a status code with an expression:
assert_status_code_value_eq_x!(a, expr)
≈ a.len() = exprassert_status_code_value_ne_x!(a, expr)
≈ a.len() ≠ exprassert_status_code_value_lt_x!(a, expr)
≈ a.len() < exprassert_status_code_value_le_x!(a, expr)
≈ a.len() ≤ exprassert_status_code_value_gt_x!(a, expr)
≈ a.len() > exprassert_status_code_value_ge_x!(a, expr)
≈ a.len() ≥ expr
§Example
use assertables::*;
use std::process::Command;
let mut a = Command::new("bin/exit-with-arg"); a.arg("1");
let mut b = Command::new("bin/exit-with-arg"); b.arg("1");
assert_status_code_value_eq!(a, b);
Modules§
- Assert a status code value is equal to another.
- Assert a status code value is equal to an expression.
- Assert a status code value is greater than or equal to another.
- Assert a status code value is greater than or equal to an expression.
- Assert a status code value is greater than another.
- Assert a status code value is greater than an expression.
- Assert a status code value is less than or equal to another.
- Assert a status code value is less than or equal to an expression.
- Assert a status code value is less than another.
- Assert a status code value is less than an expression.
- Assert a status code value is not equal to another.
- Assert a status code value is not equal to another.
- Assert a status is a success.
- Assert a status is a failure.