digitalmars.D.learn - Handling unittests that are designed to fail
- Joseph Rushton Wakeling (7/7) Jun 05 2013 Hi all,
- Johannes Pfau (4/16) Jun 05 2013 http://dlang.org/phobos/std_exception.html
- bearophile (5/11) Jun 05 2013 For the exceptions take a look here:
- Joseph Rushton Wakeling (2/2) Jun 05 2013 Thanks to both of you :-) In the end I decided to go with collectExcept...
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
Jun 05 2013
Am Wed, 05 Jun 2013 14:31:58 +0200 schrieb Joseph Rushton Wakeling <joseph.wakeling 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, -- Joehttp://dlang.org/phobos/std_exception.html assertThrown and maybe collectException
Jun 05 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: Bye, bearophile
Jun 05 2013
Thanks to both of you :-) In the end I decided to go with collectExceptionMsg as this allows a very precise unittest.
Jun 05 2013