Handling unittests that are designed to fail

Johannes Pfau nospam at example.com
Wed Jun 5 05:48:29 PDT 2013


Am Wed, 05 Jun 2013 14:31:58 +0200
schrieb Joseph Rushton Wakeling <joseph.wakeling at webdrake.net>:

> Hi all,
> 
> I'd like to design a unittest that will fail -- that is, it will
> trigger an assert() or enforce() failure inside the function it is
> testing.
> 
> How would I go about doing this so that the unittest {} block will
> confirm the failure and count this as a "pass"?
> 
> Thanks & best wishes,
> 
>     -- Joe

http://dlang.org/phobos/std_exception.html

assertThrown and maybe collectException 


More information about the Digitalmars-d-learn mailing list