use ridicule::mock;
use ridicule::predicate::{always, eq};
trait Foo
{
fn bar(&self, num: u128, text: &str);
}
mock! {
MockFoo {}
impl Foo for MockFoo
{
fn bar(&self, num: u128, text: &str);
}
}
fn main()
{
let mut mock_foo = MockFoo::new();
unsafe {
mock_foo
.expect_bar()
.with(eq(1234), always())
.returning(|_, num, text| {
println!("bar was called with {num} and '{text}'");
});
}
mock_foo.bar(1234, "Hello");
}