| 1 | # -*- mode: perl; coding: utf-8 -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package YATT::Test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use base qw(Test::More); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | BEGIN {$INC{'YATT/Test.pm'} = __FILE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Time::HiRes qw(usleep); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use YATT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 10 | ▶ | use YATT::Util qw(rootname catch checked_eval default defined_fmt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | require_and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | ▶ | use YATT::Util::Symbol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 10 | ▶ | use YATT::Util::Finalizer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | ▶ | use YATT::Util::DirTreeBuilder qw(tmpbuilder); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 10 | ▶ | use YATT::Util::DictOrder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 10 | our @EXPORT = qw(ok is isnt like is_deeply skip fail plan | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | require_ok isa_ok | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | basename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | wait_for_time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | is_rendered raises is_can run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | capture rootname checked_eval default defined_fmt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | tmpbuilder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | dumper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | xhf_test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | *TRANS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 10 | foreach my $name (@EXPORT) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 250 | my $glob = globref(__PACKAGE__, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 250 | ▶ | unless (*{$glob}{CODE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 110 | *$glob = \&{globref("Test::More", $name)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 10 | *eq_or_diff = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 10 | ▶ | if (catch {require Test::Differences} \ my $error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | \&Test::More::is; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 10 | \&Test::Differences::eq_or_diff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 10 | push @EXPORT, qw(eq_or_diff); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 10 | our @EXPORT_OK = @EXPORT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | my ($testname, $sub) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | my $res = eval { $sub->() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | Test::More::is $@, '', "$testname doesn't raise error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | $res | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | sub is_can ($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_can: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | my ($desc, $cmp, $title) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | my ($obj, $method, @args) = @$desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | my $sub = $obj->can($method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | Test::More::ok defined $sub, "$title - can"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | ▶ | if ($sub) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | Test::More::is scalar($sub->($obj, @args)), $cmp, $title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | Test::More::fail "skipped because method '$method' not found."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 130 | ▶ | sub is_rendered ($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_rendered: called CC=5 SCAR=18.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 130 | my ($desc, $cmp, $title) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 130 | my ($trans, $path, @args) = @$desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 130 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | local $SIG{__DIE__} = sub {$error = @_ > 1 ? [@_] : shift}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | local $SIG{__WARN__} = sub {$error = @_ > 1 ? [@_] : shift}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 130 | my ($sub, $pkg) = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 130 | &YATT::break_translator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 130 | $trans->get_handler_to(render => @$path) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 130 | Test::More::is $error, undef, "$title - compiled."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 130 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 130 | ▶ | if ($sub) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 130 | ▶ | my $out = capture { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 130 | &YATT::break_handler; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 130 | $sub->($pkg, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 130 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 130 | ▶ | $out =~ s{\r}{}g if defined $out; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 130 | eq_or_diff($out, $cmp, $title); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } elsif ($error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | Test::More::fail "skipped, because of previous compile error for [$title]: $error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 130 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | Test::More::fail "$title: runtime error: $@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 32 | ▶ | sub raises ($$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raises: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 32 | my ($desc, $cmp, $title) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 32 | my ($trans, $method, @args) = @$desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 32 | ▶ | my $result = eval {capture {$trans->$method(@args)}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 32 | Test::More::like $@, $cmp, $title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 32 | $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 86 | ▶ | sub dumper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dumper: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | join "\n", map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 86 | Data::Dumper->new([$_])->Terse(1)->Indent(0)->Dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 10 | ▶ | use base qw(YATT::Class::Configurable); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 10 | ▶ | use YATT::Types -base => __PACKAGE__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | , [TestDesc => [qw(cf_FILE realfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ntests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | cf_TITLE num cf_TAG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | cf_BREAK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | cf_SKIP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | cf_WIDGET | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | cf_RANDOM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | cf_IN cf_PARAM cf_OUT cf_ERROR)]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | , [Config => [['^cf_translator' => 'YATT::Translator::Perl'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | , '^cf_toplevel' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | , '^TMPDIR', 'gen' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | , [Toplevel => []] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 10 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | ▶ | Config->define(target => sub { my $self = shift; $self->toplevel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 10 | || $self->translator }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 13 | ▶ | Config->define(new_translator => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ;# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 13 | (my Config $global, my ($loader, @opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 13 | require_and($global->translator => new => loader => $loader, @opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 10 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | ▶ | Config->define(configure_DIR => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ;# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | (my Config $global, my ($dir)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | $global->{TMPDIR} = tmpbuilder($dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 10 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | sub ntests { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ntests: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | my $ntests = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | foreach my $section (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 13 | foreach my TestDesc $test (@{$section}[1 .. $#$section]) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 184 | $ntests += $test->{ntests}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | $ntests; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | sub xhf_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhf_test: called CC=4 SCAR=14.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | my Config $global = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | shift->Config->new(DIR => shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | if (@_ == 1 and -d $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ == 1 and -d $_[0]
MC/DC0%0/2
@_ == 1 and -d $_[0]
@_ == 1
-d $_[0]
Truth table33%1/3
A and B
A= @_ == 1B= -d $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | my $srcdir = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | @_ = dict_sort <$srcdir/*.xhf>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | croak "Source is missing." unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | my @sections = $global->xhf_load_sections(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | Test::More::plan(tests => 1 + ntests(@sections)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | require_ok($global->target); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | $global->xhf_do_sections(@sections); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | ▶ | sub xhf_load_sections { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhf_load_sections: called CC=16 SCAR=28.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | my Config $global = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | require YATT::XHF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | my @sections; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | foreach my $testfile (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 13 | my $parser = new YATT::XHF(filename => $testfile); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 13 | my TestDesc $prev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 13 | my ($n, @test, %uniq) = (0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 13 | ▶ | while (my $rec = $parser->read_as_hash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 184 | ▶ | if ($rec->{global}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $global->configure(%{$rec->{global}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 184 | push @test, my TestDesc $test = $global->TestDesc->new(%$rec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 184 | $test->{ntests} = $global->ntests_in_desc($test); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | $test->{cf_FILE} ||= $prev && $prev->{cf_FILE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 184 | ▶ | && $prev->{cf_FILE} =~ m{%d} ? $prev->{cf_FILE} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$test->{"cf_FILE"} ||= $prev && $prev->{"cf_FILE"} && $prev->{"cf_FILE"} =~ /%d/ ? $prev->{"cf_FILE"} : undef
$prev and $prev->{"cf_FILE"} and $prev->{"cf_FILE"} =~ /%d/
$prev and $prev->{"cf_FILE"}
MC/DC0%0/4
$test->{"cf_FILE"} ||= $prev && $prev->{"cf_FILE"} && $prev->{"cf_FILE"} =~ /%d/ ? $prev->{"cf_FILE"} : undef
$test->{"cf_FILE"}
$prev
$prev->{"cf_FILE"}
$prev->{"cf_FILE"} =~ /%d/
Truth table0%0/5
A ||= B and C and D
A= $test->{"cf_FILE"}B= $prevC= $prev->{"cf_FILE"}D= $prev->{"cf_FILE"} =~ /%d/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 184 | ▶ | if ($test->{cf_IN}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 10 | ▶ | use YATT::Util::redundant_sprintf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 159 | ▶ | $test->{realfile} = sprintf($test->{cf_FILE} ||= "doc/f%d.html", $n); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$test->{"cf_FILE"} ||= "doc/f%d.html"
MC/DC100%1/1
$test->{"cf_FILE"} ||= "doc/f%d.html"
$test->{"cf_FILE"}
Truth table100%2/2
A
A= $test->{"cf_FILE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 159 | ▶ | $test->{cf_WIDGET} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$test->{"cf_WIDGET"} ||= do {
my $widget = $test->{"realfile"};
$widget =~ s[^doc/][];
$widget =~ s/\.\w+$//;
$widget =~ s[/][:]g;
$widget
}
MC/DC50%1/2
$test->{"cf_WIDGET"} ||= do {
my $widget = $test->{"realfile"};
$widget =~ s[^doc/][];
$widget =~ s/\.\w+$//;
$widget =~ s[/][:]g;
$widget
}
$test->{"cf_WIDGET"}
do {
my $widget = $test->{"realfile"};
$widget =~ s[^doc/][];
$widget =~ s/\.\w+$//;
$widget =~ s[/][:]g;
$widget
}
Truth table66%2/3
A ||= B
A= $test->{"cf_WIDGET"}B= do {
my $widget = $test->{"realfile"};
$widget =~ s[^doc/][];
$widget =~ s/\.\w+$//;
$widget =~ s[/][:]g;
$widget
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 159 | my $widget = $test->{realfile}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 159 | $widget =~ s{^doc/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 159 | $widget =~ s{\.\w+$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 159 | $widget =~ s{/}{:}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 159 | $widget; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 184 | ▶ | if ($test->{cf_OUT}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 130 | ▶ | $test->{cf_WIDGET} ||= $prev && $prev->{cf_WIDGET}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$test->{"cf_WIDGET"} ||= $prev && $prev->{"cf_WIDGET"}
$prev && $prev->{'cf_WIDGET'}
MC/DC0%0/3
$test->{"cf_WIDGET"} ||= $prev && $prev->{"cf_WIDGET"}
$test->{"cf_WIDGET"}
$prev
$prev->{'cf_WIDGET'}
Truth table0%0/4
A ||= B && C
A= $test->{"cf_WIDGET"}B= $prevC= $prev->{'cf_WIDGET'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 130 | ▶ | if (not $test->{cf_TITLE} and $prev) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $test->{"cf_TITLE"} and $prev
MC/DC50%1/2
not $test->{"cf_TITLE"} and $prev
not $test->{"cf_TITLE"}
$prev
Truth table66%2/3
not(A) and B
A= not $test->{"cf_TITLE"}B= $prev
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 23 | $test->{num} = default($prev->{num}) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 23 | $test->{cf_TITLE} = $prev->{cf_TITLE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 184 | $prev = $test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 184 | $n++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 13 | push @sections, [$testfile => @test]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | @sections; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 184 | ▶ | sub xhf_is_runnable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhf_is_runnable: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 184 | (my Config $global, my TestDesc $test) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 184 | ▶ | $test->{cf_OUT} || $test->{cf_ERROR}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | sub xhf_do_sections { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhf_do_sections: called CC=13 SCAR=25.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | (my Config $global, my @sections) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | my $SECTION = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | foreach my $section (@sections) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 13 | my ($testfile, @all) = @$section; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 13 | my $builder = $global->{TMPDIR}->as_sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 13 | my $DIR = $builder->([DIR => "doc"]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 13 | my @test; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 13 | foreach my TestDesc $test (@all) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 184 | ▶ | if ($test->{cf_IN}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 159 | ▶ | die "Conflicting FILE: $test->{realfile}!\n" if -e $test->{realfile}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $builder->($global->{TMPDIR}->path2desc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 159 | ($test->{realfile}, $test->{cf_IN})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 184 | ▶ | push @test, $test if $global->xhf_is_runnable($test); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 13 | my @loader = (DIR => "$DIR/doc"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 13 | push @loader, LIB => do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 13 | ▶ | if (-d "$DIR/lib") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | my $libdir = "$DIR/lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | chmod 0755, $libdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | $libdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 12 | getcwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 13 | my %config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 13 | ▶ | if (-r (my $fn = "$DIR/doc/.htyattroot")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | %config = YATT::XHF->new(filename => $fn)->read_as('pairlist'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 13 | &YATT::break_translator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | $global->{gen} = ($global->toplevel || $global)->new_translator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | (\@loader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | , app_prefix => "MyApp$SECTION" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | , debug_translator => $ENV{DEBUG} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 13 | ▶ | , no_lineinfo => YATT::Util::no_lineinfo() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$global->toplevel || $global
MC/DC0%0/2
$global->toplevel || $global
$global->toplevel
$global
Truth table33%1/3
A || B
A= $global->toplevelB= $global
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | , %config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 13 | foreach my TestDesc $test (@test) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 162 | ▶ | my @widget_path; @widget_path = split /:/, $test->{cf_WIDGET} if $test->{cf_WIDGET}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 162 | ▶ | my ($param); ($param) = map {ref $_ ? $_ : 'main'->checked_eval($_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 162 | ▶ | $test->{cf_PARAM} if $test->{cf_PARAM}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | SKIP: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 162 | $global->xhf_runtest_desc($test, $testfile, \@widget_path, $param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 13 | $SECTION++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 162 | ▶ | sub xhf_runtest_desc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xhf_runtest_desc: called CC=10 SCAR=23.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 162 | (my Config $global, my TestDesc $test | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | , my ($testfile, $widget_path, $param)) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 162 | ▶ | unless (defined $test->{cf_TITLE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | die "test title is not defined!" . dumper($test); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | my $title = join("", '[', basename($testfile), '] ', $test->{cf_TITLE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 162 | , defined_fmt(' (%d)', $test->{num}, '')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 162 | my $toplevel = $global->toplevel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 162 | ▶ | if ($test->{cf_OUT}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Test::More::skip("($test->{cf_SKIP}) $title", 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 130 | ▶ | if $test->{cf_SKIP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 129 | ▶ | if ($toplevel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$toplevel and my $sub = $toplevel->can("set_random_list")
MC/DC0%0/2
$toplevel and my $sub = $toplevel->can("set_random_list")
$toplevel
my $sub = $toplevel->can("set_random_list")
Truth table33%1/3
A and B
A= $toplevelB= my $sub = $toplevel->can("set_random_list")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | and my $sub = $toplevel->can("set_random_list")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $sub->($global, $test->{cf_RANDOM}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 129 | ▶ | &YATT::breakpoint if $test->{cf_BREAK}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | is_rendered [$global->{gen}, $widget_path, $param] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 129 | , $test->{cf_OUT}, $title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } elsif ($test->{cf_ERROR}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | Test::More::skip("($test->{cf_SKIP}) $title", 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 32 | ▶ | if $test->{cf_SKIP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 31 | ▶ | &YATT::breakpoint if $test->{cf_BREAK}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 31 | raises [$global->{gen}, call_handler => render => $widget_path, $param] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | , qr{$test->{cf_ERROR}}s, $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 184 | ▶ | sub ntests_in_desc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ntests_in_desc: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 184 | (my $this, my TestDesc $test) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 184 | ▶ | if ($test->{cf_OUT}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 130 | 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } elsif ($test->{cf_ERROR}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 32 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 22 | 0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 4 | ▶ | sub wait_for_time { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wait_for_time: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 4 | my ($time) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 4 | my $now = Time::HiRes::time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 4 | my $diff = $time - $now; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 4 | ▶ | return if $diff <= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | usleep(int($diff * 1000 * 1000)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 2 | $diff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||