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