3 ms·
> To the extent there is an exception, testing-only code may be. Testing-only code has very different constraints than production code anyhow. Even then, though
by epage 2y ago
> To the extent there is an exception, testing-only code may be. Testing-only code has very different constraints than production code anyhow. Even then, though, I still find that refactoring problem arises, and test code needs to be refactorable too.
For me, I avoid defining anything within a function except when that thing being defined is what is being tested in a test, e.g. https://github.com/clap-rs/clap/blob/87647d268c8c27e3298b2c08ad6a8e189953df01/tests/derive/flatten.rs#L19-L39 https://github.com/clap-rs/clap/blob/87647d268c8c27e3298b2c0...