default-test-rs
Provides a Rust trait similar to Default that can be used in tests.
Often tests need to construct mock instances of structs. For example:
While it's tempting to define Default, often tests need mock values for types that shouldn't apply in production code. Sometimes, tests need values for types that don't even implement Default.
This crate provides DefaultTest, a trait which can provide default instances with mock values.
Unit tests can then use the spread operator to construct values:
Roadmap:
- Derive macro which fills sensible defaults that would be useful in unit test implementations. String files would be filled with their property name, and other types may use T::default() or unique values.