Expand description
An assertion utility focused on unit testing.
This library provides the variant of assertion macros that does not panic and continues test cases whenever assertions are passed or not.
§Example
use expected::{expected, expect};
let name = "Alice";
let age = 14;
let ((), disappoints) = expected(|| {
expect!(name == "Alice");
expect!(age == 18);
// ...
});
if let Some(disappoints) = disappoints {
eprintln!("{}", disappoints);
}
!
Macros§
- expect
- Declare an expectation that the specified conditional expression is true.
- expect_
eq - Declare an expectation that the specified values are equal.
Structs§
- Disappoint
- A struct providing information about a disappointing expectation.
- Disappoints
- A set of
Disappoint
s occurred during an execution ofexpected
. - Expected
- A future for the
expected
method.
Traits§
- Future
Expected Ext - An extension trait for
Future
s that provides an adaptor for tracking that all expectations are satisfied.
Functions§
- expected
- Run the provided closure and checks to see if all expectation have been satisfied.