Should unittests run as logical part of compilation?

Dicebot public at dicebot.lv
Sun Jan 26 03:32:20 PST 2014


On Sunday, 26 January 2014 at 11:25:25 UTC, simendsjo wrote:
> On Saturday, 25 January 2014 at 22:55:33 UTC, Andrei 
> Alexandrescu wrote:
>> There's this simple realization that unittests could (should?) 
>> be considered an intrinsic part of the build process.
> (...)
>
>> In particular, this view of unittests declares our current 
>> stance on running unittests ("run unittests just before 
>> main()") as meaningless.
> (...)
>
> I wouldn't mind having unittests be a part of the compilation 
> process, but I really don't think "running before main" is 
> useless.
> This lets me compile a version on my desktop and push the 
> binary to a small VPS staging for running runtime tests. 
> Compiling any non-trivial code on 512MB with the DMD frontend 
> is impossible. I can also send a fully working application with 
> unittests to a client as a beta before giving a production 
> version.

I simply think that "-unittest" should not emit any existing 
"main" function by default (only stub one if --main is set) and 
other than that we are pretty good at current stage. Running 
tests is necessary part of build system indeed but dmd is not a 
build system and should not force any assumptions about it.

Initial idea to make tests always run before the program starts 
does not work though, that is true. But currently we have enough 
tools to do it in any way specific project needs.


More information about the Digitalmars-d mailing list