On Wednesday, 25 May 2016 at 21:38:23 UTC, Atila Neves wrote:
There was talk in the forum of making it easier to come up
instantiations of say, an input range for testing purposes.
That got me thinking of how mocking frameworks make it easy to
pass in dependencies without having to write a whole new "test
double" type oneself. How would one do that for what I've
started calling "static interfaces"? How would one mock an
input range?
I have a mocking framework here:
https://github.com/nomad-software/dunit
Maybe that is useful? The only problem with mine is that it needs
to be injected inside an interface. Like this:
interface InputRange(T) {
@property T front();
void popFront();
@property bool empty();
mixin Mockable!(InputRange!(T));
}
auto mock = InputRange.getMock()