Unimock (docs) is a trait mocking library. Its defining feature is that all generated mock implementations are implemented for the same type (Unimock
). This design allows using a mock object where the type of the generic value is constrained by several trait bounds at the same time (e.g. T: Foo + Bar
).
Other features:
- Declarative verification of calls up front (executed at
Drop
-time) - Argument matching through pattern matching or
Eq
- Partial mocking (though this needs to be manually integrated with some "canonical implementation")
- Versatile support for different types of return values, including borrowed values
- Largely implemented via generics, the macro expansions keep the size of generated code to an absolute minimum
- Safe Rust™