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() => boolcode() => Result(T, E)
Try success/failure:
assert_status_success!(a)≈ a.status().success() = true``assert_status_success_false!(a)≈ a.status().success() = false``assert_status_failure!(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_
status_ code_ value_ eq - Assert a status code value is equal to another.
- assert_
status_ code_ value_ eq_ x - Assert a status code value is equal to an expression.
- assert_
status_ code_ value_ ge - Assert a status code value is greater than or equal to another.
- assert_
status_ code_ value_ ge_ x - Assert a status code value is greater than or equal to an expression.
- assert_
status_ code_ value_ gt - Assert a status code value is greater than another.
- assert_
status_ code_ value_ gt_ x - Assert a status code value is greater than an expression.
- assert_
status_ code_ value_ le - Assert a status code value is less than or equal to another.
- assert_
status_ code_ value_ le_ x - Assert a status code value is less than or equal to an expression.
- assert_
status_ code_ value_ lt - Assert a status code value is less than another.
- assert_
status_ code_ value_ lt_ x - Assert a status code value is less than an expression.
- assert_
status_ code_ value_ ne - Assert a status code value is not equal to another.
- assert_
status_ code_ value_ ne_ x - Assert a status code value is not equal to another.
- assert_
status_ failure - Assert a status is a failure.
- assert_
status_ success - Assert a status is a success.
- assert_
status_ success_ false - Assert a status is a failure.