Monkey Patching in D
Dicebot
m.strashun at gmail.com
Fri Jun 7 03:24:49 PDT 2013
On Wednesday, 5 June 2013 at 13:19:33 UTC, Peter Lundgren wrote:
> The problem I'm trying to solve (and maybe this isn't as
> important as I think) is that DMocks or deject + DMocks only
> works on a subset of the language. I can't mock out free
> function calls, private or final methods, or functions on
> structs or unions (can I inject mocked structs using deject?).
As I have mentioned in reddit comment to that presentation, you
kind of can achieve same dependency substitution by generating
whole mock modules and changing root import path via flag for
test run. As module is minimal D unit of encapsulation, that is
even more natural.
However, I don't know if it is possible to somehow get dependency
list automatically in such model. Probably by grep'ing linker
errors and doing demangling?
More information about the Digitalmars-d
mailing list