An interesting case. assert_equal seems to be assuming that the == method on the relevant class (IPAddr#== here) does not raise an error, but that should not be taken for granted. It should be wrapped in a rescue block.
An interesting case. assert_equal seems to be assuming that the == method on the relevant class (IPAddr#== here) does not raise an error, but that should not be taken for granted. It should be wrapped in a rescue block.
I disagree, the exception is more useful as an error than just assert_equal returning false.
An interesting case. assert_equal seems to be assuming that the == method on the relevant class (IPAddr#== here) does not raise an error, but that should not be taken for granted. It should be wrapped in a rescue block.
I disagree, the exception is more useful as an error than just assert_equal returning false.
Agreed.
Indeed, the error from IPAddr could be clearer,
Mmm, not quite. Calling == should never raise, so there should not be an error.
After all, test frameworks are for detecting and reporting the test object's bugs. It does not make sense for a test framework to raise an error by itself when the test object has a bug.