www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - unittest version

reply "Dr Dang" <nospam yahoo.com> writes:
Is there a specific version identifier that is set automatically when you 
specify the "-unittest" on the compiler comand-line?

Basically I want to do something like this ...

version(UNITTEST) {
    import junk.stuff;
}
void main() {
...
}
unittest {
    // uses junk.stuff module
}

This is so that the module junk.stuff is imported only if "-unittest" option 
was given. I know that I can certain give "-version=UNITTEST" option. But I 
was hoping that just giving "-unittest" option should turn on some "version" 
identifier.

--Dang
Jul 12 2007
next sibling parent Sean Kelly <sean f4.ca> writes:
Dr Dang wrote:
 Is there a specific version identifier that is set automatically when you 
 specify the "-unittest" on the compiler comand-line?
No. Tango uses the "UnitTest" debug flag internally for this purpose. Sean
Jul 12 2007
prev sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Dr Dang wrote:
 Is there a specific version identifier that is set automatically when you 
 specify the "-unittest" on the compiler comand-line?
 
 Basically I want to do something like this ...
 
 version(UNITTEST) {
     import junk.stuff;
 }
 void main() {
 ...
 }
 unittest {
     // uses junk.stuff module
 }
 
 This is so that the module junk.stuff is imported only if "-unittest" option 
 was given. I know that I can certain give "-version=UNITTEST" option. But I 
 was hoping that just giving "-unittest" option should turn on some "version" 
 identifier.
 
 --Dang
Nope the feature gets asked for every so often though. There's an enh filed for it: http://d.puremagic.com/issues/show_bug.cgi?id=458 --bb
Jul 12 2007