in reply to Re: Perl Skills
in thread Perl Skills

100% coverage isn't always achievable.

For example I put Carp::confess statements in some of my modules to catch internal errors. When my module works fine, there is simply no way to trigger them. They are dead code.

Still they are very useful, because when I change something and break the module, I get much better error messages than without those statements.

One could try to trigger thee cases by monkey-patching the module to misbehave, but I think that's a rather foolish idea.

Replies are listed 'Best First'.
Re^3: Perl Skills
by Ratazong (Monsignor) on Jun 15, 2010 at 15:45 UTC

    Our way to reach 100% coverage is the following:

    1. we do module-test to cover as near as 100% as possible
    2. if we reach less than 100% (this is the normal case), we analyze/review all parts that were not covered by the test
      • if we discover testing-gaps, we enhance the module test
      • if some code is really not testable, but OK according the analysis/review, we consider it covered
    With that proceeding it is always possible to reach the 100% coverage. And I don't think it is cheating ;-)

    HTH, Rata