Unit tests in D

bearophile bearophileHUGS at lycos.com
Wed May 5 05:24:31 PDT 2010

Michel Fortin:

> Am I right that what you want is this?
> 	static assert(!__traits(compiles, foo(10)));

I want a nice syntax that statically asserts if foo(10) doesn't statically asserts :-)

What you have written is close (in D1 I have used the is() syntax for a similar purpose), but beside being syntactically ugly, it doesn't specifically detect static asserts inside foo.


More information about the Digitalmars-d mailing list