in reply to Re^5: Lessons learned from getting to 100% with Devel::Cover
in thread Lessons learned from getting to 100% with Devel::Cover

I don't believe I did, you've just restated the same thing you claimed was not the purpose in a different manner. EXPR logicop die;. Doesn't seem too complicated to me.

--
I'm not belgian but I play one on TV.

Replies are listed 'Best First'.
Re^7: Lessons learned from getting to 100% with Devel::Cover
by Aristotle (Chancellor) on Jul 31, 2004 at 18:18 UTC

    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.

Re^7: Lessons learned from getting to 100% with Devel::Cover
by stvn (Monsignor) on Jul 30, 2004 at 15:48 UTC
    EXPR logicop die;. Doesn't seem too complicated to me.

    It doesn't need to be complicated for you to still test it.

    Besides its less about testing a single line, and more about testing how that single line interacts with all the code that comes before and after that line and how they handles the circumstances which created the error condition.

    -stvn