You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is that your source code no longer has to be changed. You don't test your source-code, you test a modified copy that allows mocking.
How so?
All modules imported via mockImport get read in, modified as they would be in mocker.nim (so that the exported procs get the mockable pragma attached) and that modified copy gets written to "testDirectory".
You then import that modified copy in the test.
All modules imported via testImport get read in, modified in the sense that their imports no longer point to the source code, but instead to the modified copies and that modified testImport-ed module gets also written to "testDirectory".
You then import that modified copy in the test.
Tests get written for the procs of the testImport-ed module. This means you are no longer actually testing source-code, but near identical code, that should be similar enough.
If that isn't good enough for the user though, they can instead just use mockable themselves in their source code and work with that.
The text was updated successfully, but these errors were encountered:
The idea is that your source code no longer has to be changed. You don't test your source-code, you test a modified copy that allows mocking.
How so?
All modules imported via
mockImport
get read in, modified as they would be inmocker.nim
(so that the exported procs get the mockable pragma attached) and that modified copy gets written to "testDirectory".You then import that modified copy in the test.
All modules imported via
testImport
get read in, modified in the sense that their imports no longer point to the source code, but instead to the modified copies and that modifiedtestImport
-ed module gets also written to "testDirectory".You then import that modified copy in the test.
Tests get written for the procs of the testImport-ed module. This means you are no longer actually testing source-code, but near identical code, that should be similar enough.
If that isn't good enough for the user though, they can instead just use mockable themselves in their source code and work with that.
The text was updated successfully, but these errors were encountered: