Simulacrum Macros
These macros ease the creation of mock objects using simulacrum. The objects
created using these macros can be used just like objects created manually with
the simulacrum API.
To install, add this line to your Cargo.toml:
[]
= "0.1.0"
Note that this crate has not yet reached version 1.0, so the API may change drastically between releases.
Examples
This crate contains macros that operate at two levels of abstraction. These examples will show you how to mock this trait:
High-Level Macro
The create_mock! macro does it all for you! Just copy over your interface,
annotate it, and a mock object will be created and your trait impl'd for it.
use *;
create_mock!
See high_level.rs for more examples of how to mock out different types of methods with create_mock!.
Mid-Level Macros
If you need more control than the high-level macro offers, you can use the
create_mock_struct! and was_called! macros to make creating macros a little
bit speedier.
use *;
create_mock_struct!
See mid_level.rs for more examples of how to mock out different types of methods with the Mid-Level Macros.