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