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.


In reply to Re^7: Lessons learned from getting to 100% with Devel::Cover by Aristotle
in thread Lessons learned from getting to 100% with Devel::Cover by leriksen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.