How can one reliably run unittests

Paul Backus snarwin at gmail.com
Wed Aug 25 21:46:55 UTC 2021


On Wednesday, 25 August 2021 at 21:19:36 UTC, jfondren wrote:
> 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.

Even if we have a rule like "-unittest -run implies 
-main=ifMissing", I think there should still be a separate flag 
for it--for documentation if nothing else.


More information about the Digitalmars-d mailing list