line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
55
|
|
|
55
|
|
15691
|
use strict; |
|
55
|
|
|
|
|
80
|
|
|
55
|
|
|
|
|
2499
|
|
2
|
55
|
|
|
55
|
|
302
|
use warnings; |
|
55
|
|
|
|
|
70
|
|
|
55
|
|
|
|
|
2025
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Class::MethodInfo; |
5
|
55
|
|
|
55
|
|
238
|
use Carp; |
|
55
|
|
|
|
|
74
|
|
|
55
|
|
|
|
|
21194
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.49'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
121
|
|
|
121
|
1
|
378
|
my ( $class, %param ) = @_; |
11
|
|
|
|
|
|
|
my $self = bless { |
12
|
|
|
|
|
|
|
name => $param{ name }, |
13
|
121
|
|
100
|
|
|
819
|
type => $param{ type } || 'test', |
14
|
|
|
|
|
|
|
}, $class; |
15
|
121
|
100
|
|
|
|
334
|
unless ( defined $param{num_tests} ) { |
16
|
28
|
100
|
|
|
|
70
|
$param{ num_tests } = $self->is_type('test') ? 1 : 0; |
17
|
|
|
|
|
|
|
}; |
18
|
121
|
|
|
|
|
269
|
$self->num_tests( $param{num_tests} ); |
19
|
121
|
|
|
|
|
782
|
return $self; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
757
|
|
|
757
|
1
|
1383
|
sub name { shift->{name} }; |
23
|
|
|
|
|
|
|
|
24
|
757
|
|
|
757
|
1
|
1864
|
sub type { shift->{type} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub num_tests { |
27
|
427
|
|
|
427
|
1
|
551
|
my ( $self, $n ) = @_; |
28
|
427
|
100
|
|
|
|
799
|
if ( defined $n ) { |
29
|
127
|
100
|
|
|
|
217
|
croak "$n not valid number of tests" |
30
|
|
|
|
|
|
|
unless $self->is_num_tests($n); |
31
|
126
|
|
|
|
|
404
|
$self->{ num_tests } = $n; |
32
|
|
|
|
|
|
|
}; |
33
|
426
|
|
|
|
|
871
|
return $self->{ num_tests }; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_type { |
37
|
886
|
|
|
886
|
1
|
894
|
my ( $self, $type ) = @_; |
38
|
886
|
|
|
|
|
3157
|
return $self->{ type } eq $type; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub is_method_type { |
42
|
52
|
|
|
52
|
1
|
72
|
my ( $self, $type ) = @_; |
43
|
52
|
|
|
|
|
261
|
return $type =~ m/^(startup|setup|test|teardown|shutdown)$/s; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub is_num_tests { |
47
|
272
|
|
|
272
|
1
|
803
|
my ( $self, $num_tests ) = @_; |
48
|
272
|
|
|
|
|
1483
|
return $num_tests =~ m/^(no_plan)|(\+?\d+)$/s; |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |