www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DMD unittest doesn't work when using visual studio with a "Windows"

reply "Ronnie" <mushfaque.chowdhury gmail.com> writes:
Hi

I added some unittests {} code in a small test app. With a

int main(string[] args){
...
}

unittest {
...
}

and dmd -unittest, everything works fine.

If I make a Windows app with a winmain

int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nCmdShow) {
...
}

Then the unittests dont run.

Current work around is for me to static if out the winmain code 
but it's not ideal once I start to test windows specific 
functionality later. Is this just an oversight?

Am running VisualD 0.3.41 and dmd 2.0.67
Jul 03 2015
parent "Babu" <bb.temp gmx.com> writes:
On Friday, 3 July 2015 at 08:59:17 UTC, Ronnie wrote:
 Hi

 I added some unittests {} code in a small test app. With a

 int main(string[] args){
 ...
 }

 unittest {
 ...
 }

 and dmd -unittest, everything works fine.

 If I make a Windows app with a winmain

 int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
 LPSTR lpCmdLine, int nCmdShow) {
 ...
 }

 Then the unittests dont run.

 Current work around is for me to static if out the winmain code 
 but it's not ideal once I start to test windows specific 
 functionality later. Is this just an oversight?

 Am running VisualD 0.3.41 and dmd 2.0.67
You can deactivate the main() when running unittests: --- version(unittest){} else { //main... } ---
Jul 03 2015