DMD: how to restore old unittest+main

Nils Lankila NilsLankila at gmx.us
Thu Aug 13 09:02:28 UTC 2020


On Thursday, 13 August 2020 at 08:49:21 UTC, WebFreak001 wrote:
> On Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote:
>> Hello.
>>
>> I don't use dub.
>> I use Windows and *.d file association to compile small apps 
>> by dmd with "-i -unittest -g" switches.
>> Now i update dmd, and found, that apps compiled with 
>> "-unittest" not runs main().
>>
>> How i can restore old behaviour (run all unittests then main())
>> *without use "--DRT-testmode=run-main" switch every time then 
>> i start compiled app.exe*?
>> I want just press Enter on app.d file, then press Enter on 
>> app.exe.
>> Any advises?
>>
>> Thanks.
>
> Try
>
> version (unittest) extern(C) __gshared string[] rt_options = [ 
> "testmode=run-main" ];

Yeah that works but we should really have a way to do this 
programmatically, in a way it is already, but by calling 
function, not by the bias of a string that get parsed.


More information about the Digitalmars-d-learn mailing list