Unittests and assert

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Feb 27 21:00:57 PST 2013


On Thursday, 28 February 2013 at 04:58:48 UTC, Andrej Mitrovic 
wrote:
> $ dmd -release -unittest test.d
> $ test.exe
>> core.exception.AssertError at test(6): unittest failure

Btw I think this might be an accident, in mars.c there's this 
code:

     if (global.params.release)
     {   global.params.useInvariants = 0;
         global.params.useIn = 0;
         global.params.useOut = 0;
         global.params.useAssert = 0;  // <-- note
         global.params.useArrayBounds = 1;
         global.params.useSwitchError = 0;
     }

However then it's followed by this code:

     if (global.params.useUnitTests)
         global.params.useAssert = 1;

So it's switched off and then on again. I can't tell if this was 
deliberate or not. If it's on purpose it should be documented.


More information about the Digitalmars-d mailing list