line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
71518
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
155
|
|
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
2
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
164
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
90
|
|
|
5
|
|
|
|
|
367
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Class::Load; |
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1837
|
use Test::Class; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
121
|
|
|
5
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
3
|
|
7
|
4
|
|
|
4
|
|
24
|
use File::Find; |
|
4
|
|
|
|
|
26
|
|
|
4
|
|
|
|
|
277
|
|
8
|
4
|
|
|
4
|
|
24
|
use File::Spec; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
95
|
|
9
|
4
|
|
|
4
|
|
1702
|
use Module::Runtime 'require_module'; |
|
4
|
|
|
|
|
4082
|
|
|
4
|
|
|
|
|
23
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.50'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Override to get your own filter |
14
|
|
|
|
|
|
|
sub is_test_class { |
15
|
10
|
|
|
10
|
1
|
11
|
my ( $class, $file, $dir ) = @_; |
|
|
|
|
|
1
|
|
|
16
|
|
|
|
|
|
|
# By default, we only care about .pm files |
17
|
10
|
100
|
|
|
|
28
|
if ($file =~ /\.pm$/) { |
|
|
100
|
|
|
|
|
|
18
|
4
|
|
|
|
|
10
|
return 1; |
19
|
|
|
|
|
|
|
} |
20
|
6
|
|
|
|
|
277
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %Added_to_INC; |
24
|
|
|
|
|
|
|
sub _load { |
25
|
12
|
|
|
12
|
|
13
|
my ( $class, $file, $dir ) = @_; |
26
|
12
|
|
|
|
|
39
|
$file =~ s{\.pm$}{}; # remove .pm extension |
27
|
9
|
|
|
|
|
13
|
$file =~ s{\\}{/}g; # to make win32 happy |
28
|
10
|
|
|
|
|
190
|
$dir =~ s{\\}{/}g; # to make win32 happy |
29
|
7
|
|
|
|
|
56
|
$file =~ s/^$dir//; |
30
|
7
|
|
|
|
|
54
|
my $_package = join '::' => grep $_ => File::Spec->splitdir( $file ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# untaint that puppy! |
33
|
7
|
|
|
|
|
35
|
my ( $package ) = $_package =~ /^([[:word:]]+(?:::[[:word:]]+)*)$/; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Filter out bad classes (mainly this means things in .svn and similar) |
36
|
7
|
100
|
|
|
|
16
|
return unless defined $package; |
37
|
|
|
|
|
|
|
|
38
|
7
|
100
|
|
|
|
28
|
unshift @INC => $dir unless $Added_to_INC{ $dir }++; |
39
|
7
|
|
|
|
|
16
|
require_module($package); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub import { |
43
|
6
|
|
|
6
|
|
2572
|
my ( $class, @directories ) = @_; |
44
|
6
|
|
|
|
|
36
|
my @test_classes; |
45
|
|
|
|
|
|
|
|
46
|
6
|
|
|
|
|
32
|
foreach my $dir ( @directories ) { |
47
|
6
|
|
|
|
|
279
|
$dir = File::Spec->catdir( split '/', $dir ); |
48
|
|
|
|
|
|
|
find( |
49
|
|
|
|
|
|
|
{ no_chdir => 1, |
50
|
|
|
|
|
|
|
wanted => sub { |
51
|
20
|
|
|
19
|
|
1110
|
my @args = ($File::Find::name, $dir); |
52
|
20
|
100
|
|
|
|
58
|
if ($class->is_test_class(@args)) { |
53
|
9
|
|
|
|
|
37
|
$class->_load(@args); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
}, |
57
|
6
|
|
|
|
|
268
|
$dir |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |