| 1 | package Test::Kantan; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 55 | ▶ | use 5.010_001; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 55 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 55 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 55 | our $VERSION = "0.39"; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 55 | ▶ | use parent qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 55 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 55 | ▶ | use Test::Kantan::State; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 55 | ▶ | use Test::Kantan::Builder; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 55 | ▶ | use Test::Kantan::Caller; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 55 | ▶ | use Test::Kantan::Suite; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 55 | ▶ | use Test::Kantan::Expect; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 55 | ▶ | use Test::Deep::NoTest qw(ignore); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 55 | ▶ | use Module::Spy 0.03 qw(spy_on); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 55 | our @EXPORT = ( | |||||||||||||||||||||||||||||||||||||||||
| 22 | qw(Feature Scenario Given When Then), | ||||||||||||||||||||||||||||||||||||||||||
| 23 | qw(subtest done_testing setup teardown), | ||||||||||||||||||||||||||||||||||||||||||
| 24 | qw(describe context it), | ||||||||||||||||||||||||||||||||||||||||||
| 25 | qw(before_each after_each), | ||||||||||||||||||||||||||||||||||||||||||
| 26 | qw(expect ok diag ignore spy_on), | ||||||||||||||||||||||||||||||||||||||||||
| 27 | qw(skip_all), | ||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 29 | ▶ | my $HAS_DEVEL_CODEOBSERVER = !$ENV{KANTAN_NOOBSERVER} && eval "use Devel::CodeObserver 0.11; 1;"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Condition66%2/3
!$ENV{'KANTAN_NOOBSERVER'} && eval 'use Devel::CodeObserver 0.11; 1;'
MC/DC50%1/2
!$ENV{'KANTAN_NOOBSERVER'} && eval 'use Devel::CodeObserver 0.11; 1;'
!$ENV{'KANTAN_NOOBSERVER'}
eval 'use Devel::CodeObserver 0.11; 1;'
Truth table66%2/3
not(A) && B
A= !$ENV{'KANTAN_NOOBSERVER'}B= eval 'use Devel::CodeObserver 0.11; 1;'
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 55 | our $Level = 0; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 55 | ▶ | if (Test::Builder->can('new')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | # Replace some Test::Builder methods with mine. | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 55 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | *Test::Builder::ok = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my ($self, $ok, $msg) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | Test::Kantan->builder->ok( | |||||||||||||||||||||||||||||||||||||||||
| 42 | value => $ok, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | message => $msg, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | caller => Test::Kantan::Caller->new( | ||||||||||||||||||||||||||||||||||||||||||
| 45 | $Test::Builder::Level | ||||||||||||||||||||||||||||||||||||||||||
| 46 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | *Test::Builder::subtest = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | goto \&Test::Kantan::subtest; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | *Test::Builder::diag = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my ($self, $message) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | Test::Kantan->builder->diag( | |||||||||||||||||||||||||||||||||||||||||
| 59 | message => $message, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | cutoff => 1024, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | caller => Test::Kantan::Caller->new($Test::Builder::Level), | ||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | *Test::Builder::note = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my ($self, $message) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | Test::Kantan->builder->diag( | |||||||||||||||||||||||||||||||||||||||||
| 69 | message => $message, | ||||||||||||||||||||||||||||||||||||||||||
| 70 | cutoff => 1024, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | caller => Test::Kantan::Caller->new($Test::Builder::Level), | ||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | *Test::Builder::done_testing = sub { | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my ($self, $message) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | Test::Kantan->builder->done_testing() | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 55 | our $BUILDER = Test::Kantan::Builder->new(); | |||||||||||||||||||||||||||||||||||||||||
| 83 | 393 | ▶ | sub builder { $BUILDER } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
builder: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 86 | # DSL functions | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 55 | our $CURRENT = our $ROOT = Test::Kantan::Suite->new(root => 1, title => 'Root'); | |||||||||||||||||||||||||||||||||||||||||
| 89 | 55 | our $FINISHED; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 55 | our $RAN_TEST; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | sub skip_all { | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 4 | ▶ | my ($reason) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_all: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 4 | ▶ | $reason //= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$reason //= ""
MC/DC0%0/1
$reason //= ""
$reason
Truth table50%1/2
A
A= $reason
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 4 | print "1..0 # SKIP ${reason}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 4 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | sub setup(&) { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | ▶ | my ($code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 4 | $CURRENT->add_trigger('setup' => $code); | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub before_each { goto \&setup } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_each: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | sub teardown(&) { | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my ($code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
teardown: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $CURRENT->add_trigger('teardown' => $code); | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub after_each { goto \&teardown } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_each: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | sub _step { | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 84 | ▶ | my ($tag, $title) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_step: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 84 | ▶ | @_==2 or Carp::confess "Invalid arguments"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 84 | my $last_state = $CURRENT->{last_state}; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 84 | $CURRENT->{last_state} = $tag; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 84 | ▶ | if ($last_state && $last_state eq $tag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$last_state and $last_state eq $tag
MC/DC100%2/2
$last_state and $last_state eq $tag
$last_state
$last_state eq $tag
Truth table100%3/3
A and B
A= $last_stateB= $last_state eq $tag
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 20 | $tag = 'And'; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 84 | builder->reporter->step(sprintf("%5s %s", $tag, $title)); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 20 | ▶ | sub Given { _step('Given', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Given: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 20 | ▶ | sub When { _step('When', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
When: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 44 | ▶ | sub Then { _step('Then', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Then: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | sub _suite { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 119 | ▶ | my ($env_key, $tag, $title, $code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_suite: called CC=6 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 119 | ▶ | if (defined($env_key)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 116 | my $filter = $ENV{$env_key}; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 116 | ▶ | if (defined($filter) && length($filter) > 0 && $title !~ /$filter/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $filter and length $filter > 0 and not $title =~ /$filter/
defined $filter and length $filter > 0
MC/DC0%0/3
defined $filter and length $filter > 0 and not $title =~ /$filter/
defined $filter
length $filter > 0
not $title =~ /$filter/
Truth table25%1/4
A and B and not(C)
A= defined $filterB= length $filter > 0C= not $title =~ /$filter/
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | builder->reporter->step("SKIP: ${title}"); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 119 | my $suite = Test::Kantan::Suite->new( | |||||||||||||||||||||||||||||||||||||||||
| 139 | title => $title, | ||||||||||||||||||||||||||||||||||||||||||
| 140 | parent => $CURRENT, | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 142 | { | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 119 | local $CURRENT = $suite; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 119 | ▶ | builder->subtest( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | title => defined($tag) ? "${tag} ${title}" : $title, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | suite => $suite, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 119 | $RAN_TEST++; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 32 | ▶ | sub Feature { _suite('KANTAN_FILTER_FEATURE', 'Feature', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Feature: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 20 | ▶ | sub Scenario { _suite('KANTAN_FILTER_SCENARIO', 'Scenario', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Scenario: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | # Test::More compat | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 64 | ▶ | sub subtest { _suite('KANTAN_FILTER_SUBTEST', undef, @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subtest: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | # BDD compat | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | ▶ | sub describe { _suite( undef, undef, @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
describe: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub context { _suite( undef, undef, @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
context: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | sub it { _suite( undef, undef, @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
it: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | sub expect { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 34 | ▶ | my $stuff = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 34 | Test::Kantan::Expect->new( | |||||||||||||||||||||||||||||||||||||||||
| 167 | stuff => $stuff, | ||||||||||||||||||||||||||||||||||||||||||
| 168 | builder => Test::Kantan->builder | ||||||||||||||||||||||||||||||||||||||||||
| 169 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | sub ok(&) { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 49 | ▶ | my $code = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ok: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 49 | ▶ | if ($HAS_DEVEL_CODEOBSERVER) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 25 | state $observer = Devel::CodeObserver->new(); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 25 | my ($retval, $result) = $observer->call($code); | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 25 | my $builder = Test::Kantan->builder; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 25 | $builder->ok( | |||||||||||||||||||||||||||||||||||||||||
| 181 | value => $retval, | ||||||||||||||||||||||||||||||||||||||||||
| 182 | caller => Test::Kantan::Caller->new( | ||||||||||||||||||||||||||||||||||||||||||
| 183 | $Test::Kantan::Level | ||||||||||||||||||||||||||||||||||||||||||
| 184 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 25 | for my $pair (@{$result->dump_pairs}) { | |||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | my ($code, $dump) = @$pair; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | $builder->diag( | |||||||||||||||||||||||||||||||||||||||||
| 190 | message => sprintf("%s => %s", $code, $dump), | ||||||||||||||||||||||||||||||||||||||||||
| 191 | caller => Test::Kantan::Caller->new( | ||||||||||||||||||||||||||||||||||||||||||
| 192 | $Test::Kantan::Level | ||||||||||||||||||||||||||||||||||||||||||
| 193 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 194 | cutoff => $builder->reporter->cutoff, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 25 | return !!$retval; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 24 | my $retval = $code->(); | |||||||||||||||||||||||||||||||||||||||||
| 200 | 24 | my $builder = Test::Kantan->builder; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 24 | $builder->ok( | |||||||||||||||||||||||||||||||||||||||||
| 202 | value => $retval, | ||||||||||||||||||||||||||||||||||||||||||
| 203 | caller => Test::Kantan::Caller->new( | ||||||||||||||||||||||||||||||||||||||||||
| 204 | $Test::Kantan::Level | ||||||||||||||||||||||||||||||||||||||||||
| 205 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 206 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | sub diag { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 24 | ▶ | my ($msg, $cutoff) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diag: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 24 | Test::Kantan->builder->diag( | |||||||||||||||||||||||||||||||||||||||||
| 214 | message => $msg, | ||||||||||||||||||||||||||||||||||||||||||
| 215 | cutoff => $cutoff, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | caller => Test::Kantan::Caller->new( | ||||||||||||||||||||||||||||||||||||||||||
| 217 | $Test::Kantan::Level | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 219 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | sub done_testing { | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 46 | ▶ | builder->done_testing | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
done_testing: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | END { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 55 | ▶ | if ($RAN_TEST) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=3 SCAR=11.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 37 | ▶ | unless (builder->finished) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | die "You need to call `done_testing` before exit"; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 55 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 236 | __END__ | ||||||||||||||||||||||||||||||||||||||||||