>From what I'm seeing here so far, I think the approach from Vindaar looks like 
>the one that seems to make the most sense. When you unit-test a proc, you'd 
>want to be able to test various scenarios, that kind of makes being able to 
>hotswap proc-definitions at runtime mandatory.

I wonder how C properly deals with it as the most prominent procedural 
language. Sadly I know next to nothing about C, so the articles 
(<http://locklessinc.com/articles/mocking/> ) and libs (CMock) I've found are 
only partially legible to me. What I understand from them though is that 
mocking procs like that appears to be non-trivial, especially if you don't want 
to have to change your source-code just to be able to run tests.

Besides Vindaar's suggestion, the only thing I can think of is putting all 
imports behind some kind of compile-time flag so you can modify said import 
paths to take the modules from a directory where you define "mock"-modules 
instead of their actual place.

Reply via email to