-
Notifications
You must be signed in to change notification settings - Fork 59
/
mock_nonpub.rs
38 lines (33 loc) · 1.26 KB
/
mock_nonpub.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// vim: tw=80
//! methods can use non-public types, as long as the object's visibility is
//! compatible.
#![deny(warnings)]
#![allow(dead_code)]
use mockall::*;
mod outer {
struct SuperT();
trait SuperTrait {}
mod inner {
use super::super::mock;
pub(crate) struct PubCrateT();
struct PrivT();
mock! {
Foo {
fn foo(&self, x: PubCrateT) -> PubCrateT;
fn bar(&self, x: PrivT) -> PrivT;
fn baz(&self, x: super::SuperT) -> super::SuperT;
fn refbaz(&self, x: super::SuperT) -> &super::SuperT;
fn refmutbaz(&mut self, x: super::SuperT) -> &mut super::SuperT;
fn staticbaz(x: super::SuperT) -> super::SuperT;
fn bang(&self, x: crate::outer::SuperT) -> crate::outer::SuperT;
fn bean(&self, x: self::PrivT) -> self::PrivT;
fn goo<T: super::SuperTrait + 'static>(t: T);
fn goo_wc<T>(t: T) where T: super::SuperTrait + 'static;
fn boob<F: Fn(u32) -> super::SuperT + 'static>(&self, f: F)
-> u32;
fn boobwc<F>(&self, f: F) -> u32
where F: Fn(u32) -> super::SuperT + 'static;
}
}
}
}