How can one reliably run unittests

jfondren julian.fondren at gmail.com
Wed Aug 25 21:19:36 UTC 2021


On Wednesday, 25 August 2021 at 21:17:54 UTC, jfondren wrote:
> On Wednesday, 25 August 2021 at 21:05:42 UTC, Paul Backus wrote:
>> If we had something like -main=ifMissing that added an empty 
>> main function only if the modules being compiled didn't 
>> already have one, then it would be possible to unit-test any D 
>> module with a command line like
>>
>>     dmd -i -unittest -main=ifMissing -run mymodule.d
>>
>> Being able to use the same command for everything makes 
>> automation much easier--you can write it in a makefile rule, 
>> put it in a script, etc.
>
> Although at this point, the -main=ifMissing functionality 
> should just be part of -unittest

Or rather, -unittest -run ? Since you could dmd -c -unittest a 
bunch of modules and then link them together.


More information about the Digitalmars-d mailing list