Does D have too many features?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Apr 29 22:46:48 PDT 2012


On 4/30/12, Jonathan M Davis <jmdavisProg at 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
}


More information about the Digitalmars-d mailing list