-
Notifications
You must be signed in to change notification settings - Fork 59
/
automock_module_nonpub.rs
45 lines (39 loc) · 1.09 KB
/
automock_module_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
39
40
41
42
43
44
45
// vim: tw=80
//! bare functions can use non-public types, as long as the object's visibility is compatible.
#![deny(warnings)]
#![allow(dead_code)]
mod outer {
struct SuperT();
mod inner {
use mockall::automock;
pub(crate) struct PubCrateT();
struct PrivT();
#[automock]
mod m {
use super::*;
pub(crate) fn foo(_x: PubCrateT) -> PubCrateT {
unimplemented!()
}
pub(super) fn bar(_x: PrivT) -> PrivT {
unimplemented!()
}
pub(in super::super) fn baz(_x: super::super::SuperT)
-> super::super::SuperT
{
unimplemented!()
}
pub(in crate::outer) fn bang(_x: crate::outer::SuperT)
-> crate::outer::SuperT
{
unimplemented!()
}
}
#[test]
fn returning() {
let ctx = mock_m::foo_context();
ctx.expect()
.returning(|x| x);
mock_m::foo(PubCrateT());
}
}
}