On Wednesday, June 05, 2013 04:18:34 Peter Lundgren wrote: > I'm interested in trying to write a monkey patching* library in > D. Specifically, aiming to support mocks and stubs for unit > testing. > > I have a couple of questions: > > 1) What prior art is there here? I am aware of DMocks (does this > project still need a maintainer?). > 2) How crazy am I for even thinking this is a good idea? Are > there any obviously better alternatives. > > * I'm not sure if there is well defined terminology here > (especially applying these ideas to compiled languages). To > clarify, when I say monkey patch, I mean to intercept a function > or method call at run-time. I believe, in the case of D, this > would require self modifying code using techniques like those > used here: > http://www.yosefk.com/blog/machine-code-monkey-patching.html
If you haven't watched it yet, you should watch this talk from dconf. It's specifically about stuff like mock testing in D. http://www.youtube.com/watch?v=V98Z11V7kEY - Jonathan M Davis
