#assert #mocking #call #ensure #parts #called

dev assert-call

A tool for testing that ensures code parts are called as expected

3 releases

Uses new Rust 2024

new 0.1.2 Mar 7, 2025
0.1.1 Feb 15, 2024
0.1.0 Feb 12, 2024

#258 in Testing

Download history 7/week @ 2024-11-20 2/week @ 2024-11-27 2/week @ 2024-12-04 4/week @ 2024-12-11 8/week @ 2025-01-22 10/week @ 2025-01-29 5/week @ 2025-02-05 4/week @ 2025-02-12 14/week @ 2025-02-26 165/week @ 2025-03-05

183 downloads per month
Used in 4 crates

MIT/Apache

24KB
587 lines

asesrt-call

Crates.io Docs.rs Actions Status

A tool for testing that ensures code parts are called as expected.

Example

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!() is different from what is specified in verity().

actual calls :
  1
* 2
  (end)

mismatch call
src\lib.rs:10
actual : 2
expect : 3

License

This project is dual licensed under Apache-2.0/MIT. See the two LICENSE-* files for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.1–7MB
~35K SLoC