Unit tests in D

Michel Fortin michel.fortin at michelf.com
Wed May 5 04:25:19 PDT 2010


On 2010-05-05 05:10:05 -0400, bearophile <bearophileHUGS at lycos.com> said:

> unittest {
>     assert(throws!(OtherException)(sqr(-5)));
>     assert(throws!(OtherException)( sqr(-5) ));
> }

> While the static throws can require more compiler support.

Can't you do:

	static assert(throws!OtherException(sqrt(-5)));

?

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list