-unittest and main

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Nov 7 21:52:26 PST 2006

Bill Baxter wrote:
> I find it inconvenient that -unittest doesn't automatically supply a 
> main() if there isn't one.  For instance if I just want to test one 
> module of my library I end up going into the code, adding "void 
> main(){}" and then "dmd -unittest -run module" then go back and remove 
> the "void main(){}" line.
> Ideally dmd would just realize that if there's no main and I'm doing 
> -unittest, it should add one for me.
> Second best would be a -main flag that says 'create a trivial main for 
> me' so I could say  "dmd -unittest -main -run module".
> Is there some other way to do this that I'm missing?
> --bb

None that I haven't missed as well.  Some of us have been wanting a feature like your 
'-main' switch for some time now.  (Or at the very least for -unittest to implicitly 
behave this way.)

-- Chris Nicholson-Sauls

More information about the Digitalmars-d-learn mailing list