mockall 0.9.1

A powerful mock object library for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// vim: tw=80
//! A method that returns an immutable reference
#![deny(warnings)]

use mockall::*;

#[automock]
trait A {
    fn foo(&self) -> &u32;
}

#[test]
fn return_const() {
    let mut mock = MockA::new();
    mock.expect_foo().return_const(5);
    assert_eq!(5, *mock.foo());
}