On 4/30/12, Jonathan M Davis <jmdavisp...@gmx.com> wrote: > On Sunday, April 29, 2012 21:56:08 H. S. Teoh wrote: >> I wonder if dmd (or rdmd) should have a mode where it *only* compiles >> unittest code (i.e., no main() -- the resulting exe just runs unittests >> and nothing else).
For RDMD you can do: version(unittest) { } else void main() { // regular code here } And then you can invoke rdmd with --unittest and --main to insert an empty main function when unittesting. Personally I put in a stub main so I don't depend on rdmd features like --main: version(unittest) { void main(string[] args) { } } // stub main else void main() { // regular code here }