line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Classy;
|
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
28423
|
use strict;
|
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
267
|
|
4
|
8
|
|
|
8
|
|
40
|
use warnings;
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
213
|
|
5
|
8
|
|
|
8
|
|
8385
|
use Test::More ();
|
|
8
|
|
|
|
|
193907
|
|
|
8
|
|
|
|
|
197
|
|
6
|
8
|
|
|
8
|
|
5022
|
use Test::Classy::Util;
|
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
285
|
|
7
|
8
|
|
|
8
|
|
7516
|
use Sub::Install qw( install_sub );
|
|
8
|
|
|
|
|
16959
|
|
|
8
|
|
|
|
|
54
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.09';
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @tests;
|
12
|
|
|
|
|
|
|
my $caller = caller;
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
install_sub({
|
15
|
|
|
|
|
|
|
as => 'load_tests_from',
|
16
|
|
|
|
|
|
|
into => $caller,
|
17
|
|
|
|
|
|
|
code => sub (@) {
|
18
|
7
|
|
|
7
|
|
681
|
my @monikers = @_;
|
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
6571
|
require Module::Find;
|
21
|
|
|
|
|
|
|
|
22
|
7
|
|
|
|
|
11462
|
@tests = Test::Classy::_look_for_tests(@monikers);
|
23
|
7
|
|
|
|
|
23
|
foreach my $moniker ( @monikers ) {
|
24
|
7
|
|
|
|
|
39
|
push @tests, grep { $_->isa('Test::Classy::Base') }
|
|
23
|
|
|
|
|
352
|
|
25
|
|
|
|
|
|
|
Module::Find::useall( $moniker );
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
},
|
28
|
|
|
|
|
|
|
});
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
install_sub({
|
31
|
|
|
|
|
|
|
as => 'load_test',
|
32
|
|
|
|
|
|
|
into => $caller,
|
33
|
|
|
|
|
|
|
code => sub ($) {
|
34
|
1
|
|
|
1
|
|
3
|
my $moniker = shift;
|
35
|
1
|
50
|
|
|
|
15
|
unless ($moniker->can('import')) {
|
36
|
0
|
0
|
|
|
|
0
|
eval "require $moniker" or die $@;
|
37
|
|
|
|
|
|
|
}
|
38
|
1
|
|
|
|
|
2
|
push @tests, $moniker;
|
39
|
|
|
|
|
|
|
},
|
40
|
|
|
|
|
|
|
});
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
install_sub({
|
43
|
|
|
|
|
|
|
as => 'limit_tests_by',
|
44
|
|
|
|
|
|
|
into => $caller,
|
45
|
|
|
|
|
|
|
code => sub (@) {
|
46
|
1
|
|
|
1
|
|
7
|
my @monikers = @_;
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
2
|
foreach my $class ( @tests ) {
|
49
|
2
|
|
|
|
|
26
|
$class->_limit( @monikers );
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
},
|
52
|
|
|
|
|
|
|
});
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
install_sub({
|
55
|
|
|
|
|
|
|
as => 'run_tests',
|
56
|
|
|
|
|
|
|
into => $caller,
|
57
|
|
|
|
|
|
|
code => sub (;@) {
|
58
|
6
|
|
|
6
|
|
36
|
my @args = @_;
|
59
|
|
|
|
|
|
|
|
60
|
6
|
50
|
|
|
|
27
|
unless (@tests) {
|
61
|
0
|
|
|
|
|
0
|
@tests = Test::Classy::_look_for_tests();
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
6
|
100
|
|
|
|
31
|
unless (Test::Classy::Util::_planned()) {
|
65
|
5
|
|
|
|
|
119
|
Test::More::plan tests => __PACKAGE__->plan;
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
|
68
|
6
|
|
|
|
|
3115
|
foreach my $class ( @tests ) {
|
69
|
18
|
|
|
|
|
177
|
$class->_run_tests( @args );
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
},
|
72
|
|
|
|
|
|
|
});
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _look_for_tests {
|
75
|
7
|
|
|
7
|
|
23
|
my @queue = @_;
|
76
|
|
|
|
|
|
|
|
77
|
7
|
|
|
|
|
6461
|
require Class::Inspector;
|
78
|
|
|
|
|
|
|
|
79
|
7
|
50
|
|
|
|
39402
|
unless (@queue) {
|
80
|
0
|
|
|
|
|
0
|
@queue = grep { $_ ne 'main' }
|
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
Class::Inspector->_subnames('');
|
82
|
|
|
|
|
|
|
}
|
83
|
|
|
|
|
|
|
|
84
|
7
|
|
|
|
|
20
|
my @found;
|
85
|
7
|
|
|
|
|
47
|
while (my $moniker = shift @queue) {
|
86
|
7
|
|
|
|
|
66
|
my @subnames = Class::Inspector->_subnames($moniker);
|
87
|
7
|
|
|
|
|
164
|
foreach my $subname (@subnames) {
|
88
|
0
|
|
|
|
|
0
|
my $class = $moniker.'::'.$subname;
|
89
|
0
|
0
|
0
|
|
|
0
|
push @found, $class if $class ne 'Test::Classy::Base'
|
90
|
|
|
|
|
|
|
and $class->isa('Test::Classy::Base');
|
91
|
0
|
|
|
|
|
0
|
unshift @queue, $class;
|
92
|
|
|
|
|
|
|
}
|
93
|
|
|
|
|
|
|
}
|
94
|
7
|
|
|
|
|
28
|
return @found;
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub plan {
|
98
|
7
|
|
|
7
|
1
|
22
|
my $plan = 0;
|
99
|
7
|
|
|
|
|
18
|
foreach my $test ( @tests ) {
|
100
|
23
|
|
|
|
|
166
|
$plan += $test->_plan;
|
101
|
|
|
|
|
|
|
}
|
102
|
7
|
|
|
|
|
75
|
return $plan;
|
103
|
|
|
|
|
|
|
}
|
104
|
|
|
|
|
|
|
|
105
|
1
|
|
|
1
|
1
|
4
|
sub reset { @tests = () } # for test
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1;
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__END__
|