Can I do an or in a version block?

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 13 11:18:45 PDT 2012


On Tuesday, March 13, 2012 15:04:09 Ary Manzana wrote:
> How can you re-run just a failing test? (without having to run all the
> previous tests that will succeed?)

You can't, not without essentially creating your own unit testing framework. 
D's unit testing framework is quite simple. If you compile with -unittest, 
then the unittest blocks are all run before main is run. If any unittest block 
in a module fails, then no further unittest blocks in that module are run 
(though unittest blocks in other modules are run). If any unittest block 
failed, then main is never run, otherwise the program continues normally.

There is no way to rerun specific unit tests or have any control whatsoever 
which unit tests run unless you create separate programs which only compile in 
specific modules so that only the unit tests in those modules are run. And even 
then, you have no control over _which_ tests in a unittest block run unless 
you play with version statements or whatnot.

D's unit testing framework works quite well as long as you're willing to 
always run all of the tests. If you want more control than that, you have to 
play games if not outright create your own unit testing framework.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list