[dmd-internals] changeset 455

Walter Bright walter at digitalmars.com
Mon May 3 14:23:30 PDT 2010



Sean Kelly wrote:
> On May 3, 2010, at 1:45 PM, Walter Bright wrote:
>   
>> Sean Kelly wrote:
>>
>>     
>>>  I tried modifying the unit testing code to eat the exception and continue, but then it simply prints:
>>>
>>>    test.d(9): unittest 1
>>>    test.d(10): unittest 2
>>>
>>> So the best we can currently do is move on to test another module--there's no way to execute the remaining unit tests within the module.  Could we perhaps have an array of unittests within the ModuleInfo struct instead of just a single function pointer?  Or is the rationale really that if implementation code throws, the app should assume it's in an invalid state and exit?
>>>  
>>>       
>> It's simpler than that. The idea is if an assert fails within a unittest block, the unittests should continue. If an assert fails outside, then the app should stop.
>>     
>
> So let's say I'm doing boundary testing for code that has 'in' contracts.  I guess if I want to test that it rejects out of range values then I should explicitly catch the AssertError?
>
>   

I'd say yes, though note that the d_assertm() function cannot return, as 
the code gen for it assumes it never does.


More information about the dmd-internals mailing list