| 1 | package Test2::Event::Subtest; | ||||||||||||||||||||||||||||
| 2 | 455 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 455 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 455 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 455 | ▶ | BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 455 | ▶ | use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid start_stamp stop_stamp}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 732 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 732 | my $self = shift; | |||||||||||||||||||||||||||
| 12 | 732 | $self->SUPER::init(); | |||||||||||||||||||||||||||
| 13 | 732 | ▶ | $self->{+SUBEVENTS} ||= []; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"subevents"} ||= []
MC/DC100%1/1
$self->{"subevents"} ||= []
$self->{"subevents"}
Truth table100%2/2
A
A= $self->{"subevents"}
| |||||||||||||||||||||||||||||
| 14 | 732 | ▶ | if ($self->{+EFFECTIVE_PASS}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | 711 | $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||
| 20 | 455 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub set_subevents { | ||||||||||||||||||||||||||
|
Subroutine
set_subevents: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 24 | 0 | my @subevents = @_; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($self->{+EFFECTIVE_PASS}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @subevents; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | $self->{+SUBEVENTS} = \@subevents; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 382 | ▶ | sub set_effective_pass { | ||||||||||||||||||||||||||
|
Subroutine
set_effective_pass: called CC=8 SCAR=32.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 382 | my $self = shift; | |||||||||||||||||||||||||||
| 35 | 382 | my ($pass) = @_; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 382 | ▶ | if ($pass) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 38 | 382 | $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | ▶ | elsif ($self->{+EFFECTIVE_PASS} && !$pass) { | |||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"effective_pass"} and not $pass
MC/DC0%0/2
$self->{"effective_pass"} and not $pass
$self->{"effective_pass"}
not $pass
Truth table0%0/3
A and not(B)
A= $self->{"effective_pass"}B= not $pass
| |||||||||||||||||||||||||||||
| 41 | 0 | for my $s (grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}) { | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | $_->set_effective_pass(0) unless $s->can('todo') && defined $s->todo; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s->can("todo") and defined $s->todo
MC/DC0%0/2
$s->can("todo") and defined $s->todo
$s->can("todo")
defined $s->todo
Truth table0%0/3
A and B
A= $s->can("todo")B= defined $s->todo
| |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 382 | $self->{+EFFECTIVE_PASS} = $pass; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 455 | ▶ | sub summary { | ||||||||||||||||||||||||||
|
Subroutine
summary: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 4 | ▶ | my $name = $self->{+NAME} || "Nameless Subtest"; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'name'} || 'Nameless Subtest'
MC/DC100%1/1
$self->{'name'} || 'Nameless Subtest'
$self->{'name'}
Truth table100%2/2
A
A= $self->{'name'}
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 4 | my $todo = $self->{+TODO}; | |||||||||||||||||||||||||||
| 56 | 4 | ▶ | if ($todo) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 57 | 1 | $name .= " (TODO: $todo)"; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | elsif (defined $todo) { | ||||||||||||||||||||||||||||
| 60 | 1 | $name .= " (TODO)"; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 4 | return $name; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1592 | ▶ | sub facet_data { | ||||||||||||||||||||||||||
|
Subroutine
facet_data: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 67 | 1592 | my $self = shift; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1592 | my $out = $self->SUPER::facet_data(); | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1592 | my $start = $self->start_stamp; | |||||||||||||||||||||||||||
| 72 | 1592 | my $stop = $self->stop_stamp; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | $out->{parent} = { | ||||||||||||||||||||||||||||
| 75 | hid => $self->subtest_id, | ||||||||||||||||||||||||||||
| 76 | 10751 | ▶ | children => [map {$_->facet_data} @{$self->{+SUBEVENTS}}], | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 77 | 1592 | buffered => $self->{+BUFFERED}, | |||||||||||||||||||||||||||
| 78 | $start ? (start_stamp => $start) : (), | ||||||||||||||||||||||||||||
| 79 | $stop ? (stop_stamp => $stop) : (), | ||||||||||||||||||||||||||||
| 80 | }; | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1592 | return $out; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 16 | ▶ | sub add_amnesty { | ||||||||||||||||||||||||||
|
Subroutine
add_amnesty: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 86 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 16 | for my $am (@_) { | |||||||||||||||||||||||||||
| 89 | 16 | ▶ | $am = {%$am} if ref($am) ne 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 16 | $am = Test2::EventFacet::Amnesty->new($am); | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 16 | push @{$self->{+AMNESTY}} => $am; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 16 | for my $e (@{$self->{+SUBEVENTS}}) { | |||||||||||||||||||||||||||
| 95 | 98 | $e->add_amnesty($am->clone(inherited => 1)); | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 455 | 1; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | __END__ | ||||||||||||||||||||||||||||