DMD unittest doesn't work when using visual studio with a "Windows" Subsystem and Winmain combination

Babu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 3 02:09:38 PDT 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...
}
---


More information about the Digitalmars-d-learn mailing list