3 ms·
Not sure about the other issues, but I believe this one is easily solved: > Mocking modules without having a build mess with oasis OCaml has parametrized modu
by vog 11y ago
Not sure about the other issues, but I believe this one is easily solved:
> Mocking modules without having a build mess with oasis
OCaml has parametrized modules (aka "functors"), which provide a very clean solution, compared to mocking whole modules anyway.
As a side note, I usually see mocking being used to test badly structured code. Refactoring that is usually a benefit for testing as well as a benefit for the code itself.
- mackwic 11y agoYou can't reasonably use functors of all your code dependencies (function arguments mostly). I am amazed to see how the MirageOS team used this, but this method cannot be used for all the code. > As a side note, I usually see mocking being used to test badly structured code. You could want to mock just because you are inspecting particular stack frames in a specific call stack, trying to reproduce a bug. It happens.