« blib/lib/Alien/Build/Plugin/Build/Make.pm
↑ Summary
blib/lib/Alien/Build/Plugin/Fetch/LocalDir.pm »
| 1 | package Test::Alien::Run; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 4 | ▶ | use 5.008004; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 4 | ▶ | use Test2::API qw( context ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | # ABSTRACT: Run object | ||||||||||||||||||||
| 9 | 4 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 13 | ▶ | sub out { shift->{out} } | ||||||||||||||||||
|
Subroutine
out: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 13 | 13 | ▶ | sub err { shift->{err} } | ||||||||||||||||||
|
Subroutine
err: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 14 | 33 | ▶ | sub exit { shift->{exit} } | ||||||||||||||||||
|
Subroutine
exit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 15 | 18 | ▶ | sub signal { shift->{sig} } | ||||||||||||||||||
|
Subroutine
signal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | sub success | ||||||||||||||||||||
| 19 | 9 | ▶ | { | ||||||||||||||||||
|
Subroutine
success: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||
| 20 | 9 | my($self, $message) = @_; | |||||||||||||||||||
| 21 | 9 | ▶ | $message ||= 'command succeeded'; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "command succeeded"
MC/DC0%0/1
$message ||= "command succeeded"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 22 | 9 | ▶ | my $ok = $self->exit == 0 && $self->signal == 0; | ||||||||||||||||||
|
Condition100%3/3
$self->exit == 0 && $self->signal == 0
MC/DC100%2/2
$self->exit == 0 && $self->signal == 0
$self->exit == 0
$self->signal == 0
Truth table100%3/3
A && B
A= $self->exit == 0B= $self->signal == 0
| |||||||||||||||||||||
| 23 | 9 | ▶ | $ok = 0 if $self->{fail}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 9 | my $ctx = context(); | |||||||||||||||||||
| 26 | 9 | $ctx->ok($ok, $message); | |||||||||||||||||||
| 27 | 9 | ▶ | unless($ok) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 28 | { | ||||||||||||||||||||
| 29 | 4 | ▶ | $ctx->diag(" command exited with @{[ $self->exit ]}") if $self->exit; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 4 | ▶ | $ctx->diag(" command killed with @{[ $self->signal ]}") if $self->signal; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | 4 | ▶ | $ctx->diag(" @{[ $self->{fail} ]}") if $self->{fail}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | 9 | $ctx->release; | |||||||||||||||||||
| 34 | 9 | $self; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | sub exit_is | ||||||||||||||||||||
| 39 | 6 | ▶ | { | ||||||||||||||||||
|
Subroutine
exit_is: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 40 | 6 | my($self, $exit, $message) = @_; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 6 | ▶ | $message ||= "command exited with value $exit"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "command exited with value $exit"
MC/DC0%0/1
$message ||= "command exited with value $exit"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 43 | 6 | my $ok = $self->exit == $exit; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 6 | my $ctx = context(); | |||||||||||||||||||
| 46 | 6 | $ctx->ok($ok, $message); | |||||||||||||||||||
| 47 | 6 | ▶ | $ctx->diag(" actual exit value was: @{[ $self->exit ]}") unless $ok; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | 6 | $ctx->release; | |||||||||||||||||||
| 49 | 6 | $self; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | sub exit_isnt | ||||||||||||||||||||
| 54 | 4 | ▶ | { | ||||||||||||||||||
|
Subroutine
exit_isnt: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 55 | 4 | my($self, $exit, $message) = @_; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 4 | ▶ | $message ||= "command exited with value not $exit"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "command exited with value not $exit"
MC/DC0%0/1
$message ||= "command exited with value not $exit"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 58 | 4 | my $ok = $self->exit != $exit; | |||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 4 | my $ctx = context(); | |||||||||||||||||||
| 61 | 4 | $ctx->ok($ok, $message); | |||||||||||||||||||
| 62 | 4 | ▶ | $ctx->diag(" actual exit value was: @{[ $self->exit ]}") unless $ok; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 63 | 4 | $ctx->release; | |||||||||||||||||||
| 64 | 4 | $self; | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | sub _like | ||||||||||||||||||||
| 69 | 6 | ▶ | { | ||||||||||||||||||
|
Subroutine
_like: called CC=5 SCAR=16.1
| |||||||||||||||||||||
| 70 | 6 | my($self, $regex, $source, $not, $message) = @_; | |||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 6 | my $ok = $self->{$source} =~ $regex; | |||||||||||||||||||
| 73 | 6 | ▶ | $ok = !$ok if $not; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 6 | my $ctx = context(); | |||||||||||||||||||
| 76 | 6 | $ctx->ok($ok, $message); | |||||||||||||||||||
| 77 | 6 | ▶ | unless($ok) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 78 | { | ||||||||||||||||||||
| 79 | 2 | $ctx->diag(" $source:"); | |||||||||||||||||||
| 80 | 2 | $ctx->diag(" $_") for split /\r?\n/, $self->{$source}; | |||||||||||||||||||
| 81 | 2 | ▶ | $ctx->diag($not ? ' matches:' : ' does not match:'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 82 | 2 | $ctx->diag(" $regex"); | |||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | 6 | $ctx->release; | |||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 6 | $self; | |||||||||||||||||||
| 87 | } | ||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | sub out_like | ||||||||||||||||||||
| 90 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
out_like: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 91 | 2 | my($self, $regex, $message) = @_; | |||||||||||||||||||
| 92 | 2 | ▶ | $message ||= "output matches $regex"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "output matches $regex"
MC/DC0%0/1
$message ||= "output matches $regex"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 93 | 2 | $self->_like($regex, 'out', 0, $message); | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | sub out_unlike | ||||||||||||||||||||
| 98 | 2 | ▶ | { | ||||||||||||||||||
|
Subroutine
out_unlike: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 99 | 2 | my($self, $regex, $message) = @_; | |||||||||||||||||||
| 100 | 2 | ▶ | $message ||= "output does not match $regex"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "output does not match $regex"
MC/DC0%0/1
$message ||= "output does not match $regex"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 101 | 2 | $self->_like($regex, 'out', 1, $message); | |||||||||||||||||||
| 102 | } | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | sub err_like | ||||||||||||||||||||
| 106 | 1 | ▶ | { | ||||||||||||||||||
|
Subroutine
err_like: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 107 | 1 | my($self, $regex, $message) = @_; | |||||||||||||||||||
| 108 | 1 | ▶ | $message ||= "standard error matches $regex"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "standard error matches $regex"
MC/DC0%0/1
$message ||= "standard error matches $regex"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 109 | 1 | $self->_like($regex, 'err', 0, $message); | |||||||||||||||||||
| 110 | } | ||||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | sub err_unlike | ||||||||||||||||||||
| 114 | 1 | ▶ | { | ||||||||||||||||||
|
Subroutine
err_unlike: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 115 | 1 | my($self, $regex, $message) = @_; | |||||||||||||||||||
| 116 | 1 | ▶ | $message ||= "standard error does not match $regex"; | ||||||||||||||||||
|
Condition50%1/2
$message ||= "standard error does not match $regex"
MC/DC0%0/1
$message ||= "standard error does not match $regex"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||
| 117 | 1 | $self->_like($regex, 'err', 1, $message); | |||||||||||||||||||
| 118 | } | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | sub note | ||||||||||||||||||||
| 122 | 7 | ▶ | { | ||||||||||||||||||
|
Subroutine
note: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||
| 123 | 7 | my($self) = @_; | |||||||||||||||||||
| 124 | 7 | my $ctx = context(); | |||||||||||||||||||
| 125 | 7 | $ctx->note("[cmd]"); | |||||||||||||||||||
| 126 | 7 | $ctx->note(" @{$self->{cmd}}"); | |||||||||||||||||||
| 127 | 7 | ▶ | if($self->out ne '') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 128 | { | ||||||||||||||||||||
| 129 | 1 | $ctx->note("[out]"); | |||||||||||||||||||
| 130 | 1 | $ctx->note(" $_") for split /\r?\n/, $self->out; | |||||||||||||||||||
| 131 | } | ||||||||||||||||||||
| 132 | 7 | ▶ | if($self->err ne '') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 133 | { | ||||||||||||||||||||
| 134 | 1 | $ctx->note("[err]"); | |||||||||||||||||||
| 135 | 1 | $ctx->note(" $_") for split /\r?\n/, $self->err; | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | 7 | $ctx->release; | |||||||||||||||||||
| 138 | 7 | $self; | |||||||||||||||||||
| 139 | } | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | sub diag | ||||||||||||||||||||
| 143 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
diag: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||
| 144 | 0 | my($self) = @_; | |||||||||||||||||||
| 145 | 0 | my $ctx = context(); | |||||||||||||||||||
| 146 | 0 | $ctx->diag("[cmd]"); | |||||||||||||||||||
| 147 | 0 | $ctx->diag(" @{$self->{cmd}}"); | |||||||||||||||||||
| 148 | 0 | ▶ | if($self->out ne '') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 149 | { | ||||||||||||||||||||
| 150 | 0 | $ctx->diag("[out]"); | |||||||||||||||||||
| 151 | 0 | $ctx->diag(" $_") for split /\r?\n/, $self->out; | |||||||||||||||||||
| 152 | } | ||||||||||||||||||||
| 153 | 0 | ▶ | if($self->err ne '') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 154 | { | ||||||||||||||||||||
| 155 | 0 | $ctx->diag("[err]"); | |||||||||||||||||||
| 156 | 0 | $ctx->diag(" $_") for split /\r?\n/, $self->err; | |||||||||||||||||||
| 157 | } | ||||||||||||||||||||
| 158 | 0 | $ctx->release; | |||||||||||||||||||
| 159 | 0 | $self; | |||||||||||||||||||
| 160 | } | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 4 | 1; | |||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | __END__ | ||||||||||||||||||||