Parallel execution of unittests

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 08:54:40 PDT 2014


Andrei Alexandrescu:

> A coworker mentioned the idea that unittests could be run in 
> parallel

In D we have strong purity to make more safe to run code in 
parallel:

pure unittest {}


> We've resisted named unittests but I think there's enough
> evidence to make the change.

Yes, the optional name for unittests is an improvement:

unittest {}
unittest foo {}

I am very glad your coworker find such usability problems :-)


> We could do it the non-backward-compatible way by
> redefining -unittest to instruct the compiler to not run main.

Good.

I'd also like some built-in way (or partially built-in) to use a 
module only as "main module" (to run its demos) or as module to 
be imported. This problem is solved in Python with the "if 
__name__ == "__main__":" idiom.

Bye,
bearophile


More information about the Digitalmars-d mailing list