Can we get unitests to not run with program start ?

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 26 02:32:53 PDT 2016


On Wednesday, 26 October 2016 at 09:22:23 UTC, pineapple wrote:
> On Wednesday, 26 October 2016 at 08:15:44 UTC, Basile B. wrote:
>> What would be possible is a "-fdmain" switch (force dummy 
>> main). Its role would be: if a functionDeclaration named 
>> "main" is present then this normal "main" is not used 
>> (technically erased from the AST or something like that). Then 
>> acts like "-main".
>
> Just using `-main` has worked well enough for me

For me too but once again I think that the issue is when you wish 
to test functions defined in the module where's main() is 
declared and when the main() content should be skipped. In this 
case stuff like "version(unittest) return 0;" must be added at 
the beginning of the main().


More information about the Digitalmars-d mailing list