Throwaway types in tests

For some unit tests, I find it advantageous to define various types which mimic some interface I want to test, and possibly provide additional functionality useful for debugging (eg a callable struct in place of a function, which collects the arguments it was called with).

However, since types are global (within a module), my namespace gets very rich quickly (which I don’t like as a matter of principle for unit tests), and when I am working on the tests interactively, redefinition is problematic.

What’s the most convenient workflow at the moment for this? Should I write a submodule for each type?

2 Likes