Unittests and windows application

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 26 03:50:04 PDT 2015


On Thursday, 26 March 2015 at 10:23:58 UTC, Stefan wrote:
> I am currently porting a D1 application to D2. I am trying to 
> take advantage of new language features but mostly of the "new" 
> standard library features.
> The old application has several unit tests and I would like to 
> have them executed to secure that everything works as expected.
>
> The problem with the unit tests is that they will be executed 
> but I can not see the results because errors will be written to 
> console output which is not available in a windows application.

That's a bug. You'll notice that if an exception is thrown in 
main() (or anything called from it), you'll get a MessageBox for 
GUI applications. That this doesn't also occur with unittest 
failures is a bug.

For now, you can work around this by writing your own WinMain, 
which calls rt_runModuleUnitTests explicitly, inside a try/catch 
block which will then display a MessageBox.


More information about the Digitalmars-d mailing list