autospy
A test spy object library.
Overview
Spies are a type of test double used for unit testing software. A test spy is an object providing the same interface as the production code, but which allows setting of the output before a test runs and verification of input parameters after the test run.
Usage
Spy objects are often only used by unit tests, the example below demonstrates use in a unit test.
use autospy;
Acknowledgements
Autospy is heavily influenced by the excellent mockall crate, which through automock provides much the same features. Autospy aims to offer these same features through a macro generated spy object, rather than a mock object. The use of either is largely personal preference; however, there are some benefits to using a spy object. Notably, a mock object will panic if its expectations fail which can cause less legible error messages.