Does D have too many features?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Apr 29 23:01:59 PDT 2012
On Monday, April 30, 2012 07:46:48 Andrej Mitrovic wrote:
> 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
> }
Yes, but that still compiles everything. It just gives you a convenient way to
have a unit test executable separate from your normal executable.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list