About unittest, test runners and assert libraries

Zardoz luis.panadero at gmail.com
Wed May 12 22:20:18 UTC 2021


On Wednesday, 12 May 2021 at 21:23:08 UTC, Andre Pany wrote:
> On Wednesday, 12 May 2021 at 18:52:13 UTC, Zardoz wrote:
>> [...]
>
> You need to add to dub.json a configuration with name 
> "unittest". Within this configuration you set "mainSourceFile" 
> to "apptest.d" and you need to exclude you module containing 
> the productive main function.
>
> In apptest.d you add a main function and call the dunit_main 
> function.
>
> Dub test will cause the right compiler flags to have unittests 
> included into your executable. By just using dub run, your 
> executable likely does not have the unittests.
>
> Kind regards
> Andre

Thanks! I manage to get it working.


More information about the Digitalmars-d mailing list