Joel Anderson Wrote:
> 
> You could potentially use a mixin to do this.  The resulting code would 
> look something like this.
> 
> void main()
> {
>            int myFoo = 100;
>            mixin(expectEquals! ( "myFoo == 3" ));
> }

Yeah, mixins could work, but they're ugly.  ;-)

Forcing the user (in this case the unit test writer) to apply extra boilerplate 
on their own every time they want to make an assertion is really not much of a 
solution. There's no semantic reason an assertion should involve a mixin, so 
allowing that detail to bleed into client code is shaky design.

I know I'd get tired of wrapping everything in mixin(...) all the time, and in 
the end it would probably result in me writing fewer unit tests.  :-P

Reply via email to