Handling unittests that are designed to fail

bearophile bearophileHUGS at lycos.com
Wed Jun 5 05:54:46 PDT 2013


Joseph Rushton Wakeling:

> 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"?

For the exceptions take a look here:
http://dlang.org/phobos/std_exception.html#.assertThrown

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list