Replies: 1 comment
-
What you probably want to do is only generate the mocks in test mode, like this: #[cfg_attr(test, automock)] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm new to rust and new to mockall, so forgive me if this question has a trivial answer.
I've been experimenting with both rust and mockall and created a Rust version of a Go command line utility that I wrote for learning (https://github.com/nerdo/rusty_barnacle if anyone needs a reference).
I used mockall's automock feature to mock a trait and it works well, but when I staretd to experiment with creating rust documentation, I noticed that the mock was showing up.
I realized that putting the mock in the
test
module where I was using it would probably do the trick, and it did, but since the real trait isn't in thetest
module, it involved using themock!
macro instead of theautomock
macro. For this little project, I don't think that is problematic, but for larger projects, it might be cumbersome.Is there any way to get mockall not to document the mocks? Or is there a way to tell it to put the mock in a specific module (e.g. `tests)?
Beta Was this translation helpful? Give feedback.
All reactions