Subject: | Test::TestCoverage test_coverage_except() method not working correctly |
Date: | Wed, 27 Aug 2008 17:30:24 +0100 |
To: | "'bug-Test-TestCoverage [...] rt.cpan.org'" <bug-Test-TestCoverage [...] rt.cpan.org> |
From: | Anthony Gladdish <A.J.Gladdish [...] newcastle.ac.uk> |
Hi,
- Test-TestCoverage-0.06
- perl, v5.8.8 built for i686-linux
- Linux 2.6.17-1.2142_FC4 #1 Tue Jul 11 22:41:14 EDT 2006 i686 i686 i386 GNU/Linux
The following test script demonstrates:
use strict;
use warnings;
use Test::More tests => 2;
use FindBin ();
use lib "$FindBin::Bin";
BEGIN { use_ok('Test::TestCoverage') };
test_coverage('TestCoverage::MyTestModule');
my @subs = (
'methode',
);
test_coverage_except('TestCoverage::MyTestModule', @subs);
TestCoverage::MyTestModule::test();
ok_test_coverage('TestCoverage::MyTestModule', 'test coverage ok');
My patch:
diff -c ./lib/Test/TestCoverage.pm.orig ./lib/Test/TestCoverage.pm*** ./lib/Test/TestCoverage.pm.orig 2007-07-24 11:01:12.000000000 +0100
--- ./lib/Test/TestCoverage.pm 2008-08-27 16:36:01.000000000 +0100
***************
*** 50,62 ****
}
sub test_coverage_except{
! my ($self,$package,@subroutines) = @_;
!
for my $subname(@subroutines){
if(exists $invokes->{$package} and
exists $invokes->{$package}->{$subname} and
exists $self->{subs}->{$package}){
! @{$self->{subs}->{$package}} = grep{$_ ne $subname}@{$self->{subs}->{$package}};
delete $invokes->{$package}->{$subname};
}
}
--- 50,61 ----
}
sub test_coverage_except{
! my($package,@subroutines) = @_;
for my $subname(@subroutines){
if(exists $invokes->{$package} and
exists $invokes->{$package}->{$subname} and
exists $self->{subs}->{$package}){
! @{$self->{subs}->{$package}} = grep{$_->[0] ne $subname}@{$self->{subs}->{$package}};
delete $invokes->{$package}->{$subname};
}
}
The manifest will require updating.
What are your thoughts/feedback on this?
Many thanks,
Anthony