On 02/08/2011 04:54 PM, Jonathan M Davis wrote:
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 do agree failure cases must be tested (maybe even more) and are very often
neglected by programmers in unittests. But in a no-throw case the proper
assertion is just a regular assert (at least, in my use of unittests):
// dunno the syntax
assertThrown ( 1/0, DivisionByZero );
assert ( 1/1 == 1 );
If 1/1 throws DivisionByZero, I get all the information I need. Reason for my
question mark about including assertNotThrown. When do I need it? What new does
it bring?
Sorry, I should have asked/commented earlier on this point (but had too
much...).
Denis
--
_________________
vita es estrany
spir.wikidot.com