Assertables: Rust crate of "assert" macros for testing

The assertables Rust crate provides many "assert" macros to help with compile-time testing and run-time reliability

Crate: https://crates.io/crates/assertables

Docs: https://docs.rs/assertables/

Repo: https://github.com/sixarm/assertables-rust-crate/

Highlights

Naming conventions

Abbreviations:

Shorthands:

Flavors: do you prefer panic! or Err()?

The macros have two flavors:

Example:

Error messages

The macros have a second form where a custom error message can be provided.

Example:

assert_* for values

Compare values.

assertset* for set collection comparisons

These macros help with comparison of set parameters, such as two arrays or two vectors. where the item order does not matter, and the item count does not matter. The macros convert inputs into HashSet iterators.

assertbag* for bag collection comparisons

These macros help with comparison of bag parameters, such as comparison of two arrays or two vectors, where the item order does not matter, and the item count does matter. The macros convert inputs into HashMap iterators.

assertfn* for function return comparisons

assertfnok_* for function Ok() comparisons

assertfnerr_* for function Err() comparisons

assertreadtostring* for std::io::Read comparisons

These macros help with readers, such as file handles, byte arrays, input streams, and the trait std::io::Read.

assertcommand for process command comparisons

Using standard output a.k.a. stdout:

Using standard error a.k.a. stderr:

Tracking