line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
56
|
|
|
56
|
|
68347
|
use strict; |
|
56
|
|
|
|
|
126
|
|
|
56
|
|
|
|
|
1692
|
|
2
|
56
|
|
|
56
|
|
287
|
use warnings; |
|
56
|
|
|
|
|
118
|
|
|
56
|
|
|
|
|
1987
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Class::MethodInfo; |
5
|
56
|
|
|
56
|
|
291
|
use Carp; |
|
56
|
|
|
|
|
117
|
|
|
56
|
|
|
|
|
26320
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.51'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
131
|
|
|
131
|
1
|
536
|
my ( $class, %param ) = @_; |
11
|
|
|
|
|
|
|
my $self = bless { |
12
|
|
|
|
|
|
|
name => $param{ name }, |
13
|
131
|
|
100
|
|
|
781
|
type => $param{ type } || 'test', |
14
|
|
|
|
|
|
|
}, $class; |
15
|
131
|
100
|
|
|
|
364
|
unless ( defined $param{num_tests} ) { |
16
|
28
|
100
|
|
|
|
80
|
$param{ num_tests } = $self->is_type('test') ? 1 : 0; |
17
|
|
|
|
|
|
|
}; |
18
|
131
|
|
|
|
|
413
|
$self->num_tests( $param{num_tests} ); |
19
|
131
|
|
|
|
|
758
|
return $self; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
807
|
|
|
807
|
1
|
1743
|
sub name { shift->{name} }; |
23
|
|
|
|
|
|
|
|
24
|
807
|
|
|
807
|
1
|
2052
|
sub type { shift->{type} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub num_tests { |
27
|
457
|
|
|
457
|
1
|
983
|
my ( $self, $n ) = @_; |
28
|
457
|
100
|
|
|
|
1043
|
if ( defined $n ) { |
29
|
137
|
100
|
|
|
|
314
|
croak "$n not valid number of tests" |
30
|
|
|
|
|
|
|
unless $self->is_num_tests($n); |
31
|
136
|
|
|
|
|
430
|
$self->{ num_tests } = $n; |
32
|
|
|
|
|
|
|
}; |
33
|
456
|
|
|
|
|
1062
|
return $self->{ num_tests }; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_type { |
37
|
936
|
|
|
936
|
1
|
1627
|
my ( $self, $type ) = @_; |
38
|
936
|
|
|
|
|
2861
|
return $self->{ type } eq $type; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub is_method_type { |
42
|
52
|
|
|
52
|
1
|
114
|
my ( $self, $type ) = @_; |
43
|
52
|
|
|
|
|
270
|
return $type =~ m/^(startup|setup|test|teardown|shutdown)$/s; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub is_num_tests { |
47
|
292
|
|
|
292
|
1
|
611
|
my ( $self, $num_tests ) = @_; |
48
|
292
|
|
|
|
|
1541
|
return $num_tests =~ m/^(no_plan)|(\+?\d+)$/s; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |