| 1 | ### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ### $Release: 0.0103 $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ### $Copyright: copyright(c) 2010-2011 kuwata-lab.com all rights reserved $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ### $License: MIT License $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package Oktest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | our @EXPORT = qw(OK pre_cond topic case_when spec before after before_all after_all at_end skip_when TODO); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | our @EXPORT_OK = qw(run main with); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | our $VERSION = ('$Release: 0.0103 $' =~ /\d+(\.\d+)*/ && $&); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
'$Release: 0.0103 $' =~ /\d+(\.\d+)*/ && $&
MC/DC0%0/2
'$Release: 0.0103 $' =~ /\d+(\.\d+)*/ && $&
'$Release: 0.0103 $' =~ /\d+(\.\d+)*/
$&
Truth table33%1/3
A && B
A= '$Release: 0.0103 $' =~ /\d+(\.\d+)*/B= $&
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | our @__assertion_objects = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | our @__at_end_blocks = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 348 | ▶ | sub OK { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
OK: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 348 | my ($actual) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 348 | my ($pkgname, $filepath, $linenum) = caller(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 348 | my $location = [$filepath, $linenum, $pkgname]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 348 | my $ao = Oktest::AssertionObject->new($actual, $location); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 348 | push(@__assertion_objects, $ao); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 348 | return $ao; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 7 | *pre_cond = *OK; ## alias of OK(), representing pre-condition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 221 | ▶ | sub topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
topic: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 221 | my ($topic_name, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 221 | my $to = Oktest::TopicObject->new($topic_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 221 | return __yield_block($to, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 19 | ▶ | sub case_when { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
case_when: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 19 | my ($description, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 19 | my $co = Oktest::CaseObject->new('When ' . $description, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 19 | return __yield_block($co, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 240 | ▶ | sub __yield_block { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__yield_block: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 240 | my ($to, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 240 | my $parent = $Oktest::TopicObject::__current; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 240 | ▶ | if ($parent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 142 | $parent->_add_topic($to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 98 | push(@Oktest::TopicObject::__tops, $to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 240 | $Oktest::TopicObject::__current = $to; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 240 | $block->($to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 240 | $Oktest::TopicObject::__current = $parent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 240 | return $to; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 352 | ▶ | sub spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spec: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 352 | my ($spec_desc, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 352 | ▶ | $block ||= sub { TODO("not implemented yet.") }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$block ||= sub {
TODO("not implemented yet.");
}
MC/DC0%0/2
$block ||= sub {
TODO("not implemented yet.");
}
$block
sub {
TODO("not implemented yet.");
}
Truth table66%2/3
A ||= B
A= $blockB= sub {
TODO("not implemented yet.");
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 352 | my $so = Oktest::SpecObject->new($spec_desc, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 352 | my $to = $Oktest::TopicObject::__current; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 352 | ▶ | $to->_add_spec($so) if $to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 352 | return $so; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 72 | ▶ | sub _set_fixture { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_fixture: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 72 | my ($name, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 72 | ▶ | my $to = $Oktest::TopicObject::__current | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | or die "$name() should be called in topic block."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 68 | $to->$name($block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 21 | ▶ | sub before(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 21 | _set_fixture('before', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 19 | ▶ | sub after(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 19 | _set_fixture('after', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 16 | ▶ | sub before_all(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_all: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 16 | _set_fixture('before_all', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 16 | ▶ | sub after_all(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_all: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 16 | _set_fixture('after_all', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 4 | ▶ | sub at_end(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at_end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 4 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ## todo: check whether at_end() is called in spec block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 4 | push(@Oktest::__at_end_blocks, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 218 | ▶ | sub __at_end_of_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__at_end_of_spec: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ## run closures in reverse order | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 218 | for my $block (reverse(@Oktest::__at_end_blocks)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | $block->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 218 | @Oktest::__at_end_blocks = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 27 | ▶ | sub skip_when { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_when: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 27 | my ($condition, $reason) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 27 | ▶ | if ($condition) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 26 | die "[Skipped] " . $reason . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 27 | ▶ | sub TODO { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TODO: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 27 | my ($description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 27 | die "[TODO] " . $description . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 7 | our %_default_opts = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | reporter => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | style => 'tap', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | spec => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | topic => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | report_skipped => 0==1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | report_todo => 0==1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 60 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 60 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 60 | %opts = (%_default_opts, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 60 | ▶ | my $reporter = $opts{reporter} || Oktest::Reporter::create_instance($opts{style}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts{'reporter'} || Oktest::Reporter::create_instance($opts{'style'})
MC/DC0%0/2
$opts{'reporter'} || Oktest::Reporter::create_instance($opts{'style'})
$opts{'reporter'}
Oktest::Reporter::create_instance($opts{'style'})
Truth table66%2/3
A || B
A= $opts{'reporter'}B= Oktest::Reporter::create_instance($opts{'style'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 60 | my $runner = $Oktest::Runner::RUNNER->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 60 | $runner->{reporter} = $reporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 60 | $runner->{filter_spec} = $opts{spec}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 60 | $runner->{filter_topic} = $opts{topic}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 60 | ▶ | $reporter->{report_skipped} ||= $opts{report_skipped}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$reporter->{"report_skipped"} ||= $opts{"report_skipped"}
MC/DC100%2/2
$reporter->{"report_skipped"} ||= $opts{"report_skipped"}
$reporter->{"report_skipped"}
$opts{"report_skipped"}
Truth table100%3/3
A ||= B
A= $reporter->{"report_skipped"}B= $opts{"report_skipped"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 60 | ▶ | $reporter->{report_todo} ||= $opts{report_todo}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$reporter->{"report_todo"} ||= $opts{"report_todo"}
MC/DC100%2/2
$reporter->{"report_todo"} ||= $opts{"report_todo"}
$reporter->{"report_todo"}
$opts{"report_todo"}
Truth table100%3/3
A ||= B
A= $reporter->{"report_todo"}B= $opts{"report_todo"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 60 | my @topics = @Oktest::TopicObject::__tops; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 60 | $runner->run_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 26 | ▶ | sub main { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
main: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 26 | Oktest::MainApp->new(@_)->execute(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub with(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
with: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return $block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 118 | ▶ | sub __clear { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__clear: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 118 | @__assertion_objects = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 118 | Oktest::TopicObject::__clear(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | ▶ | sub __at_exit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__at_exit: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 8 | for my $ao (@__assertion_objects) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 137 | ▶ | unless ($ao->{_done}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | my ($filepath, $linenum, $pkgname) = @{$ao->{location}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | warn "*** OK() called but not tested at '$filepath' line $linenum.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 7 | ▶ | END { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 7 | __at_exit(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 219 | ▶ | sub __sweep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__sweep: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 219 | @__assertion_objects = grep { ! $_->{_done} } @__assertion_objects; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | package Oktest::TopicObject; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | our $__current = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 7 | our @__tops = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 7 | our $EXEC = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 7 | our $IGNORE = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 7 | our $ENTER = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 6 | ▶ | sub __last { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__last: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 6 | return $__tops[$#__tops]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 118 | ▶ | sub __clear { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__clear: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 118 | $Oktest::TopicObject::__current = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 118 | @Oktest::TopicObject::__tops = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 240 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 240 | my ($class, $name, $parent) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 240 | my $this = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | parent => $parent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | topics => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | specs => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | status => $EXEC, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 240 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 197 | ▶ | sub accept { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accept: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 197 | my ($this, $runner, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 197 | return $runner->run_topic($this, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 142 | ▶ | sub _add_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_topic: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 142 | my ($this, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 142 | ▶ | die unless $to->isa('Oktest::TopicObject'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 142 | push(@{$this->{topics}}, $to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 142 | $to->{parent} = $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 142 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 349 | ▶ | sub _add_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_spec: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 349 | my ($this, $so) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 349 | ▶ | die unless $so->isa('Oktest::SpecObject'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 349 | push(@{$this->{specs}}, $so); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 349 | $so->{parent} = $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 349 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 127 | ▶ | sub _count_specs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_count_specs: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 127 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 127 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 127 | for my $to (@{$this->{topics}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 73 | $n += $to->_count_specs(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 127 | ▶ | if ($this->{status} == $EXEC) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 51 | for my $so (@{$this->{specs}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 63 | ▶ | $n++ if $so->{status} == $EXEC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 127 | return $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 20 | ▶ | sub before { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 20 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 20 | $this->{_before} = $block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 18 | ▶ | sub after { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 18 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 18 | $this->{_after} = $block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 15 | ▶ | sub before_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 15 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 15 | $this->{_before_all} = $block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 15 | ▶ | sub after_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 15 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 15 | $this->{_after_all} = $block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 7 | $INC{'Oktest/TopicObject'} = __FILE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | package Oktest::CaseObject; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 7 | our @ISA = ('Oktest::TopicObject'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 19 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 19 | my ($class, $desc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 19 | my $this = $class->SUPER::new($desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 19 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | package Oktest::SpecObject; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 7 | our $EXEC = $Oktest::TopicObject::EXEC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 352 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 352 | my ($class, $desc, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 352 | my $this = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | desc => $desc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | parent => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | block => $block, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | status => $EXEC, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 352 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 219 | ▶ | sub accept { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accept: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 219 | my ($this, $runner, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 219 | return $runner->run_spec($this, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | package Oktest::AssertionObject; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 7 | ▶ | use Text::Diff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 7 | ▶ | use Scalar::Util qw(refaddr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 7 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 349 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 349 | my ($class, $actual, $location) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 349 | my $this = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | actual => $actual, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | location => $location, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | _done => 0==1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 349 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 355 | ▶ | sub _done { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_done: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 355 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 355 | $this->{_done} = 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 355 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 7 | our $__dumped_with_indent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 7 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 7 | $_ = Dumper([1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 7 | $__dumped_with_indent = / 1/m; ## true for Perl<=5.22, false for Perl>=5.14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 163 | ▶ | sub _repr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_repr: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 163 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 163 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 163 | ▶ | if ($__dumped_with_indent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return Dumper($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 163 | local $Data::Dumper::Pad = ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 163 | my $s = Dumper($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 163 | $s =~ s/^ //; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 163 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 165 | ▶ | sub _validate_expected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_expected: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 165 | my ($this, $expected, $op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 165 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 165 | ▶ | if (Oktest::Util::is_string($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | "[ERROR] right hand of '" . $op . "' should not be a string.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | " \$actual: " . _repr($this->{actual}) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 165 | return $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 49 | ▶ | sub _failed_message { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_failed_message: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 49 | my ($this, $actual, $op, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 49 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | "[Failed] \$actual " . $op . " \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | " \$actual: " . _repr($actual) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 49 | return $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 111 | ▶ | sub _die { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_die: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 111 | my ($this, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 111 | my $stacktrace = _stacktrace(2, 20); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 111 | ▶ | $errmsg .= "\n" unless $errmsg =~ /\n$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 111 | die $errmsg . $stacktrace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 111 | ▶ | sub _stacktrace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stacktrace: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 111 | my ($depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 111 | my $max = 20; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 111 | my $i = $depth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 111 | ▶ | for (; $i < $max; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 197 | my ($pkgname, $filename, $linenum, @rest) = caller($i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 197 | ▶ | last if $filename ne __FILE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 111 | my $str = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 111 | ▶ | for (; $i < $max; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 306 | my ($pkgname, $filename, $linenum, @rest) = caller($i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 306 | ▶ | last if ! $filename || $filename eq __FILE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $filename or $filename eq __FILE__
MC/DC100%2/2
not $filename or $filename eq __FILE__
not $filename
$filename eq __FILE__
Truth table100%3/3
not(A) or B
A= not $filenameB= $filename eq __FILE__
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 195 | $str .= "File '$filename', line $linenum:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 195 | ▶ | if (-f $filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 195 | my $line = Oktest::Util::read_line_from($filename, $linenum); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 195 | $str .= " " . Oktest::Util::strip($line) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 111 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 211 | ▶ | sub _assert(&@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assert: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 211 | my ($closure, $op, $validate, $this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 211 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 211 | ▶ | if ($validate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 165 | my $msg = $this->_validate_expected($expected, $op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 165 | ▶ | die $msg if $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | #unless (defined($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # "[ERROR] OK() $op \$expected: \$expected is undefined value.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # $this->_die($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 210 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | #unless (defined($actual)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # "[ERROR] OK(\$actual): \$actual is undefined value.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # $this->_die($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 210 | ▶ | return $this if $closure->($actual, $expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 49 | my $msg = $this->_failed_message($actual, $op, $expected); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 49 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 7 | ▶ | '==' => \&_num_eq, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | '!=' => \&_num_ne, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | '>' => \&_num_gt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | '>=' => \&_num_ge, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | '<' => \&_num_lt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | '<=' => \&_num_le, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 'eq' => \&_str_eq, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 'ne' => \&_str_ne, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 'lt' => \&_str_lt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 'le' => \&_str_le, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 'gt' => \&_str_gt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 7 | 'ge' => \&_str_ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 136 | ▶ | sub _num_eq { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_eq: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | #my ($this, $expected) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 7 | ▶ | no warnings 'uninitialized'; # suppress warning 'Use of uninitialized value' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 136 | ▶ | return _assert { $_[0] == $_[1] } '==', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 5 | ▶ | sub _num_ne { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_ne: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #my ($this, $expected) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | ▶ | return _assert { $_[0] != $_[1] } '!=', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 6 | ▶ | sub _num_gt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_gt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 6 | ▶ | return _assert { $_[0] > $_[1] } '>', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 6 | ▶ | sub _num_ge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_ge: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 6 | ▶ | return _assert { $_[0] >= $_[1] } '>=', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 6 | ▶ | sub _num_lt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_lt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 6 | ▶ | return _assert { $_[0] < $_[1] } '<', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 6 | ▶ | sub _num_le { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num_le: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 6 | ▶ | return _assert { $_[0] <= $_[1] } '<=', 1, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 22 | ▶ | sub _str_eq { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_eq: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | #return _assert { $_[0] eq $_[1] } 'eq', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 22 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 22 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 22 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 22 | ▶ | return $this if $actual eq $expected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 7 | ▶ | if ($actual !~ /\n/ && $expected !~ /\n/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$actual =~ /\n/ || $expected =~ /\n/
MC/DC100%2/2
$actual =~ /\n/ || $expected =~ /\n/
$actual =~ /\n/
$expected =~ /\n/
Truth table100%3/3
A || B
A= $actual =~ /\n/B= $expected =~ /\n/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 3 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | "[Failed] \$actual eq \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | " \$actual: " . _repr($actual) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 3 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | #if ($actual !~ /\n$/ || $expected !~ /\n$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 4 | my $append = "\\ No newline at end\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 4 | ▶ | $actual .= $append if $actual !~ /\n$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 4 | ▶ | $expected .= $append if $expected !~ /\n$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 4 | my $diff = Text::Diff::diff(\$expected, \$actual, {STYLE=>'Unified'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 4 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | "[Failed] \$actual eq \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | "--- \$expected\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | "+++ \$actual\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | $diff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 4 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 8 | ▶ | sub _str_ne { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_ne: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 8 | ▶ | return _assert { $_[0] ne $_[1] } 'ne', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 6 | ▶ | sub _str_gt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_gt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 6 | ▶ | return _assert { $_[0] gt $_[1] } 'gt', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 6 | ▶ | sub _str_ge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_ge: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 6 | ▶ | return _assert { $_[0] ge $_[1] } 'ge', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 6 | ▶ | sub _str_lt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_lt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 6 | ▶ | return _assert { $_[0] lt $_[1] } 'lt', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 6 | ▶ | sub _str_le { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_le: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 7 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 6 | ▶ | return _assert { $_[0] le $_[1] } 'le', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 15 | ▶ | sub cmp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmp: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 15 | my ($this, $op, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 15 | ▶ | if ($op eq '==') { return $this->_num_eq($expected); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | elsif ($op eq '!=') { return $this->_num_ne($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | elsif ($op eq '<' ) { return $this->_num_lt($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | elsif ($op eq '<=') { return $this->_num_le($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | elsif ($op eq '>' ) { return $this->_num_gt($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | elsif ($op eq '>=') { return $this->_num_ge($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | elsif ($op eq 'eq') { return $this->_str_eq($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 1 | elsif ($op eq 'ne') { return $this->_str_ne($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | elsif ($op eq 'lt') { return $this->_str_lt($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 1 | elsif ($op eq 'le') { return $this->_str_le($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | elsif ($op eq 'gt') { return $this->_str_gt($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | elsif ($op eq 'ge') { return $this->_str_ge($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | elsif ($op eq '=~') { return $this->matches($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | elsif ($op eq '!~') { return $this->not_match($expected); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1 | else { $this->_die("[ERROR] OK()->cmp(): '$op': unknown operator.\n"); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 4 | ▶ | sub in_delta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_delta: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 4 | my ($this, $expected, $delta) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 4 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 4 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 4 | my ($min, $max) = ($expected - $delta, $expected + $delta); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 4 | ▶ | unless ($min <= $actual) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | '[Failed] $expected - $delta <= $actual : failed.\n' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | ' $expected - $delta: ' . $min . '\n' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | ' $actual: ' . $actual . '\n'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | $msg =~ s/\\n/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 3 | ▶ | unless ($actual <= $max) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | '[Failed] $actual <= $expected + $delta : failed.\n' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | ' $actual: ' . $actual . '\n' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | ' $expected + $delta: ' . $max . '\n'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | $msg =~ s/\\n/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 8 | ▶ | sub matches { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matches: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 8 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 8 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 8 | ▶ | defined($expected) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | or $this->_die("[ERROR] OK(): use matches(qr/pattern/) instead of matches(/pattern/)."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 7 | ▶ | return _assert { $_[0] =~ $_[1] } '=~', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 8 | ▶ | sub not_match { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_match: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 8 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 8 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 8 | ▶ | defined($expected) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | or $this->_die("[ERROR] OK(): use not_match(qr/pattern/) instead of not_match(/pattern/)."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 7 | ▶ | return _assert { $_[0] !~ $_[1] } '!~', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 6 | ▶ | sub is_a { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_a: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 7 | ▶ | no warnings 'misc'; # suppress warning of "Can't locate package %s for %s::ISA" (for Perl 5.8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 7 | ▶ | no warnings 'syntax'; # suppress warning of "Can't locate package %s for %s::ISA" (for Perl 5.10 or later) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 6 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 6 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | #return _assert { $_[0]->isa($_[1]) } ' instanceof ', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 6 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 6 | ▶ | unless ($actual->isa($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | #my $msg = $this->_failed_message($actual, $op, $expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 2 | my $msg = "[Failed] \$actual->isa(\$expected) : failed.\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | . " \$actual: " . _repr($actual) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | . " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 4 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 3 | ▶ | sub not_a { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_a: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 7 | ▶ | no warnings 'misc'; # suppress warning of "Can't locate package %s for %s::ISA" (for Perl 5.8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 7 | ▶ | no warnings 'syntax'; # suppress warning of "Can't locate package %s for %s::ISA" (for Perl 5.10 or later) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 3 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 3 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | #return _assert { ! $_[0]->isa($_[1]) } ' instanceof ', 0, @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 3 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 3 | ▶ | if ($actual->isa($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | #my $msg = $this->_failed_message($actual, $op, $expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 1 | my $msg = "[Failed] ! \$actual->isa(\$expected) : failed.\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | . " \$actual: " . _repr($actual) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | . " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 12 | ▶ | sub dies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dies: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 12 | my ($this, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 12 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 12 | ▶ | $errmsg = '' unless defined($errmsg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 12 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 12 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 12 | eval { $actual->() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 12 | ▶ | unless ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 3 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | "[Failed] exception expected but nothing thrown.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | " \$expected: " . _repr($errmsg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 3 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 9 | my $ok = 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 9 | my $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 9 | ▶ | if (! $errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | # pass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | elsif (ref($errmsg) eq 'Regexp') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 4 | $ok = $@ =~ $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 4 | $op = '=~'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 4 | $ok = $@ eq $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 4 | ▶ | if (! $ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | my $s = substr($@, 0, length($errmsg)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1 | my $rest = substr($@, length($errmsg)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | ▶ | $ok = $s eq $errmsg && $rest =~ / at .*/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$s eq $errmsg && $rest =~ / at .*/
MC/DC0%0/2
$s eq $errmsg && $rest =~ / at .*/
$s eq $errmsg
$rest =~ / at .*/
Truth table33%1/3
A && B
A= $s eq $errmsgB= $rest =~ / at .*/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 4 | $op = 'eq'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 9 | ▶ | unless ($ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 3 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | '[Failed] $@ ' . $op . ' $expected : failed.' . "\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | ' $@: ' . _repr($@) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | ' $expected: ' . _repr($errmsg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 3 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 6 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 7 | ▶ | sub not_die { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_die: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 7 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 7 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 7 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 7 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 7 | eval { $actual->() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 7 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 3 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | "[Failed] no exception expected but thrown.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | " \$\@: " . _repr($@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 3 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 3 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 4 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 10 | ▶ | sub warns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warns: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 10 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 10 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 10 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | #my $warning = &Oktest::Util::capture_stderr(sub { $actual->() }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 10 | my $warning; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 10 | ▶ | local $SIG{__WARN__} = sub { $warning = shift }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 10 | $actual->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 10 | ▶ | unless ($warning) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 2 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | "[Failed] warning expected : failed (nothing printed).\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 3 | ▶ | my $new_msg = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 3 | my ($op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 3 | "[Failed] \$warning $op \$expected : failed.\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | " \$warning: " . _repr($warning) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 8 | ▶ | if (ref($expected) eq 'Regexp') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | #$this->_die($new_msg->('=~')) unless $warning =~ $expected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 4 | ▶ | unless ($warning =~ $expected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 2 | my $msg = $new_msg->('=~'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | #$this->_die($new_msg->('eq')) unless $warning eq $expected; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 4 | ▶ | unless ($warning eq $expected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 1 | my $msg = $new_msg->('eq'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 5 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 3 | ▶ | sub not_warn { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_warn: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 3 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 3 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 3 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 3 | ▶ | my $warning = &Oktest::Util::capture_stderr(sub { $actual->() }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 3 | ▶ | unless (! $warning) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | "[Failed] no warning expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | " \$warning: " . _repr($warning); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | ▶ | sub is_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_string: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 3 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 3 | return $this->_is_type('string', Oktest::Util::is_string($this->{actual})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 4 | ▶ | sub is_number { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_number: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 4 | return $this->_is_type('number', Oktest::Util::is_number($this->{actual})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 3 | ▶ | sub is_integer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_integer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 3 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 3 | return $this->_is_type('integer', Oktest::Util::is_integer($this->{actual})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 3 | ▶ | sub is_float { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_float: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 3 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 3 | return $this->_is_type('float', Oktest::Util::is_float($this->{actual})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 13 | ▶ | sub _is_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_type: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 13 | my ($this, $type, $bool) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 13 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 13 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 13 | ▶ | if (! $bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 8 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | "[Failed] \$actual : $type expected, but not.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 8 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 5 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 7 | ▶ | sub is_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ref: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 7 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 7 | return $this->_is_reference($expected, 'eq', 1==1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 5 | ▶ | sub not_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_ref: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 5 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 5 | return $this->_is_reference($expected, 'ne', 0==1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 12 | ▶ | sub _is_reference { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_reference: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 12 | my ($this, $expected, $op, $bool) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 12 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 12 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 12 | ▶ | unless ((ref($actual) eq $expected) == $bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 6 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | "[Failed] ref(\$actual) $op '$expected' : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | " ref(\$actual): '" . ref($actual) . "'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 6 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 6 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | #sub is_arrayref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | # return $this->_is_reftype('ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | #sub is_hashref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | # return $this->_is_reftype('HASH'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | #sub is_coderef { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # return $this->_is_reftype('CODE'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | #sub _is_reftype { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # my ($this, $reftype) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # $this->_done(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # my $actual = $this->{actual}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # if (ref($actual) ne $reftype) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # "[Failed] ref(\$actual) : $reftype expected, but got " . ref($actual) . ".\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # $this->_die($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # return $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 3 | ▶ | sub length { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=5 SCAR=16.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 3 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 3 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 3 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 3 | ▶ | if (Oktest::Util::is_string($actual)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 1 | ▶ | unless (CORE::length($actual) == $expected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | "[Failed] length(\$actual) == \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | " \$actual: " . _repr($actual) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | elsif (ref($actual)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 1 | my $n = $#{$actual} + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 1 | ▶ | unless ($n == $expected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | "[Failed] \$\#{$actual} + 1 == \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | " \$actual+1: $n\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | " \$expected: $expected\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | "[ERROR] \$actual : string or array expected.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 4 | ▶ | sub has { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 4 | my ($this, $name, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 4 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 4 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 4 | ▶ | unless (defined($actual->{$name})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | "[Failed] defined(\$actual->{$name}) : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | ' $actual: ' . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 3 | ▶ | if ($#_ == 2) { # when expected value is passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 2 | ▶ | unless ($actual->{$name} eq $expected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | "[Failed] \$actual->{$name} eq \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 1 | " \$actual->{$name}: " . _repr($actual->{$name}) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | " \$expected: " . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 5 | ▶ | sub can_ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 5 | my ($this, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 5 | return $this->_can_or_not($method, 1==1, 'can_', ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | ▶ | sub can_not { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_not: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 3 | my ($this, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 3 | return $this->_can_or_not($method, 0==1, 'can_not', '! '); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 8 | ▶ | sub _can_or_not { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_can_or_not: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 8 | my ($this, $method, $bool, $caller, $op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 8 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 8 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 8 | ▶ | unless ($method) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 2 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | "[ERROR] OK()->$caller(): method name required.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 6 | ▶ | unless (!! $actual->can($method) == $bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 3 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | "[Failed] $op\$actual->can('$method') : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 3 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 3 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 2 | ▶ | sub same { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
same: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 2 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 2 | return $this->_same_or_not($expected, '==', 1==1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 2 | ▶ | sub not_same { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_same: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 2 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 2 | return $this->_same_or_not($expected, '!=', 1!=1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 4 | ▶ | sub _same_or_not { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_same_or_not: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 4 | my ($this, $expected, $op, $bool) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 4 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 4 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 4 | ▶ | unless ((refaddr($actual) == refaddr($expected)) == $bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 2 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | '[Failed] refaddr($actual) ' . $op . ' refaddr($expected) : failed.' . "\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | ' $actual: ' . _repr($actual) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | ' $expected: ' . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 4 | ▶ | sub is_truthy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_truthy: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 4 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 4 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 4 | ▶ | unless ($this->{actual}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | "[Failed] OK(\$expression) : assertion failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 2 | " \$expression: " . _repr($this->{actual}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 2 | ▶ | sub is_falsy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_falsy: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 2 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 2 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 2 | ▶ | unless (! $this->{actual}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | "[Failed] OK(! \$expression) : assertion failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 1 | " \$expression: " . _repr($this->{actual}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 1 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 3 | ▶ | sub is_defined { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_defined: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 3 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 3 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 3 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 3 | ▶ | unless (defined($actual)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | "[Failed] defined(\$actual) : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 2 | ▶ | sub not_defined { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_defined: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 2 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 2 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 2 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 2 | ▶ | unless (! defined($actual)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | "[Failed] ! defined(\$actual) : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 1 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 1 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 4 | ▶ | sub equals { ## !! EXPERIMENTAL !! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equals: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 4 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 4 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 4 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 4 | ▶ | unless (ref($actual) eq ref($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | '[Failed] ref($actual) eq ref($expected) : failed.' . "\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | ' ref($actual): ' . _repr(ref($actual)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | ' ref($expected): ' . _repr(ref($expected)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | ' $actual: ' . _repr($actual) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | ' $expected: ' . _repr($expected); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 4 | my $actual_dump = Dumper($actual); # _repr($actual); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 4 | my $expected_dump = Dumper($expected); # _repr($expected); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 4 | ▶ | unless ($actual_dump eq $expected_dump) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 2 | my $diff = Text::Diff::diff(\$expected_dump, \$actual_dump, {STYLE=>'Unified'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 2 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | "[Failed] \$actual equals to \$expected : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | "--- Dumper(\$expected)\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | "+++ Dumper(\$actual)\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | $diff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 2 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 2 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | sub not_equal { ## !! EXPERIMENTAL !! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_equal: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | my ($this, $expected) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | if (Dumper($actual) eq Dumper($expected)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | "[Failed] \$actual and \$expected are not equal: failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | " \$actual and \$expected: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | ▶ | sub all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | my $index = &Oktest::Util::index_denied($block, @$actual); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | my $found = $index >= 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | if ($found) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | "[Failed] OK(\$actual)->all(sub{...}) : failed at index=$index.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | " \$actual->[$index]: " . _repr($actual->[$index]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | ▶ | sub any { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
any: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | my ($this, $block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | my $found = &Oktest::Util::index($block, @$actual) >= 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | ▶ | unless ($found) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | "[Failed] OK(\$actual)->any(sub{...}) : failed.\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | sub file_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_exists: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | return $this->_file_or_dir_exists('file', '-f', -f $this->{actual}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | ▶ | sub dir_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir_exists: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | return $this->_file_or_dir_exists('directory', '-d', -d $this->{actual}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | ▶ | sub _file_or_dir_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_file_or_dir_exists: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | my ($this, $kind, $op, $bool) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | unless ($bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | my $msg = ! -e $actual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | ? "[Failed] $op \$actual : failed ($kind not exist).\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | : "[Failed] $op \$actual : failed (not a $kind).\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | $msg .= " \$actual: " . _repr($actual); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | #sub not_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | # return $this->_not_file_or_dir('file', '-f', -f $this->{actual}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | #sub not_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | # return $this->_not_file_or_dir('directory', '-d', -d $this->{actual}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | #sub _not_file_or_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | # my ($this, $kind, $op, $bool) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | # $this->_done(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | # my $actual = $this->{actual}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | # unless (! $bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | # my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # "[Failed] ! $op \$actual : failed ($kind exists).\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | # " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | # $this->_die($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | # return $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | #sub exist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # my ($this) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # $this->_done(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | # my $actual = $this->{actual}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | # unless (-e $actual) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | # my $msg = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | # "[Failed] -e \$actual : failed (file or directory not found).\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | # " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | # $this->_die($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | # return $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | ▶ | sub not_exist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_exist: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | $this->_done(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | my $actual = $this->{actual}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | unless (! -e $actual) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | "[Failed] ! -e \$actual : failed (file or directory exists).\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | " \$actual: " . _repr($actual); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | $this->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | package Oktest::Runner; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 7 | our $RUNNER = 'Oktest::Runner::DefaultRunner'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | package Oktest::Runner::Base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 61 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 61 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 61 | my $this = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 'reporter' => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 61 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 880 | ▶ | sub reporter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reporter: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 880 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 880 | ▶ | $this->{reporter} ||= $Oktest::Reporter::REPORTER->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$this->{"reporter"} ||= $Oktest::Reporter::REPORTER->new
MC/DC0%0/2
$this->{"reporter"} ||= $Oktest::Reporter::REPORTER->new
$this->{"reporter"}
$Oktest::Reporter::REPORTER->new
Truth table33%1/3
A ||= B
A= $this->{"reporter"}B= $Oktest::Reporter::REPORTER->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 880 | return $this->{reporter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | ▶ | sub run_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_all: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | sub run_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_topic: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | sub run_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_spec: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | my ($this, $so, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 219 | ▶ | sub detect_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detect_status: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 219 | my ($this, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 219 | ▶ | return '.' unless $errmsg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 105 | ▶ | return 'f' if $errmsg =~ /^\[Failed\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 77 | ▶ | return 'E' if $errmsg =~ /^\[ERROR\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 77 | ▶ | return 's' if $errmsg =~ /^\[Skipped\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 52 | ▶ | return 't' if $errmsg =~ /^\[TODO\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | #return '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 27 | return 'E'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | package Oktest::Runner::DefaultRunner; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 7 | our @ISA = ('Oktest::Runner::Base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 7 | our $EXEC = $Oktest::TopicObject::EXEC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 7 | our $IGNORE = $Oktest::TopicObject::IGNORE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 7 | our $ENTER = $Oktest::TopicObject::ENTER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 61 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 61 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 61 | my $this = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 61 | $this->{depth} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 61 | return $this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 60 | ▶ | sub run_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_all: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 60 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 60 | $this->_filter(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 60 | $this->reporter->enter_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 60 | for my $to (@topics) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | #$this->run_topic($to, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 87 | $to->accept($this, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 60 | $this->reporter->exit_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 197 | ▶ | sub run_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_topic: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 197 | my ($this, $to, $depth) = @_; ## $to is a TopicObject | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 197 | ▶ | return if $to->{status} == $IGNORE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 161 | $this->reporter->enter_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 161 | ▶ | $to->{_before_all}->() if $to->{_before_all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 161 | ▶ | if ($to->{status} == $EXEC) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 147 | for my $so (@{$to->{specs}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | #$this->run_spec($so, $depth + 1) if $so->{status} == $EXEC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 222 | ▶ | $so->accept($this, $depth + 1) if $so->{status} == $EXEC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 161 | for my $child (@{$to->{topics}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | #$this->run_topic($child, $depth + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 110 | $child->accept($this, $depth + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 161 | ▶ | $to->{_after_all}->() if $to->{_after_all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 161 | $this->reporter->exit_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 219 | ▶ | sub run_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_spec: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 219 | my ($this, $so, $depth) = @_; ## $so is a SpecObject | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 219 | $this->reporter->enter_spec($so, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | my $context = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | spec => $so->{desc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | topic => $so->{parent}->{name}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 219 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 219 | my $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 219 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 219 | eval { $this->_run_befores($so, $context) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 219 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 1 | $errmsg = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 1 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 218 | eval { $so->{block}->($context) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 218 | $errmsg = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 218 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 218 | eval { Oktest::__at_end_of_spec() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 218 | ▶ | $errmsg .= $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 218 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 218 | eval { $this->_run_afters($so, $context) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 218 | ▶ | $errmsg .= $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 218 | undef $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 219 | my $status = $this->detect_status($errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 219 | $this->reporter->exit_spec($so, $depth, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 219 | Oktest::__sweep(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 219 | ▶ | sub _run_befores { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_run_befores: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 219 | my ($this, $so, $context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 219 | my $to = $so->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | ## parent-first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 219 | my @arr = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 219 | ▶ | while ($to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 447 | push(@arr, $to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 447 | $to = $to->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 219 | for $to (reverse(@arr)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 447 | ▶ | $to->{_before}->($context) if $to->{_before}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 218 | ▶ | sub _run_afters { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_run_afters: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 218 | my ($this, $so, $context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 218 | my $to = $so->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | ## child-first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 218 | ▶ | while ($to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 446 | ▶ | $to->{_after}->($context) if $to->{_after}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 445 | $to = $to->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 60 | ▶ | sub _filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 60 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 60 | my $pat1 = $this->{filter_spec}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 60 | ▶ | _filter_specs($pat1, @topics) if $pat1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 60 | my $pat2 = $this->{filter_topic}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 60 | ▶ | _filter_topics($pat2, @topics) if $pat2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 60 | ▶ | if ($pat1 || $pat2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$pat1 or $pat2
MC/DC100%2/2
$pat1 or $pat2
$pat1
$pat2
Truth table100%3/3
A or B
A= $pat1B= $pat2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 10 | _change_status_recursively($_) for @topics; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 38 | ▶ | sub _filter_specs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter_specs: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 38 | my ($pat, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 38 | for my $to (@topics) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 34 | my $found = 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 34 | for my $so (@{$to->{specs}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 62 | ▶ | if ($so->{desc} =~ $pat) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 6 | $found = 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 56 | $so->{status} = $IGNORE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 34 | ▶ | $to->{status} = $IGNORE unless $found; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 34 | _filter_specs($pat, @{$to->{topics}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 53 | ▶ | sub _filter_topics { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter_topics: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 53 | my ($pat, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 53 | for my $to (@topics) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 54 | ▶ | unless ($to->{name} =~ $pat) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 47 | $to->{status} = $IGNORE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 47 | _filter_topics($pat, @{$to->{topics}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 90 | ▶ | sub _change_status_recursively { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_change_status_recursively: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 90 | my ($to) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 90 | my $flag = 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 90 | for my $child (@{$to->{topics}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 56 | my $ret = _change_status_recursively($child); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 56 | ▶ | $flag = 1==1 if $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 90 | ▶ | if ($to->{status} != $IGNORE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 14 | return 1==1; # not ignored | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | elsif ($flag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 14 | $to->{status} = $ENTER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 14 | return 1==1; # not ignored, because non-ignored topic exists in topics | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 62 | return 0==1; # ignored | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | package Oktest::Reporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 7 | our $REPORTER = 'Oktest::Reporter::TapReporter'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 7 | our %_registered = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | tap => 'Oktest::Reporter::TapReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | verbose => 'Oktest::Reporter::VerboseReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | simple => 'Oktest::Reporter::SimpleReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | plain => 'Oktest::Reporter::PlainReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 't' => 'Oktest::Reporter::TapReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 'v' => 'Oktest::Reporter::VerboseReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 's' => 'Oktest::Reporter::SimpleReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 'p' => 'Oktest::Reporter::PlainReporter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 61 | ▶ | sub create_instance { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_instance: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 61 | my ($style) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 61 | ▶ | $style ||= 'tap'; # default: 'tap' style | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$style ||= "tap"
MC/DC100%1/1
$style ||= "tap"
$style
Truth table100%2/2
A
A= $style
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 61 | my $class = $Oktest::Reporter::_registered{$style}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 61 | ▶ | return unless $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 61 | return $class->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | package Oktest::Reporter::Base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 7 | ▶ | use Time::HiRes qw(gettimeofday tv_interval); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 7 | our %STATUS_LABELS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | '.' => 'ok', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 'f' => 'Failed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 'E' => 'ERROR', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 's' => 'Skipped', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 't' => 'TODO', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | '?' => '???', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 61 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 61 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 61 | my $this = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | count => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | counts => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | separator => '-' x 70, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 61 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 180 | ▶ | sub _indent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_indent: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 180 | my ($this, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 180 | return ' ' x $depth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 60 | ▶ | sub enter_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 60 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | 60 | $this->{_started_at} = [gettimeofday()]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 60 | ▶ | sub exit_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_all: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 60 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 60 | my $elapsed = tv_interval($this->{_started_at}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 60 | undef $this->{_started_at}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 60 | my $c = $this->{counts}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | my $s = sprintf("## ok:%s, failed:%s, error:%s, skipped:%s, todo:%s (elapsed: %.3f)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 60 | ▶ | $c->{'.'}||0, $c->{'f'}||0, $c->{'E'}||0, $c->{'s'}||0, $c->{'t'}||0, $elapsed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%10/10
$c->{'.'} || 0
$c->{'f'} || 0
$c->{'E'} || 0
$c->{'s'} || 0
$c->{'t'} || 0
MC/DC100%1/1
$c->{'.'} || 0
$c->{'.'}
MC/DC100%1/1
$c->{'f'} || 0
$c->{'f'}
MC/DC100%1/1
$c->{'E'} || 0
$c->{'E'}
MC/DC100%1/1
$c->{'s'} || 0
$c->{'s'}
MC/DC100%1/1
$c->{'t'} || 0
$c->{'t'}
Truth table100%2/2
A
A= $c->{'.'}
Truth table100%2/2
A
A= $c->{'f'}
Truth table100%2/2
A
A= $c->{'E'}
Truth table100%2/2
A
A= $c->{'s'}
Truth table100%2/2
A
A= $c->{'t'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 60 | print $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 94 | ▶ | sub enter_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_topic: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 94 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 159 | ▶ | sub exit_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_topic: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 159 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 219 | ▶ | sub enter_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_spec: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 219 | my ($this, $so, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 219 | ▶ | sub exit_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_spec: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 219 | my ($this, $so, $depth, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 219 | ++$this->{counts}->{$status}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 219 | ++$this->{count}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 124 | ▶ | sub _error_should_be_reported { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error_should_be_reported: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 124 | my ($this, $status) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 124 | ▶ | return 1==1 if $status eq 's' && $this->{report_skipped}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$status eq "s" and $this->{"report_skipped"}
MC/DC100%2/2
$status eq "s" and $this->{"report_skipped"}
$status eq "s"
$this->{"report_skipped"}
Truth table100%3/3
A and B
A= $status eq "s"B= $this->{"report_skipped"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 116 | ▶ | return 1==1 if $status eq 't' && $this->{report_todo}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$status eq "t" and $this->{"report_todo"}
MC/DC100%2/2
$status eq "t" and $this->{"report_todo"}
$status eq "t"
$this->{"report_todo"}
Truth table100%3/3
A and B
A= $status eq "t"B= $this->{"report_todo"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 108 | ▶ | return 1==1 if $status ne 's' && $status ne 't'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$status ne "s" and $status ne "t"
MC/DC100%2/2
$status ne "s" and $status ne "t"
$status ne "s"
$status ne "t"
Truth table100%3/3
A and B
A= $status ne "s"B= $status ne "t"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 48 | return 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 73 | ▶ | sub _report_errmsg_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_report_errmsg_list: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 73 | my ($this, @exc_items) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 73 | for (@exc_items) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 57 | my ($so, $depth, $status, $errmsg) = @$_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 57 | $this->_print_separator(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 57 | $this->_report_errmsg($so, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 73 | ▶ | $this->_print_separator() if @exc_items; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 103 | ▶ | sub _print_separator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_print_separator: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 103 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | 103 | print '# ', $this->{separator}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 67 | ▶ | sub _report_errmsg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_report_errmsg: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 67 | my ($this, $so, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 67 | ▶ | if ($status eq 'f') { $errmsg =~ s/^\[Failed\]/Assertion:/ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | elsif ($status eq 'E') { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 6 | elsif ($status eq 's') { $errmsg =~ s/^\[Skipped\]/Reason:/ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 6 | elsif ($status eq 't') { $errmsg =~ s/^\[TODO\]/Description:/ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | else { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 67 | print '# [', $STATUS_LABELS{$status}, '] * ', $this->_breadcrumb($so), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 67 | $_ = $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 67 | s/^/# /mg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 67 | s/\n$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 67 | print $_, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 67 | ▶ | sub _breadcrumb { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_breadcrumb: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 67 | my ($this, $so) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 67 | my @arr = $this->_path_elems($so); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 67 | return join(' > ', @arr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 67 | ▶ | sub _path_elems { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_path_elems: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 67 | my ($this, $so) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 67 | my @arr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 67 | my $x = $so->{desc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 67 | push(@arr, $so->{desc}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 67 | my $to = $so->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 67 | ▶ | while ($to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 129 | push(@arr, $to->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 129 | $to = $to->{parent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 67 | return reverse(@arr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 127 | ▶ | sub _itemize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_itemize: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 127 | my ($this, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 127 | ▶ | return $to->isa('Oktest::CaseObject') ? '- ' : '* '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | package Oktest::Reporter::TapReporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 7 | our @ISA = ('Oktest::Reporter::Base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 27 | ▶ | sub enter_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_all: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 27 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 27 | $this->SUPER::enter_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | 27 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 27 | for my $to (@topics) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 54 | $n += $to->_count_specs(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 27 | print "1..$n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 65 | ▶ | sub enter_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_topic: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 65 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 65 | print '## ', $this->_indent($depth), $this->_itemize($to), $to->{name}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 60 | ▶ | sub exit_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_spec: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 60 | my ($this, $so, $depth, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 60 | $this->SUPER::exit_spec($so, $depth, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 60 | my $n = $this->{count}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 60 | ▶ | if (! $errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 48 | print 'ok ', $n, ' - ', $so->{desc}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | elsif ($status eq 's') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 1 | my $reason = $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 1 | $reason =~ s/^\[Skipped\] ?//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 1 | chomp($reason); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 1 | print 'ok ', $n, ' - ', $so->{desc}, ' # skip - ', $reason, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | elsif ($status eq 't') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 1 | my $desc = $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 1 | $desc =~ s/^\[TODO\] ?//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 1 | chomp($desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 1 | print 'not ok ', $n, ' - ', $so->{desc}, ' # TODO - ', $desc, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 10 | print 'not ok ', $n, ' - ', $so->{desc}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 10 | $this->_print_separator(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 10 | $this->_report_errmsg($so, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 10 | $this->_print_separator(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | package Oktest::Reporter::VerboseReporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 7 | our @ISA = ('Oktest::Reporter::Base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 11 | ▶ | sub enter_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 11 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 11 | $this->SUPER::enter_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 11 | $this->{exc_stack} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 32 | ▶ | sub enter_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_topic: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 32 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 32 | $this->SUPER::enter_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 32 | push(@{$this->{exc_stack}}, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 32 | print $this->_indent($depth), $this->_itemize($to), $to->{name}, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 32 | ▶ | sub exit_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_topic: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 32 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 32 | $this->SUPER::exit_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 32 | my $exc_items = pop(@{$this->{exc_stack}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 32 | $this->_report_errmsg_list(@$exc_items); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 32 | undef @$exc_items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 53 | ▶ | sub exit_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_spec: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 53 | my ($this, $so, $depth, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 53 | $this->SUPER::exit_spec($so, $depth, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 53 | my $label = $Oktest::Reporter::Base::STATUS_LABELS{$status}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 53 | print $this->_indent($depth), "- [", $label, "] ", $so->{desc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 53 | ▶ | if ($errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 31 | ▶ | if ($status eq 's' || $status eq 't') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$status eq "s" or $status eq "t"
MC/DC100%2/2
$status eq "s" or $status eq "t"
$status eq "s"
$status eq "t"
Truth table100%3/3
A or B
A= $status eq "s"B= $status eq "t"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 16 | $_ = $errmsg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 16 | s/^\[(Skipped|TODO)\] ?//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 16 | chomp(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 16 | print ' ## ', $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 31 | ▶ | if ($this->_error_should_be_reported($status)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 19 | my $arr = Oktest::Util::last_item(@{$this->{exc_stack}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 19 | push(@$arr, [$so, $depth, $status, $errmsg]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 53 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | package Oktest::Reporter::SimpleReporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 7 | our @ISA = ('Oktest::Reporter::Base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 11 | ▶ | sub enter_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 11 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 11 | $this->SUPER::enter_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 11 | $this->{exc_stack} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 11 | $this->{_nl} = 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | 32 | ▶ | sub enter_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_topic: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 32 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 32 | ▶ | return if $to->isa('Oktest::CaseObject'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 30 | $this->SUPER::enter_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 30 | push(@{$this->{exc_stack}}, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 30 | ▶ | print "\n" unless $this->{_nl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 30 | print $this->_indent($depth), $this->_itemize($to), $to->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 30 | ▶ | print ": " if @{$to->{specs}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 30 | $this->{_nl} = 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 32 | ▶ | sub exit_topic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_topic: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 32 | my ($this, $to, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 32 | ▶ | return if $to->isa('Oktest::CaseObject'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | 30 | $this->SUPER::exit_topic($to, $depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 30 | my $exc_items = pop(@{$this->{exc_stack}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 30 | ▶ | print "\n" unless $this->{_nl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 30 | $this->{_nl} = 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 30 | $this->_report_errmsg_list(@$exc_items); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 30 | undef @$exc_items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 53 | ▶ | sub exit_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_spec: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 53 | my ($this, $so, $depth, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 53 | $this->SUPER::exit_spec($so, $depth, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 53 | print $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 53 | ▶ | if ($errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 31 | ▶ | if ($this->_error_should_be_reported($status)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | #my @stack = @{$this->{exc_stack}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | #my $arr = $stack[$#stack]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 19 | my $arr = Oktest::Util::last_item(@{$this->{exc_stack}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 19 | push(@$arr, [$so, $depth, $status, $errmsg]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | package Oktest::Reporter::PlainReporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 7 | our @ISA = ('Oktest::Reporter::Base'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 11 | ▶ | sub enter_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enter_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 11 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 11 | $this->SUPER::enter_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 11 | $this->{exc_items} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 11 | ▶ | sub exit_all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_all: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 11 | my ($this, @topics) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 11 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 11 | $this->_report_errmsg_list(@{$this->{exc_items}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 11 | $this->SUPER::exit_all(@topics); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 53 | ▶ | sub exit_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exit_spec: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 53 | my ($this, $so, $depth, $status, $errmsg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 53 | $this->SUPER::exit_spec($so, $depth, $status, $errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 53 | print $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 53 | ▶ | if ($errmsg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 31 | my $v = $this->_error_should_be_reported($status); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 31 | ▶ | if ($this->_error_should_be_reported($status)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 19 | push(@{$this->{exc_items}}, [$so, $depth, $status, $errmsg]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | package Oktest::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 7 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 7 | our @EXPORT_OK = qw(strip last_item length | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | is_string is_number is_integer is_float | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | read_file write_file read_line_from rm_rf system3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | capture capture_stdouterr capture_stdout capture_stderr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 196 | ▶ | sub strip { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strip: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 196 | my ($s) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 196 | $s =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 196 | $s =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 196 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 39 | ▶ | sub last_item { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_item: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 39 | my (@arr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 39 | ▶ | return $arr[$#arr] if @arr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 1 | ▶ | sub length { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 1 | my (@arr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 1 | return $#arr + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 2 | ▶ | sub index(&@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 2 | my ($block, @arr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 2 | for (@arr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 9 | ▶ | return $i if $block->($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 8 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 1 | return -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 2 | ▶ | sub index_denied(&@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index_denied: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 2 | my ($block, @arr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 2 | for (@arr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 9 | ▶ | return $i unless $block->($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 8 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 1 | return -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 181 | ▶ | sub is_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_string: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 181 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 181 | ▶ | return 0 if ref($arg); # not scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 177 | ▶ | return 0 unless defined($arg); # undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 174 | ▶ | return 0 if ($arg ^ $arg) eq '0'; # number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 5 | return 1; # string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 40 | ▶ | sub is_number { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_number: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 40 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 40 | ▶ | return 0 if ref($arg); # not scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 31 | ▶ | return 0 unless defined($arg); # undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 25 | ▶ | return 1 if ($arg ^ $arg) eq '0'; # number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 9 | return 0; # string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 13 | ▶ | sub is_integer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_integer: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 13 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 13 | ▶ | return is_number($arg) && $arg =~ /^-?\d+$/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
is_number($arg) and $arg =~ /^-?\d+$/
MC/DC100%2/2
is_number($arg) and $arg =~ /^-?\d+$/
is_number($arg)
$arg =~ /^-?\d+$/
Truth table100%3/3
A and B
A= is_number($arg)B= $arg =~ /^-?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 13 | ▶ | sub is_float { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_float: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 13 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 13 | ▶ | return is_number($arg) && $arg =~ /^-?\d+\.\d+$/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
is_number($arg) and $arg =~ /^-?\d+\.\d+$/
MC/DC100%2/2
is_number($arg) and $arg =~ /^-?\d+\.\d+$/
is_number($arg)
$arg =~ /^-?\d+\.\d+$/
Truth table100%3/3
A and B
A= is_number($arg)B= $arg =~ /^-?\d+\.\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 2 | ▶ | sub read_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_file: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 2 | my ($filename) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 2 | ▶ | open(my $fh, '<', $filename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 2 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 2 | my $content = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 2 | ▶ | close($fh) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 2 | return $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 32 | ▶ | sub write_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_file: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 32 | my ($filename, $content) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 32 | ▶ | open(my $fh, '>', $filename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 32 | print $fh $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | 32 | ▶ | close($fh) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 7 | our $__read_filename = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 7 | our @__read_lines = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 196 | ▶ | sub read_line_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_line_from: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 196 | my ($filename, $linenum) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 196 | ▶ | if ($filename ne $__read_filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 6 | ▶ | open(my $fh, '<', $filename) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 6 | @__read_lines = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 6 | ▶ | close($fh) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | or die "$filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 6 | $__read_filename = $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 196 | return $__read_lines[$linenum-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 1 | ▶ | sub rm_rf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rm_rf: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 1 | my (@patterns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 1 | for my $pattern (@patterns) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 7 | ▶ | for my $path (glob($pattern)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 2 | ▶ | _rm_rf($path) if -e $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 5 | ▶ | sub _rm_rf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rm_rf: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 5 | my ($path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 5 | ▶ | if (-f $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | 3 | unlink($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | elsif (-d $path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | 2 | opendir(my $dh, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 2 | my @children = readdir($dh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 2 | closedir($dh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | 2 | for (@children) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 7 | ▶ | _rm_rf("$path/$_") unless $_ eq '.' || $_ eq '..'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ eq "." or $_ eq ".."
MC/DC100%2/2
$_ eq "." or $_ eq ".."
$_ eq "."
$_ eq ".."
Truth table100%3/3
A or B
A= $_ eq "."B= $_ eq ".."
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | 2 | rmdir($path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 3 | ▶ | sub system3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system3: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 7 | ▶ | use IPC::Open3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 7 | ▶ | use Symbol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | 3 | my ($command, $input) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 3 | my ($IN, $OUT, $ERR) = (gensym, gensym, gensym); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 3 | open3($IN, $OUT, $ERR, $command); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 3 | ▶ | print $IN $input if $input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 3 | close $IN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 3 | my @output = <$OUT>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 3 | my @error = <$ERR>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | 3 | close $OUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 3 | close $ERR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | 3 | return join("", @output), join("", @error); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 1 | ▶ | sub capture(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | 1 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | 1 | my $sout = tie(local *STDOUT, 'Oktest::Util::__PrintHandler'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 1 | local *STDERR = *STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 1 | $block->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | 1 | return $sout->output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 7 | ▶ | sub capture_stdouterr(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture_stdouterr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 7 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 7 | my $sout = tie(local *STDOUT, 'Oktest::Util::__PrintHandler'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 7 | my $serr = tie(local *STDERR, 'Oktest::Util::__PrintHandler'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 7 | $block->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 7 | return ($sout->output, $serr->output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | 64 | ▶ | sub capture_stdout(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture_stdout: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | 64 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 64 | my $sout = tie(local *STDOUT, 'Oktest::Util::__PrintHandler'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 64 | $block->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | 64 | return $sout->output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 4 | ▶ | sub capture_stderr(&) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture_stderr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | 4 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 4 | my $serr = tie(local *STDERR, 'Oktest::Util::__PrintHandler'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 4 | $block->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 4 | return $serr->output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 7 | $INC{'Oktest/Util.pm'} = __FILE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | package Oktest::Util::__PrintHandler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 83 | ▶ | sub TIEHANDLE { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHANDLE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | 83 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 83 | my $this = { output => "" }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | 83 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | 850 | ▶ | sub PRINT { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PRINT: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | 850 | my ($this, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | 850 | for my $arg (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | 2281 | $this->{output} .= $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | 83 | ▶ | sub output { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 83 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | 83 | return $this->{output}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | package Oktest::Migration::TestMore; ## !! EXPERIMENTAL !! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 7 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 7 | our @EXPORT = qw(ok is isnt like unlike cmp_ok is_deeply can_ok isa_ok pass fail | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | throws_ok dies_ok lives_ok lives_and warning_like diag note explain); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | #use Oktest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 7 | ▶ | no warnings 'void'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 2 | ▶ | sub ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 2 | my ($condition, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | 2 | Oktest::OK ($condition)->is_truthy(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | 2 | ▶ | sub is { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 2 | my ($this, $that, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | 2 | Oktest::OK ($this) eq $that; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 2 | ▶ | sub isnt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isnt: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 2 | my ($this, $that, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 2 | Oktest::OK ($this) ne $that; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | 2 | ▶ | sub like { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
like: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 2 | my ($this, $regexp, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | 2 | Oktest::OK ($this)->matches($regexp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | 2 | ▶ | sub unlike { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unlike: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | 2 | my ($this, $regexp, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | 2 | Oktest::OK ($this)->not_match($regexp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | 15 | ▶ | sub cmp_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmp_ok: called CC=15 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 15 | my ($this, $op, $that, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 15 | ▶ | if ($op eq '==') { Oktest::OK ($this) == $that } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 1 | elsif ($op eq '!=') { Oktest::OK ($this) != $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 1 | elsif ($op eq '>' ) { Oktest::OK ($this) > $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 1 | elsif ($op eq '>=') { Oktest::OK ($this) >= $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | 1 | elsif ($op eq '<' ) { Oktest::OK ($this) < $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 1 | elsif ($op eq '<=') { Oktest::OK ($this) <= $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 1 | elsif ($op eq 'eq') { Oktest::OK ($this) eq $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 1 | elsif ($op eq 'ne') { Oktest::OK ($this) ne $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 1 | elsif ($op eq 'gt') { Oktest::OK ($this) gt $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 1 | elsif ($op eq 'ge') { Oktest::OK ($this) ge $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 1 | elsif ($op eq 'lt') { Oktest::OK ($this) lt $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | 1 | elsif ($op eq 'le') { Oktest::OK ($this) le $that } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 1 | elsif ($op eq '=~') { Oktest::OK ($this)->matches($that) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 1 | elsif ($op eq '!~') { Oktest::OK ($this)->not_match($that) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | else { die "Oktest::TestMoreMigration::cmp_ok(): operator '$op' not supported.\n" }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 14 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 3 | ▶ | sub is_deeply { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_deeply: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 3 | my ($complex_structure1, $complex_structure2, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 3 | Oktest::OK ($complex_structure1)->equals($complex_structure2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 2 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 2 | ▶ | sub can_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_ok: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 2 | my ($module, @methods) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | 2 | Oktest::OK ($module)->can_($_) for (@methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 2 | ▶ | sub isa_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isa_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | 2 | my ($object, $class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | 2 | Oktest::OK ($object)->is_a($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 3 | ▶ | sub pass { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pass: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 3 | my ($test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 3 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | 1 | ▶ | sub fail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fail: called CC=1 SCAR=0.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 1 | my ($test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 1 | my $msg = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | "[Failed] $test_name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 1 | Oktest::OK()->_done()->_die($msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | #sub eq_array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | # my ($this, $that) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | # Oktest::OK ($this)->equals($that); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | #sub eq_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | # my ($this, $that) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | # Oktest::OK ($this)->equals($that); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | #sub eq_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | # my ($this, $that) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | # Oktest::OK ($this)->equals($that); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 4 | ▶ | sub throws_ok(&$;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throws_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 4 | my ($coderef, $pattern, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | 4 | Oktest::OK ($coderef)->dies($pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 2 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 2 | ▶ | sub dies_ok(&;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dies_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 2 | my ($coderef, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 2 | Oktest::OK ($coderef)->dies(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | 2 | ▶ | sub lives_ok(&;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lives_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 2 | my ($coderef, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | 2 | Oktest::OK ($coderef)->not_die(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | 2 | ▶ | sub lives_and(&;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lives_and: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | 2 | my ($test, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | 2 | Oktest::OK ($test)->not_die(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 1 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | 4 | ▶ | sub warning_like(&$;$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warning_like: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | 4 | my ($coderef, $pattern, $test_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | 4 | Oktest::OK ($coderef)->warns($pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | 2 | return 1==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 1 | ▶ | sub diag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | 1 | my ($message) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | 1 | print STDOUT "# $message\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 1 | return 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 1 | ▶ | sub note { ## TODO: check original spec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
note: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 1 | my ($message) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | 1 | print STDOUT "# $message\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | 1 | return 0==1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 1 | ▶ | sub explain { ## TODO: check original spec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
explain: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | 1 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | 7 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | 1 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | 1 | $_ = Dumper($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | 1 | s/^ //mg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | 1 | return $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 7 | $INC{'Oktest/Migration/TestMore.pm'} = __FILE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | package Oktest::MainApp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 7 | our $optdef_table = [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | ## name, short, long, argname, desc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | ['help', 'h', 'help', '', 'show help'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | ['version', 'v', 'version', '', 'show version'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | ['style', 's', 'style', 'name', 'reporting style (tap/verbose/simple/plain, or t/v/s/p)'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | ['spec', '', 'spec', 'regexp', 'filter by spec description'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | ['topic', '', 'topic', 'regexp', 'filter by topic name'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | ['r_skipped', '', 'report-skipped', '', 'report detail of skipped items'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | ['r_todo', '', 'report-todo', '', 'report detail of TODO items'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | ['debug', 'D', 'debug', '', ''], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 7 | our $optdef_list = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 7 | our $optdef_dict = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 7 | for (@$optdef_table) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 56 | my ($name, $short, $long, $argname, $desc) = @$_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | 56 | my $item = { name=>$name, short=>$short, long=>$long, argname=>$argname, desc=>$desc, }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 56 | push(@$optdef_list, $item); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 56 | ▶ | $optdef_dict->{$short} = $item if $short; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | 56 | ▶ | $optdef_dict->{$long} = $item if $long; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 45 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | 45 | my ($class, $argv, $command) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | 45 | ▶ | my $this = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition62%5/8
$argv || \@ARGV
$command || $0 =~ /([-\w.]+)$/ && $1
$0 =~ /([-\w.]+)$/ and $1
MC/DC100%1/1
$argv || \@ARGV
$argv
MC/DC0%0/3
$command || $0 =~ /([-\w.]+)$/ && $1
$command
$0 =~ /([-\w.]+)$/
$1
Truth table100%2/2
A
A= $argv
Truth table50%2/4
A || B and C
A= $commandB= $0 =~ /([-\w.]+)$/C= $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | argv => $argv || \@ARGV, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | command => $command || ($0 =~ /([-\w.]+)$/ and $1), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | 45 | return bless($this, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 2 | ▶ | sub _help_message { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_help_message: called CC=10 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 2 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | my $str = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 2 | $this->{command} . " - a new-style testing library.\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | "Usage: oktest.pl [options] file_or_dir [file_or_dir2...]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 2 | for my $item (@$optdef_list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | 16 | $_ = $item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | my ($name, $short, $long, $argname, $desc) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | 16 | ($_->{name}, $_->{short}, $_->{long}, $_->{argname}, $_->{desc}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 16 | ▶ | next unless $desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 14 | ▶ | my $s = $short && $long ? "-$short, --$long" . ($argname ? "=$argname" : "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition66%2/3
$short and $long
MC/DC50%1/2
$short and $long
$short
$long
Truth table66%2/3
A and B
A= $shortB= $long
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | : $short ? "-$short" . ($argname ? " $argname" : "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | : $long ? " --$long" . ($argname ? "=$argname" : "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 14 | $str .= sprintf(" %-20s : %s\n", $s, $desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 2 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 29 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=11 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | 29 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | 29 | my ($opts, $props) = $this->_parse_argv(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 29 | my $DEBUG = $opts->{debug}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | ## help | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | 29 | ▶ | if ($opts->{help}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 2 | print $this->_help_message(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | ## version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 27 | ▶ | if ($opts->{version}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | 2 | print $Oktest::VERSION, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | ## reporter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | my $reporter = Oktest::Reporter::create_instance($opts->{style}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 25 | ▶ | or die "-s $opts->{style}: unknown reporting style.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | 25 | ▶ | $reporter->{report_skipped} = 1==1 if $opts->{r_skipped}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 25 | ▶ | $reporter->{report_todo} = 1==1 if $opts->{r_todo}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | ## options for Oktest::run() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | my $run_options = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | reporter => $reporter, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | spec => _str_or_rexp($opts->{spec}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | 25 | topic => _str_or_rexp($opts->{topic}), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | ## load files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 25 | my @filepaths = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | 25 | for my $arg (@{$this->{argv}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | 27 | ▶ | -e $arg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | or die "$arg: no such file or directory.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 26 | ▶ | my @arr = -d $arg ? _find_files($arg, qr/\.t$/) : ($arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 26 | push(@filepaths, @arr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | 24 | for my $fpath (@filepaths) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 47 | ▶ | print "## require '$fpath'\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | 47 | require $fpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | 24 | Oktest::run(%$run_options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 50 | ▶ | sub _str_or_rexp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_str_or_rexp: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 50 | my ($pattern) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | 50 | ▶ | if ($pattern && $pattern =~ /^\/(.*)\/$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$pattern and $pattern =~ m[^/(.*)/$]
MC/DC100%2/2
$pattern and $pattern =~ m[^/(.*)/$]
$pattern
$pattern =~ m[^/(.*)/$]
Truth table100%3/3
A and B
A= $patternB= $pattern =~ m[^/(.*)/$]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | 2 | my $rexp = qr/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | 2 | return $rexp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | 48 | return $pattern; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 42 | ▶ | sub _parse_argv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_argv: called CC=17 SCAR=28.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | 42 | my ($this) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | 42 | my $argv = $this->{argv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 42 | my $command = $this->{command}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | 42 | my $opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | #my $props = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | 42 | ▶ | while ($argv->[0] && $argv->[0] =~ /^-/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$argv->[0] and $argv->[0] =~ /^-/
MC/DC100%2/2
$argv->[0] and $argv->[0] =~ /^-/
$argv->[0]
$argv->[0] =~ /^-/
Truth table100%3/3
A and B
A= $argv->[0]B= $argv->[0] =~ /^-/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | 50 | my $optstr = shift(@$argv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | 50 | ▶ | last if $optstr eq '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | 49 | ▶ | if ($optstr =~ /^--/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 24 | ▶ | $optstr =~ /^--(\w[-\w]*)(=(.*))?$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | or die "$command: $optstr: invalid option.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | #$props->{$1} = $2 ? $3 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | 24 | my $has_arg = !! $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | 24 | ▶ | my ($key, $val) = ($1, $has_arg ? $3 : 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | 24 | ▶ | my $item = $optdef_dict->{$key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | or die "$command: $optstr: unknown option.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | 22 | my $arg_required = !! $item->{argname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | 22 | ▶ | $arg_required && ! $has_arg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$arg_required and not $has_arg
MC/DC100%2/2
$arg_required and not $has_arg
$arg_required
not $has_arg
Truth table100%3/3
A and not(B)
A= $arg_requiredB= not $has_arg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | and die "$command: $optstr: argument required.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | 21 | ▶ | ! $arg_required && $has_arg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $arg_required and $has_arg
MC/DC100%2/2
not $arg_required and $has_arg
not $arg_required
$has_arg
Truth table100%3/3
not(A) and B
A= not $arg_requiredB= $has_arg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | and die "$command: $optstr: unexpected argument.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | #$opts->{$key} = $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | 20 | $opts->{$item->{name}} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | 25 | my @optchars = split('', substr($optstr, 1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | 25 | ▶ | while (my $ch = shift(@optchars)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | 30 | ▶ | my $item = $optdef_dict->{$ch} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | or die "$command: -$ch: unknown option.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | 28 | my $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | 28 | my $argname = $item->{argname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | 28 | ▶ | if (! $argname) { $val = 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | 13 | elsif (@optchars) { $val = join('', @optchars); @optchars = (); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | 1 | elsif (@$argv) { $val = shift(@$argv); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 2 | else { die "$command: -$ch: argument required.\n"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | 26 | $opts->{$item->{name}} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | #return $opts, $props; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | 34 | return $opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | 32 | ▶ | sub _find_files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_files: called CC=6 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | 32 | my ($arg, $rexp) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | 32 | ▶ | if (-f $arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | 27 | ▶ | return if $rexp && $arg !~ $rexp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$rexp and not $arg =~ /$rexp/
MC/DC0%0/2
$rexp and not $arg =~ /$rexp/
$rexp
not $arg =~ /$rexp/
Truth table33%1/3
A and not(B)
A= $rexpB= not $arg =~ /$rexp/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | 27 | return ($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | elsif (-d $arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | 5 | my @arr = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | 5 | for (glob("$arg/*")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 27 | push(@arr, _find_files($_, $rexp)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 5 | return @arr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | 0 | die "_find_files(): $arg: not file nor directory.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||