How can one reliably run unittests

Walter Bright newshound2 at digitalmars.com
Wed Aug 25 22:44:40 UTC 2021


On 8/25/2021 2:05 PM, Paul Backus wrote:
> The problem with -main is that it's too blunt an instrument: it will add a main 
> function whether the code you're compiling already has one or not. That means 
> you have to keep track of which modules have main functions and which ones 
> don't, so that you (or more realistically, your build system) can add -main only 
> when it's necessary.

That problem has never occurred to me, and has never happened to me, yet I use 
-main all the time.

One way to resolve it is just put your main() in a separate module.


More information about the Digitalmars-d mailing list