line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
56
|
|
|
56
|
|
17553
|
use strict; |
|
56
|
|
|
|
|
96
|
|
|
56
|
|
|
|
|
2824
|
|
2
|
56
|
|
|
56
|
|
267
|
use warnings; |
|
56
|
|
|
|
|
75
|
|
|
56
|
|
|
|
|
3289
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Class::MethodInfo; |
5
|
56
|
|
|
56
|
|
310
|
use Carp; |
|
56
|
|
|
|
|
84
|
|
|
56
|
|
|
|
|
23911
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.50'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
121
|
|
|
121
|
1
|
393
|
my ( $class, %param ) = @_; |
11
|
|
|
|
|
|
|
my $self = bless { |
12
|
|
|
|
|
|
|
name => $param{ name }, |
13
|
121
|
|
100
|
|
|
778
|
type => $param{ type } || 'test', |
14
|
|
|
|
|
|
|
}, $class; |
15
|
121
|
100
|
|
|
|
306
|
unless ( defined $param{num_tests} ) { |
16
|
28
|
100
|
|
|
|
78
|
$param{ num_tests } = $self->is_type('test') ? 1 : 0; |
17
|
|
|
|
|
|
|
}; |
18
|
121
|
|
|
|
|
276
|
$self->num_tests( $param{num_tests} ); |
19
|
121
|
|
|
|
|
824
|
return $self; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
757
|
|
|
757
|
1
|
1559
|
sub name { shift->{name} }; |
23
|
|
|
|
|
|
|
|
24
|
757
|
|
|
757
|
1
|
1971
|
sub type { shift->{type} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub num_tests { |
27
|
427
|
|
|
427
|
1
|
550
|
my ( $self, $n ) = @_; |
28
|
427
|
100
|
|
|
|
874
|
if ( defined $n ) { |
29
|
127
|
100
|
|
|
|
230
|
croak "$n not valid number of tests" |
30
|
|
|
|
|
|
|
unless $self->is_num_tests($n); |
31
|
126
|
|
|
|
|
410
|
$self->{ num_tests } = $n; |
32
|
|
|
|
|
|
|
}; |
33
|
426
|
|
|
|
|
961
|
return $self->{ num_tests }; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_type { |
37
|
886
|
|
|
886
|
1
|
929
|
my ( $self, $type ) = @_; |
38
|
886
|
|
|
|
|
3375
|
return $self->{ type } eq $type; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub is_method_type { |
42
|
52
|
|
|
52
|
1
|
73
|
my ( $self, $type ) = @_; |
43
|
52
|
|
|
|
|
275
|
return $type =~ m/^(startup|setup|test|teardown|shutdown)$/s; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub is_num_tests { |
47
|
272
|
|
|
272
|
1
|
410
|
my ( $self, $num_tests ) = @_; |
48
|
272
|
|
|
|
|
1591
|
return $num_tests =~ m/^(no_plan)|(\+?\d+)$/s; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |