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.