On 6/5/2014 6:31 AM, Bill Baxter via Digitalmars-d-announce wrote:
But when it comes to tests, it's very convenient to just be able to fake any object by slapping some dummy functions in between curly braces. For example if I want a fake "IWidthHaver" instance, I just have to write x = { width: 10 }, and I'm done. Plus I can monkey patch things in tests, replacing whatever method I want with a wrapper that does some custom monitoring before or after calling the real method. Writing tests for C++ is a pain in the butt in comparison.
It's an interesting observation. It is why the functions in Warp are nearly all templates - so I can slap together dummy objects to unittest those functions.