nrxus / faux

Struct mocking library for Rust
https://nrxus.github.io/faux/
MIT License
411 stars 14 forks source link

Support imply blocks in other files #49

Closed oersted closed 1 year ago

oersted commented 1 year ago

When a struct has complex functionality, it is not uncommon to have multiple impl blocks in multiple files to avoid having large files.

Currently #[faux::methods] fails to compile with unresolved import super, since it assumes that the faux struct will be directly in the same module (file) rather than a parent module.

nrxus commented 1 year ago

Hey @oersted , this may be too hidden in the docs but have you looked at: https://docs.rs/faux/latest/faux/attr.methods.html#path

It allows you to specify the path to the struct you are trying to mock. Please let me know if this helps you. I can try to make a larger example to show how it works if that's helpful (:

nrxus commented 1 year ago

@oersted are you still having an issue with mocking structs from separate modules?

oersted commented 1 year ago

Apologies for the late reply, this is exactly what I needed, thank you.