As I've been increasing the test coverage of XML::RSS, something has occured to me. Let's suppose we have the following pseaudo-code:
<<<<<< sub func1 { my ($self, @params) = @_; . . . if (COND) { $self->do_something(...); } . . . } sub func2 { my ($self, @params) = @_; . . . if (COND) { $self->do_something(...); } . . . } >>>>>>>>> Now, in order to achieve full test coverage we need to cover both (identical) conditional in func1 as well as func2. However, after we refactor the code to extract the conditional, we get the following code: <<<<<<<<<< sub handle_cond { my ($self, ...) = @_; if (COND) { $self->do_something(...); } } sub func1 { my ($self, @params) = @_; . . . $self->handle_cond(...); . . . } sub func2 { my ($self, @params) = @_; . . . $self->handle_cond(...); . . . } >>>>>>>>>> Now we only have to cover the outcomes of the condition in only one function. (or two different outcomes in different functions). So our test coverage is not as comprehensive as the previous one. This is naturally a limitation of test coverage in general which only checks coverage for individual code atoms, and not for all the different paths of execution (their Cartesian products). Right now an ad-hoc solution is to make sure that one has a good test coverage before one refactors the code. But I think the philosophical problem is also interesting. Regards, Shlomi Fish --------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Homepage: http://www.shlomifish.org/ Chuck Norris wrote a complete Perl 6 implementation in a day but then destroyed all evidence with his bare hands, so no one will know his secrets.