Named unittests

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 18 14:58:36 UTC 2019


On 5/18/19 6:49 AM, H. S. Teoh wrote:
> One useful pattern that we could consider, that I've developed over
> time, is to have the compiler compile*two*  executables for the same
> code, one with unittests (with no main()) and the other without (and
> with main()). My build script runs both in parallel, and automatically
> executes the unittest executable as part of the build. If a unittest
> fails, the build aborts with an error. Otherwise, it deletes the
> unittest executable, leaving the "real" one ready to run.

This is very nice, and very close do being doable today with scripting 
without modifying the codebase being built. What's needed is that main 
is not run after unittesting.


More information about the Digitalmars-d mailing list