qur / withmock

Automatic Go package mock generation tool
Other
71 stars 9 forks source link

Dependencies don't use mocked packages #11

Closed qur closed 10 years ago

qur commented 10 years ago

If the code under test uses packages x and y, and we enable mocking for x then y will still use the unmocked version of x. This then means that we can't pass values of types from x to y, as y's x is actually a completely different thing.

If we mock a package used by the code under test, then we need to make sure that all packages in the dependency chain use the mocked version of the package if we want to be able to freely pass values around between packages.

We may have to say that this will only be able to work if both x and y are mocked. Otherwise we may actually unravel everything pulling on this thread ... :(

qur commented 10 years ago

This has been fixed by the changes to implement runtime control of mocking.