in reply to Re^6: Lessons learned from getting to 100% with Devel::Cover
in thread Lessons learned from getting to 100% with Devel::Cover
The idea here is to test whether EXPR ever actually becomes false — and particularly whether it becomes false on the input for which you expected it to do so. The question your test is asking is “assuming known bad input, will the program actually blow up as it should?” The alternative is that it will silently continue running with bad data.
You should always check that your program not only works correctly with correct input, but also that it blows up where it should. If you wrote a square root function, the tests should not only check that you get 2 when you pass 4, but also that you get an exception when you pass -1 (unless we're talking complex numbers, but let's not take the example too far). It would be disastrous if you go into production with a square root function that happily produces a result (from among the set of real numbers, anyway) when passed -1.
Makeshifts last the longest.
|
|---|