Compiler generated assertion error message

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 13:07:50 PDT 2014


On Friday, 20 June 2014 at 20:04:32 UTC, Jacob Carlborg wrote:
> On 2014-06-19 19:52, Dicebot wrote:
>> On a related topic:
>>
>> Feature like this is extremely convenient for unit tests. 
>> However using
>> assertions in unit test blocks does not fit well with any 
>> custom test
>> runner that does not immediately terminate the application 
>> (because
>> AssertionError is an Error).
>
> There's an assert handler in druntime [1], but that expects the 
> implementation to be nothrow, so you cannot throw an exception.

Yes I have already found it. There is also 
https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L447 
but I don't see any way to replace it with user handler.

Anyway some sort of library solution (probably via __traits) is 
much more desired because that will be applicable also to things 
like std.exception.enforce and alike.


More information about the Digitalmars-d mailing list