Crate assert_call
source ·Expand description
A tool for testing that ensures code parts are called as expected.
By creating an instance of CallRecorder
,
it starts recording the calls to call
, and then CallRecorder::verify
verifies that the calls to call
are as expected.
The pattern of expected calls specified in CallRecorder::verify
uses Call
.
§Examples
ⓘ
use assert_call::{call, CallRecorder};
let mut c = CallRecorder::new();
call!("1");
call!("2");
c.verify(["1", "3"]);
The above code panics and outputs the following message
because the call to call
macro is different from what is specified in CallRecorder::verify
.
actual calls :
1
* 2
(end)
mismatch call
src\lib.rs:10
actual : 2
expect : 3
Modules§
Macros§
- Record the call.
Structs§
- Records and verifies calls to
call
.
Enums§
- Pattern of expected
call
calls.
Traits§
- Types convertible to
Call
.