Better unittest failure output

Bahman Movaqar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 7 05:12:13 PDT 2015


On Monday, 7 September 2015 at 12:06:09 UTC, anonymous wrote:
> On Monday 07 September 2015 13:57, Bahman Movaqar wrote:
>>      $ dub test
> [...]
>>      core.exception.AssertError at source/e002.d(111): unittest
>> failure
> [...]
> From that one line I left intact above, you should also be able 
> to figure out that it's the test in source/e002.d, line 111 
> that failed.

True.  That I had already figured out.  I was actually hoping for 
something like Groovy's assert messages[1], if possible.

>> Is there any compiler switch, argument to `assert` or trick to 
>> make `unittest` output more helpful messages when failing?
>
> You can pass a custom message as a second argument to assert:
> assert(condition, "message goes here");

Thanks.  This is indeed helpful.  OT but where can I view the 
documentation for `unittest` and `assert`?

[1] 
http://docs.groovy-lang.org/next/html/documentation/core-testing-guide.html#_power_assertions





More information about the Digitalmars-d-learn mailing list