July 03, 2015
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
July 03, 2015
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...
}
---