On 2017-01-20 15:22, Adam D. Ruppe wrote:

I'd suggest writing a new assert handler for your framework that does
something different, then you can get a bit more control over it.

Unfortunately setting a new assert handler requires it to be nothrow [1]. I would most likely want it to be throw an exception instead of an error to bail out of the current test, but continue with the rest of the tests.

Sure, it's possible to use a completely different than "assert", but that feels quite a shame when we have a built-in keyword for this purpose.

Though, the built in assert is underpowered regardless... oh, how I wish
it even had the convenience of C's assert, but I really want it to go a
step further and show the values as well as the code that is failing.

int a = 0;
int b = 1;
assert(a == b);

Assertion `a == b` failed: test.d(3)
 a = 0
 b = 1

AST macros :)

[1] http://dlang.org/phobos/core_exception.html#.AssertHandler

--
/Jacob Carlborg

Reply via email to