Should unittests run as logical part of compilation?

Rikki Cattermole alphaglosined at gmail.com
Sat Jan 25 20:29:10 PST 2014


On Saturday, 25 January 2014 at 22:55:33 UTC, Andrei Alexandrescu 
wrote:
> ./modulename.d(103): Unittest failed: user-defined message
My idea for pragma(error,) and pragma(warning,) would definately 
be invaluable to doing this without adding this specific 
behaviour. (Really should deal with that.)

> In particular, this view of unittests declares our current 
> stance on running unittests ("run unittests just before 
> main()") as meaningless. Indeed that has bothered me for quite 
> a while - unittests are part of the build/acceptance, not part 
> of every run. To wit, this is a growing idiom in D programs:
Having the ability to run unittests at both compile time and 
runtime would be useful. Because what happens when you need to 
test e.g. an OS feature with it? Or have a dependency that simply 
cannot run at compile time?

I'm all for being able to selectively run unittests and having 
the ability to have some run at compile time.


More information about the Digitalmars-d mailing list