How can one reliably run unittests

Dennis dkorpel at gmail.com
Sat Sep 11 21:23:07 UTC 2021


On Thursday, 26 August 2021 at 09:38:54 UTC, deadalnix wrote:
> On Wednesday, 25 August 2021 at 20:49:32 UTC, Walter Bright 
> wrote:
>>
>> This is indeed a real problem. It was solved with the -main 
>> switch to dmd, which will just stick one in for you. I use it 
>> all the time for unit testing modules.
>
> No it wasn't, because it add a main no matter what, which means 
> that when there is a main in the module being tested, you get a 
> link error.

Good news: this is now fixed!

https://github.com/dlang/dmd/pull/13057

Grab a 
[nightly](https://github.com/dlang/dmd/releases/tag/nightly) and 
try out: `dmd -unittest -main -run`


More information about the Digitalmars-d mailing list