A strict, yet friendly mocking library for Rust 2018
⚠️ This crate requires the nightly compiler
```rust
use mockiato::mockable;
trait Greeter { fn greet(&self, name: &str) -> String; }
mod tests { use super::*;
#[test]
fn greet_the_world() {
let mut greeter = GreeterMock::new();
greeter
.expect_greet(|arg| arg.partial_eq("world"))
.times(1..2)
.returns(String::from("Hello world"));
assert_eq!("Hello world", greeter.greet("world"));
}
} ```
Trait bounds are currently not supported meaning that the supertraits will not be implemented for mocks.
The following traits are always implemented for mocks:
cargo run --example debug
cargo test --example clone
cargo test --example default
An example of how to use downcasting with mockiato can be found in the downcasting
example.
bash
cargo test --features mockiato-codegen/debug-impls