| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Classy; |
|
2
|
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
82441
|
use strict; |
|
|
13
|
|
|
|
|
23
|
|
|
|
13
|
|
|
|
|
492
|
|
|
4
|
13
|
|
|
13
|
|
73
|
use warnings; |
|
|
13
|
|
|
|
|
61
|
|
|
|
13
|
|
|
|
|
631
|
|
|
5
|
13
|
|
|
13
|
|
7701
|
use Test::More (); |
|
|
13
|
|
|
|
|
1240821
|
|
|
|
13
|
|
|
|
|
474
|
|
|
6
|
13
|
|
|
13
|
|
6986
|
use Test::Classy::Util; |
|
|
13
|
|
|
|
|
44
|
|
|
|
13
|
|
|
|
|
600
|
|
|
7
|
13
|
|
|
13
|
|
7617
|
use Sub::Install qw( install_sub ); |
|
|
13
|
|
|
|
|
32848
|
|
|
|
13
|
|
|
|
|
84
|
|
|
8
|
13
|
|
|
13
|
|
8042
|
use Class::Inspector; |
|
|
13
|
|
|
|
|
55823
|
|
|
|
13
|
|
|
|
|
9827
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @tests; |
|
13
|
|
|
|
|
|
|
my $caller = caller; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
install_sub({ |
|
16
|
|
|
|
|
|
|
as => 'load_tests_from', |
|
17
|
|
|
|
|
|
|
into => $caller, |
|
18
|
|
|
|
|
|
|
code => sub (@) { |
|
19
|
9
|
|
|
9
|
|
1640779
|
my @monikers = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
9
|
|
|
|
|
5679
|
require Module::Find; |
|
22
|
|
|
|
|
|
|
|
|
23
|
9
|
|
|
|
|
16336
|
@tests = Test::Classy::_look_for_tests(@monikers); |
|
24
|
9
|
|
|
|
|
25
|
foreach my $moniker ( @monikers ) { |
|
25
|
9
|
|
|
|
|
44
|
push @tests, grep { $_->isa('Test::Classy::Base') } |
|
|
24
|
|
|
|
|
344
|
|
|
26
|
|
|
|
|
|
|
Module::Find::useall( $moniker ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
}); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
install_sub({ |
|
32
|
|
|
|
|
|
|
as => 'load_test', |
|
33
|
|
|
|
|
|
|
into => $caller, |
|
34
|
|
|
|
|
|
|
code => sub ($) { |
|
35
|
4
|
|
|
4
|
|
443330
|
my $moniker = shift; |
|
36
|
4
|
100
|
|
|
|
32
|
unless (Class::Inspector->loaded($moniker)) { |
|
37
|
1
|
50
|
|
|
|
159
|
eval "require $moniker" or die $@; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
4
|
|
|
|
|
261
|
push @tests, $moniker; |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
}); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
install_sub({ |
|
44
|
|
|
|
|
|
|
as => 'limit_tests_by', |
|
45
|
|
|
|
|
|
|
into => $caller, |
|
46
|
|
|
|
|
|
|
code => sub (@) { |
|
47
|
1
|
|
|
1
|
|
7
|
my @monikers = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
foreach my $class ( @tests ) { |
|
50
|
2
|
|
|
|
|
17
|
$class->_limit( @monikers ); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
}, |
|
53
|
|
|
|
|
|
|
}); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
install_sub({ |
|
56
|
|
|
|
|
|
|
as => 'run_tests', |
|
57
|
|
|
|
|
|
|
into => $caller, |
|
58
|
|
|
|
|
|
|
code => sub (;@) { |
|
59
|
10
|
|
|
10
|
|
144779
|
my @args = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
10
|
100
|
|
|
|
51
|
unless (@tests) { |
|
62
|
1
|
|
|
|
|
5
|
@tests = Test::Classy::_look_for_tests(); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
10
|
100
|
|
|
|
90
|
unless (Test::Classy::Util::_planned()) { |
|
66
|
8
|
|
|
|
|
3375
|
Test::More::plan tests => __PACKAGE__->plan; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
10
|
|
|
|
|
9024
|
foreach my $class ( @tests ) { |
|
70
|
25
|
|
|
|
|
320
|
$class->_run_tests( @args ); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
}, |
|
73
|
|
|
|
|
|
|
}); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _look_for_tests { |
|
76
|
10
|
|
|
10
|
|
34
|
my @queue = @_; |
|
77
|
|
|
|
|
|
|
|
|
78
|
10
|
100
|
|
|
|
38
|
unless (@queue) { |
|
79
|
1
|
|
|
|
|
7
|
@queue = grep { $_ ne 'main' } |
|
|
76
|
|
|
|
|
796
|
|
|
80
|
|
|
|
|
|
|
Class::Inspector->_subnames(''); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
10
|
|
|
|
|
59
|
my @found; |
|
84
|
10
|
|
|
|
|
52
|
while (my $moniker = shift @queue) { |
|
85
|
311
|
|
|
|
|
803
|
my @subnames = Class::Inspector->_subnames($moniker); |
|
86
|
311
|
|
|
|
|
15905
|
foreach my $subname (@subnames) { |
|
87
|
227
|
|
|
|
|
339
|
my $class = $moniker.'::'.$subname; |
|
88
|
227
|
100
|
100
|
|
|
2662
|
push @found, $class if $class ne 'Test::Classy::Base' |
|
89
|
|
|
|
|
|
|
and $class->isa('Test::Classy::Base'); |
|
90
|
227
|
|
|
|
|
640
|
unshift @queue, $class; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
} |
|
93
|
10
|
|
|
|
|
67
|
return @found; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub plan { |
|
97
|
13
|
|
|
13
|
1
|
91
|
my $plan = 0; |
|
98
|
13
|
|
|
|
|
36
|
foreach my $test ( @tests ) { |
|
99
|
32
|
|
|
|
|
264
|
$plan += $test->_plan; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
13
|
|
|
|
|
145
|
return $plan; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
1
|
|
|
1
|
1
|
5
|
sub reset { @tests = () } # for test |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |