blob: 88adb8dceefc06a6f97e30f1b847987230793f45 [file] [log] [blame]
// vim: tw=80
//! generic static methods with generic arguments
#![deny(warnings)]
use mockall::*;
use std::sync::Mutex;
lazy_static! {
static ref A_MTX: Mutex<()> = Mutex::new(());
}
#[automock]
trait A {
fn bar<T: 'static>(t: T) -> u32;
}
#[test]
fn returning() {
let _m = A_MTX.lock().unwrap();
let ctx = MockA::bar_context();
ctx.expect::<i16>()
.returning(|_| 42);
assert_eq!(42, MockA::bar(-1i16));
}
#[test]
fn return_const() {
let _m = A_MTX.lock().unwrap();
let ctx = MockA::bar_context();
ctx.expect::<i16>()
.return_const(42u32);
assert_eq!(42, MockA::bar(-1i16));
}