std.unittests vote tally
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Feb 8 08:36:27 PST 2011
On 2/8/11 10:54 AM, Jonathan M Davis wrote:
> Enhancement request for assert:
> http://d.puremagic.com/issues/show_bug.cgi?id=5547
Thanks!
> Okay. I'll look at doing another proposal which has the functionality of
> assertPred which doesn't make sense to add to assert, though I'll probably wait
> until the voting for assertNotThrown and collectExceptionMsg is done.
>
> I would point out, however, that it would be rather silly to include
> assertThrown and not assertNotThrown. Good unit tests should test _both_ that a
> function succeeds as it's supposed to _and_ that it fails as it's supposed to.
> So, I would hope that people vote in favor of assertNotThrown.
I think many people would emulate assertNotThrown by simply calling the
function and... well if it throws then the unittest fails.
> collectExceptionMsg isn't as critical, but it really does make it easy to test
> that exception messages are correct, since if you use collectException, you have
> to worry about checking for null before you can check the message. With
> collectExceptionMsg, it can be a an easy one-liner to check exception messages.
> Without it, you end up taking several lines, because you have to save and check
> the exception for null before you can check its message.
>
> I'll wait for the vote on assertNotThrown and collectExceptionMsg to be
> completed before putting assertThrown in Phobos. Then it can just all be taken
> care of at once.
Sounds great. Thanks!
Andrei
More information about the Digitalmars-d
mailing list