Should unittests run as logical part of compilation?

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Jan 25 21:15:25 PST 2014


On Sun, Jan 26, 2014 at 04:29:10AM +0000, Rikki Cattermole wrote:
> On Saturday, 25 January 2014 at 22:55:33 UTC, Andrei Alexandrescu
> wrote:
[...]
> >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.

+1. Some of my unittests can only be run at runtime: like testing file
I/O.  Obviously, other unittests can also be run at compile-time, so
it's useful to have both.


T

-- 
Кто везде - тот нигде.


More information about the Digitalmars-d mailing list