Helper unit testing functions in Phobos (possible std.unittests)

Nick Sabalausky a at a.a
Sat Nov 6 18:31:19 PDT 2010


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.139.1289084847.21107.digitalmars-d at puremagic.com...
On Saturday 06 November 2010 13:05:13 Jérôme M. Berger wrote:
> spir wrote:
> > On Sat, 6 Nov 2010 01:21:25 -0700
> >
> > Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> >> I believe strongly that a unit test block which has a failure should 
> >> end
> >> excecution. For many such tests, continuing would be utterly pointless,
> >> since each successive test relies on the last.
> >
> > I don't understand. I can have one dozen test cases for each of one 
> > dozen
> > funcs. All 144 tests are independant. I prefere the possibility to see
> > all test errors in one go, if any. Anyway, there may be a flag
> > STOP_AT_FIRST_TEST_ERROR (or the opposite).
>
> In that case, you should have a dozen dozen different test blocks,
> each for a single test case of a single function. Under Jonathan's
> proposal, when a test block fails, it would stop the current *block*
> (i.e. test case) but allow the remaining blocks to be run.


If you have a bunch of independent tests, as I typically do, that's just a 
pain in the ass. Even more of a PITA when there's common setup for each of 
them. I find the non-independent tests to be far less common, anyway. 
Besides, even if a few unnecessary asserts are triggered instead of skipped, 
who the hell cares?

Heck, I went to the bother of creating a unittest library largely just to 
work around the "quit running the tests at the drop of a hat" absurdity.




More information about the Digitalmars-d mailing list