| 1 | 56 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 56 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | package Test::Class::MethodInfo; | ||||||||||||
| 5 | 56 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 56 | our $VERSION = '0.52'; | |||||||||||
| 8 | |||||||||||||
| 9 | 131 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 10 | 131 | my ( $class, %param ) = @_; | |||||||||||
| 11 | my $self = bless { | ||||||||||||
| 12 | name => $param{ name }, | ||||||||||||
| 13 | 131 | ▶ | type => $param{ type } || 'test', | ||||||||||
|
Condition100%2/2
$param{'type'} || 'test'
MC/DC100%1/1
$param{'type'} || 'test'
$param{'type'}
Truth table100%2/2
A
A= $param{'type'}
| |||||||||||||
| 14 | }, $class; | ||||||||||||
| 15 | 131 | ▶ | unless ( defined $param{num_tests} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 16 | 28 | ▶ | $param{ num_tests } = $self->is_type('test') ? 1 : 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | }; | ||||||||||||
| 18 | 131 | $self->num_tests( $param{num_tests} ); | |||||||||||
| 19 | 131 | return $self; | |||||||||||
| 20 | }; | ||||||||||||
| 21 | |||||||||||||
| 22 | 807 | ▶ | sub name { shift->{name} }; | ||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 23 | |||||||||||||
| 24 | 807 | ▶ | sub type { shift->{type} }; | ||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 25 | |||||||||||||
| 26 | 457 | ▶ | sub num_tests { | ||||||||||
|
Subroutine
num_tests: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 27 | 457 | my ( $self, $n ) = @_; | |||||||||||
| 28 | 457 | ▶ | if ( defined $n ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | 137 | ▶ | croak "$n not valid number of tests" | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | unless $self->is_num_tests($n); | ||||||||||||
| 31 | 136 | $self->{ num_tests } = $n; | |||||||||||
| 32 | }; | ||||||||||||
| 33 | 456 | return $self->{ num_tests }; | |||||||||||
| 34 | }; | ||||||||||||
| 35 | |||||||||||||
| 36 | 936 | ▶ | sub is_type { | ||||||||||
|
Subroutine
is_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 37 | 936 | my ( $self, $type ) = @_; | |||||||||||
| 38 | 936 | return $self->{ type } eq $type; | |||||||||||
| 39 | }; | ||||||||||||
| 40 | |||||||||||||
| 41 | 52 | ▶ | sub is_method_type { | ||||||||||
|
Subroutine
is_method_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 42 | 52 | my ( $self, $type ) = @_; | |||||||||||
| 43 | 52 | return $type =~ m/^(startup|setup|test|teardown|shutdown)$/s; | |||||||||||
| 44 | }; | ||||||||||||
| 45 | |||||||||||||
| 46 | 292 | ▶ | sub is_num_tests { | ||||||||||
|
Subroutine
is_num_tests: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 47 | 292 | my ( $self, $num_tests ) = @_; | |||||||||||
| 48 | 292 | return $num_tests =~ m/^(no_plan)|(\+?\d+)$/s; | |||||||||||
| 49 | }; | ||||||||||||
| 50 | |||||||||||||
| 51 | 56 | 1; | |||||||||||
| 52 | __END__ | ||||||||||||