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 trait with a constructor method
#![deny(warnings)]

use mockall::*;

#[automock]
pub trait A {
    fn new() -> Self;
}

#[test]
fn returning() {
    let ctx = MockA::new_context();
    ctx.expect().returning(MockA::default);
    let _a: MockA = <MockA as A>::new();
}