Named unittests

H. S. Teoh hsteoh at quickfur.ath.cx
Sat May 18 15:21:44 UTC 2019


On Sat, May 18, 2019 at 10:58:36AM -0400, Andrei Alexandrescu via Digitalmars-d wrote:
> 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.

This should be pretty easy once we implement --DRT-run-unittests to only
run unittests and skip over main().


T

-- 
If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell


More information about the Digitalmars-d mailing list