Codebase list libdevel-cover-perl / 2d50694
Merge branch 'GH-323-uncoverable-error' Paul Johnson 1 year, 7 days ago
62 changed file(s) with 892 addition(s) and 530 deletion(s). Raw diff Collapse all Expand all
6767 qw(
6868 add_uncoverable_point=s
6969 annotation=s
70 gcov_chdir!
7170 clean_uncoverable_points!
7271 coverage=s
7372 delete!
7473 delete_uncoverable_point=s
7574 dump_db!
7675 gcov!
76 gcov_chdir!
7777 help|h!
78 ignore=s
79 ignore_covered_err!
7880 ignore_re=s
79 ignore=s
8081 info|i!
8182 launch!
8283 make=s
8384 outputdir=s
8485 prefer_lib!
8586 relative_only!
87 report=s
8688 report_c0=s
8789 report_c1=s
8890 report_c2=s
89 report=s
91 select=s
9092 select_re=s
91 select=s
9293 silent!
9394 summary!
9495 test!
196197
197198 get_options;
198199
199 $Devel::Cover::Silent = 1 if $Options->{silent};
200 $Devel::Cover::Silent = 1 if $Options->{silent};
201 $Devel::Cover::Ignore_covered_err = 1 if $Options->{ignore_covered_err};
200202
201203 $Options->{report} = [ grep {
202204 my $report = $_;
507509 -gcov - run gcov to cover XS code (default on if using gcc)
508510 -make make_prog - use the given 'make' program for 'make test'
509511 -prefer_lib - prefer files in lib (default off)
512 -ignore_covered_err - allow coverung uncoverable code (default off)
510513
511514 -add_uncoverable_point string
512515 -delete_uncoverable_point string
614617 The C<-prefer_lib> option tells Devel::Cover to report on files in the lib
615618 directory even if they were used from the blib directory.
616619
620 The C<-ignore_covered_err> option will not flag an error if uncoverable code is
621 covered.
622
617623 =head1 EXIT STATUS
618624
619625 The following exit values are returned:
2323 sub text { $_[0][1]{text} }
2424 sub criterion { "branch" }
2525
26
2726 sub percentage {
2827 my $t = $_[0]->total;
2928 sprintf "%3d", $t ? $_[0]->covered / $t * 100 : 0
3332 my $self = shift;
3433 if (@_) {
3534 my $c = shift;
36 return !($self->covered($c) xor $self->uncoverable($c));
35 return $self->err_chk($self->covered($c), $self->uncoverable($c));
3736 }
3837 my $e = 0;
3938 for my $c (0 .. $#{$self->[0]}) {
40 $e++ if !($self->covered($c) xor $self->uncoverable($c));
39 $e++ if $self->err_chk($self->covered($c), $self->uncoverable($c));
4140 }
4241 $e
4342 }
3636 sub criterion { require Carp;
3737 Carp::confess("criterion() must be overridden") }
3838
39 sub err_chk {
40 my $self = shift;
41 my ($covered, $uncoverable) = @_;
42 no warnings qw( once uninitialized );
43 $Devel::Cover::Ignore_covered_err || $uncoverable eq "ignore_covered_err"
44 ? !($covered || $uncoverable)
45 : !($covered xor $uncoverable)
46 }
47
48 sub simple_error {
49 my $self = shift;
50 $self->err_chk($self->covered, $self->uncoverable)
51 }
52
3953 sub calculate_percentage {
4054 my $class = shift;
4155 my ($db, $s) = @_;
6478 $self->aggregate($s, $file, "covered", 1) if $self->covered;
6579 $self->aggregate($s, $file, "error", 1) if $self->error;
6680 }
67
6881
6982 1
7083
3636 my ($db, $s) = @_;
3737
3838 # print STDERR Dumper $s;
39
4039 for my $criterion ($self->items) {
4140 next unless exists $s->{$criterion};
4241 my $c = "Devel::Cover::\u$criterion";
4443 $c->calculate_percentage($db, $s->{$criterion});
4544 }
4645 Devel::Cover::Criterion->calculate_percentage($db, $s->{total});
47
4846 # print STDERR Dumper $s;
4947 }
5048
1919 sub covered { $_[0][0] ? 1 : 0 }
2020 sub total { 1 }
2121 sub percentage { $_[0][0] ? 100 : 0 }
22 sub error { $_[0][0] xor !$_[0][2] }
22 sub error { $_[0]->simple_error }
2323 sub criterion { "pod" }
2424
2525 sub calculate_summary {
7474 }
7575 }
7676
77 # use Devel::Cover::Dumper; print STDERR Dumper(\%criteria);
7778 my $more = 1;
7879 while ($more) {
7980 my @args = ($n, "");
9899 : $o->percentage
99100 : "";
100101 $value = "-" . $value if $o && $o->uncoverable;
102 $value = "*" . $value if $o && $o->error;
101103 push @args, $value;
102104 $error ||= $o->error if $o;
103105 }
1313
1414 use base "Devel::Cover::Criterion";
1515
16 sub val { $_[0][0] }
17 sub uncoverable { $_[0][1] }
18 sub covered { $_[0][0] }
19 sub total { 1 }
20 sub percentage { $_[0][0] ? 100 : 0 }
21 sub error { $_[0][0] xor !$_[0][1] }
22 sub criterion { "statement" }
23
16 sub val { $_[0][0] }
17 sub uncoverable { $_[0][1] }
18 sub covered { $_[0][0] }
19 sub total { 1 }
20 sub percentage { $_[0][0] ? 100 : 0 }
21 sub error { $_[0]->simple_error }
22 sub criterion { "statement" }
2423
2524 1
2625
1717 sub covered { $_[0][0] }
1818 sub total { 1 }
1919 sub percentage { $_[0][0] ? 100 : 0 }
20 sub error { $_[0][0] xor !$_[0][2] }
20 sub error { $_[0]->simple_error }
2121 sub name { $_[0][1] }
2222 sub criterion { "subroutine" }
2323
8787 unless (mkdir $self->{cover_db}) {
8888 die "Can't mkdir $self->{cover_db}: $!" unless -d $self->{cover_db};
8989 }
90 my $p = $self->{cover_parameters} || [];
9091 $self->{cover_parameters} = join(" ", map "-coverage $_",
9192 split " ", $self->{criteria})
92 . " -report text "
93 . " @$p -report text "
9394 . shell_quote $self->{cover_db};
9495 $self->{cover_parameters} .= " -uncoverable_file "
9596 . "@{$self->{uncoverable_file}}"
101101 # Used in runops function
102102 our $Replace_ops; # Whether we are replacing ops
103103 our $Silent; # Output nothing. Can be used anywhere
104 our $Ignore_covered_err; # Don't flag an error when uncoverable
105 # code is covered.
104106 our $Self_cover; # Coverage of Devel::Cover
105107
106108 BEGIN {
314316 /^-blib/ && do { $blib = shift @o; next };
315317 /^-subs_only/ && do { $Subs_only = shift @o; next };
316318 /^-replace_ops/ && do { $Replace_ops = shift @o; next };
317 /^-coverage/ &&
319 /^-coverage/ &&
318320 do { $Coverage{+shift @o} = 1 while @o && $o[0] !~ /^[-+]/; next };
319 /^[-+]ignore/ &&
321 /^[-+]ignore/ &&
320322 do { push @Ignore, shift @o while @o && $o[0] !~ /^[-+]/; next };
321 /^[-+]inc/ &&
323 /^[-+]inc/ &&
322324 do { push @Inc, shift @o while @o && $o[0] !~ /^[-+]/; next };
323 /^[-+]select/ &&
325 /^[-+]select/ &&
324326 do { push @Select, shift @o while @o && $o[0] !~ /^[-+]/; next };
325327 warn __PACKAGE__ . ": Unknown option $_ ignored\n";
326328 }
15881590 may then be further information depending on the nature of the uncoverable
15891591 construct.
15901592
1593 In all cases as L<class> attribute may be included in L<details>. At present a
1594 single class attribute is recognised: L<ignore_covered_err>. Normally, an
1595 error is flagged if code marked as L<uncoverable> is covered. When the
1596 L<ignore_covered_err> attribute is specified then such errors will not be
1597 flagged. This is a more precise method to flag such exceptions than the global
1598 L<-ignore_covered_err> flag to the L<cover> program.
1599
1600 There is also a L<note> attribute which can also be included in L<details>.
1601 This should be the final attribute and will consude all the remaining text.
1602 Currently this attribute is not used, but it is intented as a form of
1603 documentation for the uncoverable data.
1604
1605 Example:
1606
1607 # uncoverable branch true count:1..3 class:ignore_covered_err note:error chk
1608
15911609 =head3 Statements
15921610
15931611 The "uncoverable" comment should appear on either the same line as the
2929 10 1 my $x = 1;
3030 11 1 my $y = 1;
3131 12
32 13 *** 1 50 33 if ($x && !$y) {
33 14 *** 0 die "Urgh";
32 13 *** 1 * 50 * 33 if ($x && !$y) {
33 14 *** *0 die "Urgh";
3434 15 }
3535 16
36 17 *** 1 50 33 if ($x && $y) {
36 17 *** 1 * 50 * 33 if ($x && $y) {
3737 18 }
3838 19
39 20 *** 1 50 33 unless ($x && $y) {
40 21 *** 0 die "Urgh";
39 20 *** 1 * 50 * 33 unless ($x && $y) {
40 21 *** *0 die "Urgh";
4141 22 }
4242 23
43 24 *** 1 50 33 if (!($x && $y)) {
44 25 *** 0 die "Urgh";
43 24 *** 1 * 50 * 33 if (!($x && $y)) {
44 25 *** *0 die "Urgh";
4545 26 }
4646 27
47 28 *** 1 50 33 if (!$x || !$y) {
48 29 *** 0 die "Urgh";
47 28 *** 1 * 50 * 33 if (!$x || !$y) {
48 29 *** *0 die "Urgh";
4949 30 }
5050
5151
4141 1
4242 17
4343 18 1 my $x = 1;
44 19 *** 1 50 print $x if 1 >= $x;
44 19 *** 1 * 50 print $x if 1 >= $x;
4545
4646
4747 Branches
2626 1
2727 6
2828 7 sub f {
29 8 *** 0 0 0 return MyType if @_;
29 8 *** *0 * 0 *0 return MyType if @_;
3030 9 }
3131
3232
3939 16 1 my $z = 0;
4040 17
4141 18 1 for (0 .. 10) {
42 19 *** 11 50 $y &&
42 19 *** 11 * 50 $y &&
4343 20 $x[1]++;
4444 21
45 22 *** 11 100 66 $y &&
45 22 *** 11 100 * 66 $y &&
4646 23 $x[0]++ &&
4747 24 $x[1]++;
4848 25
49 26 *** 11 50 $x[2]++
49 26 *** 11 * 50 $x[2]++
5050 27 if $z;
5151 28
5252 29 11 for (0 .. 2) {
5353 30 33 $x[3]++;
5454 31 }
5555 32
56 33 *** 11 50 if ($y) {
56 33 *** 11 * 50 if ($y) {
5757 34 11 $x[4]++;
5858 35 } else {
59 36 *** 0 0 $y && $x[5]++;
59 36 *** *0 * 0 $y && $x[5]++;
6060 37 }
6161 38
6262 39 11 my $p = $y & $z;
6363 40
64 41 *** 11 33 $p &&= $y;
65 42 *** 11 33 $p &&= $z;
64 41 *** 11 * 33 $p &&= $y;
65 42 *** 11 * 33 $p &&= $z;
6666 43 11 my $q = 1;
67 44 *** 11 66 $q &&= $_;
67 44 *** 11 * 66 $q &&= $_;
6868 45
6969 46 11 pas();
7070 47 }
7171 48
7272 49 sub pas {
73 50 *** 11 50 11 $y && $z
73 50 *** 11 * 50 11 $y && $z
7474 51 }
7575 52
7676 53 # print join(", ", @x), "\n";
3737 14
3838 15 1 for my $y (0, 0) {
3939 16 2 for my $z (1, 0) {
40 17 *** 4 50 33 if ($y && $z) {
41 18 *** 0 $x[1]++;
40 17 *** 4 * 50 * 33 if ($y && $z) {
41 18 *** *0 $x[1]++;
4242 19 } else {
4343 20 4 $x[2]++;
4444 21 }
45 22 *** 4 100 66 if ($y || $z) {
45 22 *** 4 100 * 66 if ($y || $z) {
4646 23 2 $x[3]++;
4747 24 } else {
4848 25 2 $x[4]++;
4949 26 }
5050 27
51 28 *** 4 50 $y && $x[5]++;
52 29 *** 4 50 $x[5]++ if $y;
51 28 *** 4 * 50 $y && $x[5]++;
52 29 *** 4 * 50 $x[5]++ if $y;
5353 30
5454 31 4 100 $z && $x[6]++;
5555 32 4 100 $x[6]++ if $z;
5656 33
57 34 *** 4 50 $y || $x[7]++;
58 35 *** 4 50 $x[7]++ unless $y;
57 34 *** 4 * 50 $y || $x[7]++;
58 35 *** 4 * 50 $x[7]++ unless $y;
5959 36
6060 37 4 100 $z || $x[8]++;
6161 38 4 100 $x[8]++ unless $z;
6262 39
63 40 *** 4 50 $y ? $x[9]++ : $x[10]++;
63 40 *** 4 * 50 $y ? $x[9]++ : $x[10]++;
6464 41 4 100 $z ? $x[11]++ : $x[12]++;
6565 42
66 43 *** 4 50 33 if ($y) {
67 *** 50 66
66 43 *** 4 * 50 * 33 if ($y) {
67 *** * 50 * 66
6868 100
69 44 *** 0 $x[13]++;
69 44 *** *0 $x[13]++;
7070 45 } elsif ($y && $z) {
71 46 *** 0 $x[14]++;
71 46 *** *0 $x[14]++;
7272 47 } elsif ($y || $z) {
7373 48 2 $x[15]++;
7474 49 } else {
7575 50 2 $x[16]++;
7676 51 }
7777 52
78 53 *** 4 50 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 50 33
78 53 *** 4 * 50 * 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 * 50 * 33
8080 54 }
8181 55 }
8282 56
105105 79 1 1 no warnings "void";
106106 1
107107 1
108 80 *** 2 0 my $w = $y xor next;
109 81 *** 0 $x[22]++;
108 80 *** 2 * 0 my $w = $y xor next;
109 81 *** *0 $x[22]++;
110110 82 }
111111 83
112112 84 1 for my $y (1, 0) {
113113 85 1 1 no warnings "void";
114114 1
115115 1
116 86 *** 2 0 my $w = $y xor next;
117 87 *** 0 $x[23]++;
116 86 *** 2 * 0 my $w = $y xor next;
117 87 *** *0 $x[23]++;
118118 88 }
119119 89
120120 90
121121 91 1 for my $y (0, 1) {
122 92 *** 1 50 $y || last;
123 93 *** 0 $x[24]++;
122 92 *** 1 * 50 $y || last;
123 93 *** *0 $x[24]++;
124124 94 }
125125 95
126126 96 1 for my $y (1, 0) {
134134 104 }
135135 105
136136 106 1 for my $y (1, 0) {
137 107 *** 1 50 $y && last;
138 108 *** 0 $x[27]++;
137 107 *** 1 * 50 $y && last;
138 108 *** *0 $x[27]++;
139139 109 }
140140 110
141141 111 1 for my $y (0, 1) {
142142 112 1 1 no warnings "void";
143143 1
144144 1
145 113 *** 1 0 my $w = $y xor last;
146 114 *** 0 $x[28]++;
145 113 *** 1 * 0 my $w = $y xor last;
146 114 *** *0 $x[28]++;
147147 115 }
148148 116
149149 117 1 for my $y (1, 0) {
150150 118 1 1 no warnings "void";
151151 1
152152 1
153 119 *** 1 0 my $w = $y xor last;
154 120 *** 0 $x[29]++;
153 119 *** 1 * 0 my $w = $y xor last;
154 120 *** *0 $x[29]++;
155155 121 }
156156 122
157157 123
158158 124 1 for my $y (0, 1) {
159 125 *** 1 50 $y || goto G1;
160 126 *** 0 $x[30]++;
159 125 *** 1 * 50 $y || goto G1;
160 126 *** *0 $x[30]++;
161161 127 }
162162 128 G1:
163163 129
174174 140 G3:
175175 141
176176 142 1 for my $y (1, 0) {
177 143 *** 1 50 $y && goto G4;
178 144 *** 0 $x[33]++;
177 143 *** 1 * 50 $y && goto G4;
178 144 *** *0 $x[33]++;
179179 145 }
180180 146 G4:
181181 147
183183 149 1 1 no warnings "void";
184184 1
185185 1
186 150 *** 1 0 my $w = $y xor goto G5;
187 151 *** 0 $x[34]++;
186 150 *** 1 * 0 my $w = $y xor goto G5;
187 151 *** *0 $x[34]++;
188188 152 }
189189 153 G5:
190190 154
192192 156 1 1 no warnings "void";
193193 1
194194 1
195 157 *** 1 0 my $w = $y xor goto G6;
196 158 *** 0 $x[35]++;
195 157 *** 1 * 0 my $w = $y xor goto G6;
196 158 *** *0 $x[35]++;
197197 159 }
198198 160 G6:
199199 161
240240 202 1 1 no warnings "void";
241241 1
242242 1
243 203 *** 2 0 my $w = $z xor redo;
244 204 *** 0 $x[40]++;
243 203 *** 2 * 0 my $w = $z xor redo;
244 204 *** *0 $x[40]++;
245245 205 }
246246 206
247247 207 1 $z = -1;
251251 211 1 1 no warnings "void";
252252 1
253253 1
254 212 *** 2 0 my $w = !$z xor redo;
255 213 *** 0 $x[41]++;
254 212 *** 2 * 0 my $w = !$z xor redo;
255 213 *** *0 $x[41]++;
256256 214 }
257257 215
258258 216
271271 229 1 1 no warnings "void";
272272 1
273273 1
274 230 *** 4 0 4 shift xor return;
275 231 *** 0 $x[44]++;
274 230 *** 4 * 0 4 shift xor return;
275 231 *** *0 $x[44]++;
276276 232 },
277277 233
278278 234 sub {
341341 296
342342 297 1 my ($a, $b) = (0, 1);
343343 298
344 299 *** 1 50 33 if ($a && $b) {
345 *** 50 33
346 *** 50 50
347 300 *** 0 print "path 1\n";
344 299 *** 1 * 50 * 33 if ($a && $b) {
345 *** * 50 * 33
346 *** * 50 * 50
347 300 *** *0 print "path 1\n";
348348 301 } elsif (!$a && !$b) {
349 302 *** 0 print "path 2\n";
349 302 *** *0 print "path 2\n";
350350 303 } elsif ($b || 0) {
351351 304 1 print "path 3\n";
352 305 *** 1 50 33 if (!$b || $a) {
353 *** 50 33
354 306 *** 0 print "path 4\n";
352 305 *** 1 * 50 * 33 if (!$b || $a) {
353 *** * 50 * 33
354 306 *** *0 print "path 4\n";
355355 307 } elsif (!$a && $b) {
356356 308 1 print "path 5\n";
357357 309 }
3737 14
3838 15 1 for my $y (0, 0) {
3939 16 2 for my $z (1, 0) {
40 17 *** 4 50 33 if ($y && $z) {
41 18 *** 0 $x[1]++;
40 17 *** 4 * 50 * 33 if ($y && $z) {
41 18 *** *0 $x[1]++;
4242 19 } else {
4343 20 4 $x[2]++;
4444 21 }
45 22 *** 4 100 66 if ($y || $z) {
45 22 *** 4 100 * 66 if ($y || $z) {
4646 23 2 $x[3]++;
4747 24 } else {
4848 25 2 $x[4]++;
4949 26 }
5050 27
51 28 *** 4 50 $y && $x[5]++;
52 29 *** 4 50 $x[5]++ if $y;
51 28 *** 4 * 50 $y && $x[5]++;
52 29 *** 4 * 50 $x[5]++ if $y;
5353 30
5454 31 4 100 $z && $x[6]++;
5555 32 4 100 $x[6]++ if $z;
5656 33
57 34 *** 4 50 $y || $x[7]++;
58 35 *** 4 50 $x[7]++ unless $y;
57 34 *** 4 * 50 $y || $x[7]++;
58 35 *** 4 * 50 $x[7]++ unless $y;
5959 36
6060 37 4 100 $z || $x[8]++;
6161 38 4 100 $x[8]++ unless $z;
6262 39
63 40 *** 4 50 $y ? $x[9]++ : $x[10]++;
63 40 *** 4 * 50 $y ? $x[9]++ : $x[10]++;
6464 41 4 100 $z ? $x[11]++ : $x[12]++;
6565 42
66 43 *** 4 50 33 if ($y) {
67 *** 50 66
66 43 *** 4 * 50 * 33 if ($y) {
67 *** * 50 * 66
6868 100
69 44 *** 0 $x[13]++;
69 44 *** *0 $x[13]++;
7070 45 } elsif ($y && $z) {
71 46 *** 0 $x[14]++;
71 46 *** *0 $x[14]++;
7272 47 } elsif ($y || $z) {
7373 48 2 $x[15]++;
7474 49 } else {
7575 50 2 $x[16]++;
7676 51 }
7777 52
78 53 *** 4 50 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 50 33
78 53 *** 4 * 50 * 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 * 50 * 33
8080 54 }
8181 55 }
8282 56
105105 79 1 1 no warnings "void";
106106 1
107107 1
108 80 *** 2 0 my $w = $y xor next;
109 81 *** 0 $x[22]++;
108 80 *** 2 * 0 my $w = $y xor next;
109 81 *** *0 $x[22]++;
110110 82 }
111111 83
112112 84 1 for my $y (1, 0) {
113113 85 1 1 no warnings "void";
114114 1
115115 1
116 86 *** 2 0 my $w = $y xor next;
117 87 *** 0 $x[23]++;
116 86 *** 2 * 0 my $w = $y xor next;
117 87 *** *0 $x[23]++;
118118 88 }
119119 89
120120 90
121121 91 1 for my $y (0, 1) {
122 92 *** 1 50 $y || last;
123 93 *** 0 $x[24]++;
122 92 *** 1 * 50 $y || last;
123 93 *** *0 $x[24]++;
124124 94 }
125125 95
126126 96 1 for my $y (1, 0) {
134134 104 }
135135 105
136136 106 1 for my $y (1, 0) {
137 107 *** 1 50 $y && last;
138 108 *** 0 $x[27]++;
137 107 *** 1 * 50 $y && last;
138 108 *** *0 $x[27]++;
139139 109 }
140140 110
141141 111 1 for my $y (0, 1) {
142142 112 1 1 no warnings "void";
143143 1
144144 1
145 113 *** 1 0 my $w = $y xor last;
146 114 *** 0 $x[28]++;
145 113 *** 1 * 0 my $w = $y xor last;
146 114 *** *0 $x[28]++;
147147 115 }
148148 116
149149 117 1 for my $y (1, 0) {
150150 118 1 1 no warnings "void";
151151 1
152152 1
153 119 *** 1 0 my $w = $y xor last;
154 120 *** 0 $x[29]++;
153 119 *** 1 * 0 my $w = $y xor last;
154 120 *** *0 $x[29]++;
155155 121 }
156156 122
157157 123
158158 124 1 for my $y (0, 1) {
159 125 *** 1 50 $y || goto G1;
160 126 *** 0 $x[30]++;
159 125 *** 1 * 50 $y || goto G1;
160 126 *** *0 $x[30]++;
161161 127 }
162162 128 G1:
163163 129
174174 140 G3:
175175 141
176176 142 1 for my $y (1, 0) {
177 143 *** 1 50 $y && goto G4;
178 144 *** 0 $x[33]++;
177 143 *** 1 * 50 $y && goto G4;
178 144 *** *0 $x[33]++;
179179 145 }
180180 146 G4:
181181 147
183183 149 1 1 no warnings "void";
184184 1
185185 1
186 150 *** 1 0 my $w = $y xor goto G5;
187 151 *** 0 $x[34]++;
186 150 *** 1 * 0 my $w = $y xor goto G5;
187 151 *** *0 $x[34]++;
188188 152 }
189189 153 G5:
190190 154
192192 156 1 1 no warnings "void";
193193 1
194194 1
195 157 *** 1 0 my $w = $y xor goto G6;
196 158 *** 0 $x[35]++;
195 157 *** 1 * 0 my $w = $y xor goto G6;
196 158 *** *0 $x[35]++;
197197 159 }
198198 160 G6:
199199 161
240240 202 1 1 no warnings "void";
241241 1
242242 1
243 203 *** 2 0 my $w = $z xor redo;
244 204 *** 0 $x[40]++;
243 203 *** 2 * 0 my $w = $z xor redo;
244 204 *** *0 $x[40]++;
245245 205 }
246246 206
247247 207 1 $z = -1;
251251 211 1 1 no warnings "void";
252252 1
253253 1
254 212 *** 2 0 my $w = !$z xor redo;
255 213 *** 0 $x[41]++;
254 212 *** 2 * 0 my $w = !$z xor redo;
255 213 *** *0 $x[41]++;
256256 214 }
257257 215
258258 216
271271 229 1 1 no warnings "void";
272272 1
273273 1
274 230 *** 4 0 4 shift xor return;
275 231 *** 0 $x[44]++;
274 230 *** 4 * 0 4 shift xor return;
275 231 *** *0 $x[44]++;
276276 232 },
277277 233
278278 234 sub {
341341 296
342342 297 1 my ($a, $b) = (0, 1);
343343 298
344 299 *** 1 50 33 if ($a && $b) {
345 *** 50 33
346 *** 50 50
347 300 *** 0 print "path 1\n";
344 299 *** 1 * 50 * 33 if ($a && $b) {
345 *** * 50 * 33
346 *** * 50 * 50
347 300 *** *0 print "path 1\n";
348348 301 } elsif (!$a && !$b) {
349 302 *** 0 print "path 2\n";
349 302 *** *0 print "path 2\n";
350350 303 } elsif ($b || 0) {
351351 304 1 print "path 3\n";
352 305 *** 1 50 33 if (!$b || $a) {
353 *** 50 33
354 306 *** 0 print "path 4\n";
352 305 *** 1 * 50 * 33 if (!$b || $a) {
353 *** * 50 * 33
354 306 *** *0 print "path 4\n";
355355 307 } elsif (!$a && $b) {
356356 308 1 print "path 5\n";
357357 309 }
3737 14
3838 15 1 for my $y (0, 0) {
3939 16 2 for my $z (1, 0) {
40 17 *** 4 50 33 if ($y && $z) {
41 18 *** 0 $x[1]++;
40 17 *** 4 * 50 * 33 if ($y && $z) {
41 18 *** *0 $x[1]++;
4242 19 } else {
4343 20 4 $x[2]++;
4444 21 }
45 22 *** 4 100 66 if ($y || $z) {
45 22 *** 4 100 * 66 if ($y || $z) {
4646 23 2 $x[3]++;
4747 24 } else {
4848 25 2 $x[4]++;
4949 26 }
5050 27
51 28 *** 4 50 $y && $x[5]++;
52 29 *** 4 50 $x[5]++ if $y;
51 28 *** 4 * 50 $y && $x[5]++;
52 29 *** 4 * 50 $x[5]++ if $y;
5353 30
5454 31 4 100 $z && $x[6]++;
5555 32 4 100 $x[6]++ if $z;
5656 33
57 34 *** 4 50 $y || $x[7]++;
58 35 *** 4 50 $x[7]++ unless $y;
57 34 *** 4 * 50 $y || $x[7]++;
58 35 *** 4 * 50 $x[7]++ unless $y;
5959 36
6060 37 4 100 $z || $x[8]++;
6161 38 4 100 $x[8]++ unless $z;
6262 39
63 40 *** 4 50 $y ? $x[9]++ : $x[10]++;
63 40 *** 4 * 50 $y ? $x[9]++ : $x[10]++;
6464 41 4 100 $z ? $x[11]++ : $x[12]++;
6565 42
66 43 *** 4 50 33 if ($y) {
67 *** 50 66
66 43 *** 4 * 50 * 33 if ($y) {
67 *** * 50 * 66
6868 100
69 44 *** 0 $x[13]++;
69 44 *** *0 $x[13]++;
7070 45 } elsif ($y && $z) {
71 46 *** 0 $x[14]++;
71 46 *** *0 $x[14]++;
7272 47 } elsif ($y || $z) {
7373 48 2 $x[15]++;
7474 49 } else {
7575 50 2 $x[16]++;
7676 51 }
7777 52
78 53 *** 4 50 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 50 33
78 53 *** 4 * 50 * 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 * 50 * 33
8080 54 }
8181 55 }
8282 56
105105 79 1 1 no warnings "void";
106106 1
107107 1
108 80 *** 2 0 my $w = $y xor next;
109 81 *** 0 $x[22]++;
108 80 *** 2 * 0 my $w = $y xor next;
109 81 *** *0 $x[22]++;
110110 82 }
111111 83
112112 84 1 for my $y (1, 0) {
113113 85 1 1 no warnings "void";
114114 1
115115 1
116 86 *** 2 0 my $w = $y xor next;
117 87 *** 0 $x[23]++;
116 86 *** 2 * 0 my $w = $y xor next;
117 87 *** *0 $x[23]++;
118118 88 }
119119 89
120120 90
121121 91 1 for my $y (0, 1) {
122 92 *** 1 50 $y || last;
123 93 *** 0 $x[24]++;
122 92 *** 1 * 50 $y || last;
123 93 *** *0 $x[24]++;
124124 94 }
125125 95
126126 96 1 for my $y (1, 0) {
134134 104 }
135135 105
136136 106 1 for my $y (1, 0) {
137 107 *** 1 50 $y && last;
138 108 *** 0 $x[27]++;
137 107 *** 1 * 50 $y && last;
138 108 *** *0 $x[27]++;
139139 109 }
140140 110
141141 111 1 for my $y (0, 1) {
142142 112 1 1 no warnings "void";
143143 1
144144 1
145 113 *** 1 0 my $w = $y xor last;
146 114 *** 0 $x[28]++;
145 113 *** 1 * 0 my $w = $y xor last;
146 114 *** *0 $x[28]++;
147147 115 }
148148 116
149149 117 1 for my $y (1, 0) {
150150 118 1 1 no warnings "void";
151151 1
152152 1
153 119 *** 1 0 my $w = $y xor last;
154 120 *** 0 $x[29]++;
153 119 *** 1 * 0 my $w = $y xor last;
154 120 *** *0 $x[29]++;
155155 121 }
156156 122
157157 123
158158 124 1 for my $y (0, 1) {
159 125 *** 1 50 $y || goto G1;
160 126 *** 0 $x[30]++;
159 125 *** 1 * 50 $y || goto G1;
160 126 *** *0 $x[30]++;
161161 127 }
162162 128 G1:
163163 129
174174 140 G3:
175175 141
176176 142 1 for my $y (1, 0) {
177 143 *** 1 50 $y && goto G4;
178 144 *** 0 $x[33]++;
177 143 *** 1 * 50 $y && goto G4;
178 144 *** *0 $x[33]++;
179179 145 }
180180 146 G4:
181181 147
183183 149 1 1 no warnings "void";
184184 1
185185 1
186 150 *** 1 0 my $w = $y xor goto G5;
187 151 *** 0 $x[34]++;
186 150 *** 1 * 0 my $w = $y xor goto G5;
187 151 *** *0 $x[34]++;
188188 152 }
189189 153 G5:
190190 154
192192 156 1 1 no warnings "void";
193193 1
194194 1
195 157 *** 1 0 my $w = $y xor goto G6;
196 158 *** 0 $x[35]++;
195 157 *** 1 * 0 my $w = $y xor goto G6;
196 158 *** *0 $x[35]++;
197197 159 }
198198 160 G6:
199199 161
240240 202 1 1 no warnings "void";
241241 1
242242 1
243 203 *** 2 0 my $w = $z xor redo;
244 204 *** 0 $x[40]++;
243 203 *** 2 * 0 my $w = $z xor redo;
244 204 *** *0 $x[40]++;
245245 205 }
246246 206
247247 207 1 $z = -1;
251251 211 1 1 no warnings "void";
252252 1
253253 1
254 212 *** 2 0 my $w = !$z xor redo;
255 213 *** 0 $x[41]++;
254 212 *** 2 * 0 my $w = !$z xor redo;
255 213 *** *0 $x[41]++;
256256 214 }
257257 215
258258 216
271271 229 1 1 no warnings "void";
272272 1
273273 1
274 230 *** 4 0 4 shift xor return;
275 231 *** 0 $x[44]++;
274 230 *** 4 * 0 4 shift xor return;
275 231 *** *0 $x[44]++;
276276 232 },
277277 233
278278 234 sub {
341341 296
342342 297 1 my ($a, $b) = (0, 1);
343343 298
344 299 *** 1 50 33 if ($a && $b) {
345 *** 50 33
346 *** 50 50
347 300 *** 0 print "path 1\n";
344 299 *** 1 * 50 * 33 if ($a && $b) {
345 *** * 50 * 33
346 *** * 50 * 50
347 300 *** *0 print "path 1\n";
348348 301 } elsif (!$a && !$b) {
349 302 *** 0 print "path 2\n";
349 302 *** *0 print "path 2\n";
350350 303 } elsif ($b || 0) {
351351 304 1 print "path 3\n";
352 305 *** 1 50 33 if (!$b || $a) {
353 *** 50 33
354 306 *** 0 print "path 4\n";
352 305 *** 1 * 50 * 33 if (!$b || $a) {
353 *** * 50 * 33
354 306 *** *0 print "path 4\n";
355355 307 } elsif (!$a && $b) {
356356 308 1 print "path 5\n";
357357 309 }
3737 14
3838 15 1 for my $y (0, 0) {
3939 16 2 for my $z (1, 0) {
40 17 *** 4 50 33 if ($y && $z) {
41 18 *** 0 $x[1]++;
40 17 *** 4 * 50 * 33 if ($y && $z) {
41 18 *** *0 $x[1]++;
4242 19 } else {
4343 20 4 $x[2]++;
4444 21 }
45 22 *** 4 100 66 if ($y || $z) {
45 22 *** 4 100 * 66 if ($y || $z) {
4646 23 2 $x[3]++;
4747 24 } else {
4848 25 2 $x[4]++;
4949 26 }
5050 27
51 28 *** 4 50 $y && $x[5]++;
52 29 *** 4 50 $x[5]++ if $y;
51 28 *** 4 * 50 $y && $x[5]++;
52 29 *** 4 * 50 $x[5]++ if $y;
5353 30
5454 31 4 100 $z && $x[6]++;
5555 32 4 100 $x[6]++ if $z;
5656 33
57 34 *** 4 50 $y || $x[7]++;
58 35 *** 4 50 $x[7]++ unless $y;
57 34 *** 4 * 50 $y || $x[7]++;
58 35 *** 4 * 50 $x[7]++ unless $y;
5959 36
6060 37 4 100 $z || $x[8]++;
6161 38 4 100 $x[8]++ unless $z;
6262 39
63 40 *** 4 50 $y ? $x[9]++ : $x[10]++;
63 40 *** 4 * 50 $y ? $x[9]++ : $x[10]++;
6464 41 4 100 $z ? $x[11]++ : $x[12]++;
6565 42
66 43 *** 4 50 33 if ($y) {
67 *** 50 66
66 43 *** 4 * 50 * 33 if ($y) {
67 *** * 50 * 66
6868 100
69 44 *** 0 $x[13]++;
69 44 *** *0 $x[13]++;
7070 45 } elsif ($y && $z) {
71 46 *** 0 $x[14]++;
71 46 *** *0 $x[14]++;
7272 47 } elsif ($y || $z) {
7373 48 2 $x[15]++;
7474 49 } else {
7575 50 2 $x[16]++;
7676 51 }
7777 52
78 53 *** 4 50 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 50 33
78 53 *** 4 * 50 * 33 $y && $z && $x[17]++; $y && $z && $x[18]++;
79 *** 4 * 50 * 33
8080 54 }
8181 55 }
8282 56
105105 79 1 1 no warnings "void";
106106 1
107107 1
108 80 *** 2 0 my $w = $y xor next;
109 81 *** 0 $x[22]++;
108 80 *** 2 * 0 my $w = $y xor next;
109 81 *** *0 $x[22]++;
110110 82 }
111111 83
112112 84 1 for my $y (1, 0) {
113113 85 1 1 no warnings "void";
114114 1
115115 1
116 86 *** 2 0 my $w = $y xor next;
117 87 *** 0 $x[23]++;
116 86 *** 2 * 0 my $w = $y xor next;
117 87 *** *0 $x[23]++;
118118 88 }
119119 89
120120 90
121121 91 1 for my $y (0, 1) {
122 92 *** 1 50 $y || last;
123 93 *** 0 $x[24]++;
122 92 *** 1 * 50 $y || last;
123 93 *** *0 $x[24]++;
124124 94 }
125125 95
126126 96 1 for my $y (1, 0) {
134134 104 }
135135 105
136136 106 1 for my $y (1, 0) {
137 107 *** 1 50 $y && last;
138 108 *** 0 $x[27]++;
137 107 *** 1 * 50 $y && last;
138 108 *** *0 $x[27]++;
139139 109 }
140140 110
141141 111 1 for my $y (0, 1) {
142142 112 1 1 no warnings "void";
143143 1
144144 1
145 113 *** 1 0 my $w = $y xor last;
146 114 *** 0 $x[28]++;
145 113 *** 1 * 0 my $w = $y xor last;
146 114 *** *0 $x[28]++;
147147 115 }
148148 116
149149 117 1 for my $y (1, 0) {
150150 118 1 1 no warnings "void";
151151 1
152152 1
153 119 *** 1 0 my $w = $y xor last;
154 120 *** 0 $x[29]++;
153 119 *** 1 * 0 my $w = $y xor last;
154 120 *** *0 $x[29]++;
155155 121 }
156156 122
157157 123
158158 124 1 for my $y (0, 1) {
159 125 *** 1 50 $y || goto G1;
160 126 *** 0 $x[30]++;
159 125 *** 1 * 50 $y || goto G1;
160 126 *** *0 $x[30]++;
161161 127 }
162162 128 G1:
163163 129
174174 140 G3:
175175 141
176176 142 1 for my $y (1, 0) {
177 143 *** 1 50 $y && goto G4;
178 144 *** 0 $x[33]++;
177 143 *** 1 * 50 $y && goto G4;
178 144 *** *0 $x[33]++;
179179 145 }
180180 146 G4:
181181 147
183183 149 1 1 no warnings "void";
184184 1
185185 1
186 150 *** 1 0 my $w = $y xor goto G5;
187 151 *** 0 $x[34]++;
186 150 *** 1 * 0 my $w = $y xor goto G5;
187 151 *** *0 $x[34]++;
188188 152 }
189189 153 G5:
190190 154
192192 156 1 1 no warnings "void";
193193 1
194194 1
195 157 *** 1 0 my $w = $y xor goto G6;
196 158 *** 0 $x[35]++;
195 157 *** 1 * 0 my $w = $y xor goto G6;
196 158 *** *0 $x[35]++;
197197 159 }
198198 160 G6:
199199 161
240240 202 1 1 no warnings "void";
241241 1
242242 1
243 203 *** 2 0 my $w = $z xor redo;
244 204 *** 0 $x[40]++;
243 203 *** 2 * 0 my $w = $z xor redo;
244 204 *** *0 $x[40]++;
245245 205 }
246246 206
247247 207 1 $z = -1;
251251 211 1 1 no warnings "void";
252252 1
253253 1
254 212 *** 2 0 my $w = !$z xor redo;
255 213 *** 0 $x[41]++;
254 212 *** 2 * 0 my $w = !$z xor redo;
255 213 *** *0 $x[41]++;
256256 214 }
257257 215
258258 216
271271 229 1 1 no warnings "void";
272272 1
273273 1
274 230 *** 4 0 4 shift xor return;
275 231 *** 0 $x[44]++;
274 230 *** 4 * 0 4 shift xor return;
275 231 *** *0 $x[44]++;
276276 232 },
277277 233
278278 234 sub {
341341 296
342342 297 1 my ($a, $b) = (0, 1);
343343 298
344 299 *** 1 50 33 if ($a && $b) {
345 *** 50 33
346 *** 50 50
347 300 *** 0 print "path 1\n";
344 299 *** 1 * 50 * 33 if ($a && $b) {
345 *** * 50 * 33
346 *** * 50 * 50
347 300 *** *0 print "path 1\n";
348348 301 } elsif (!$a && !$b) {
349 302 *** 0 print "path 2\n";
349 302 *** *0 print "path 2\n";
350350 303 } elsif ($b || 0) {
351351 304 1 print "path 3\n";
352 305 *** 1 50 33 if (!$b || $a) {
353 *** 50 33
354 306 *** 0 print "path 4\n";
352 305 *** 1 * 50 * 33 if (!$b || $a) {
353 *** * 50 * 33
354 306 *** *0 print "path 4\n";
355355 307 } elsif (!$a && $b) {
356356 308 1 print "path 5\n";
357357 309 }
3434 15 sub t3 {
3535 16 1 1 for my $x (0, 1, 2) {
3636 17 3 100 100 last if $x && $x == 2 && $x == 2 && $x == 2;
37 *** 66
38 *** 66
37 *** * 66
38 *** * 66
3939 18 }
4040 19 }
4141 20
3333 14
3434 15 sub t3 {
3535 16 1 1 for my $x (0, 1, 2) {
36 17 *** 3 50 100 last if $x && $x == 2 && $x == 2 && $x == 2;
37 *** 66
38 *** 66
36 17 *** 3 * 50 100 last if $x && $x == 2 && $x == 2 && $x == 2;
37 *** * 66
38 *** * 66
3939 18 }
4040 19 }
4141 20
4343 19 1 my $z = 0;
4444 20 1 $::foo = 17;
4545 21
46 22 *** 1 50 if ($] >= 5.009) {
46 22 *** 1 * 50 if ($] >= 5.009) {
4747 23 1 $ENV{PATH} = "/bin";
4848 24 1 system "pwd";
4949 25 1 1 use lib "tests";
5050 1
5151 1
5252 26 1 my $file = "cond_or.pl";
53 27 *** 1 50 unless (my $return = do $file) {
54 28 *** 0 0 die "couldn't parse $file: $@" if $@;
55 29 *** 0 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** 0 0 die "couldn't run $file" unless $return;
53 27 *** 1 * 50 unless (my $return = do $file) {
54 28 *** *0 * 0 die "couldn't parse $file: $@" if $@;
55 29 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** *0 * 0 die "couldn't run $file" unless $return;
5757 31 }
5858 32 }
5959 33
6060 34 1 for my $i (0 .. 10) {
61 35 *** 11 50 $y ||
61 35 *** 11 * 50 $y ||
6262 36 $x[1]++;
6363 37
64 38 *** 11 50 33 $y ||
64 38 *** 11 * 50 * 33 $y ||
6565 39 $x[0]++ ||
6666 40 $x[1]++;
6767 41
68 42 *** 11 50 $x[2]++
68 42 *** 11 * 50 $x[2]++
6969 43 unless $z;
7070 44
7171 45 11 for (0 .. 2) {
7272 46 33 $x[3]++;
7373 47 }
7474 48
75 49 *** 11 50 if ($z) {
76 50 *** 0 $x[4]++;
75 49 *** 11 * 50 if ($z) {
76 50 *** *0 $x[4]++;
7777 51 } else {
7878 52 11 $x[5]++;
7979 53 }
8080 54
81 55 *** 11 33 my $p = $y || $z;
82 56 *** 11 33 my $q = $z || $y;
81 55 *** 11 * 33 my $p = $y || $z;
82 56 *** 11 * 33 my $q = $z || $y;
8383 57 11 100 my $r = $i || "qqq";
8484 58 11 100 my $s = $i || [];
8585 59 11 my $t = $y | $z;
86 60 *** 11 50 my $u = $y || 0;
87 61 *** 11 50 my $v = $y || undef;
88 62 *** 11 50 my $w = $z || 0;
86 60 *** 11 * 50 my $u = $y || 0;
87 61 *** 11 * 50 my $v = $y || undef;
88 62 *** 11 * 50 my $w = $z || 0;
8989 63
90 64 *** 11 33 $p ||= $y;
91 65 *** 11 33 $p ||= $z;
92 66 *** 11 66 $x[ 6] ||= $y;
93 67 *** 11 33 $x[ 7] ||= $z;
90 64 *** 11 * 33 $p ||= $y;
91 65 *** 11 * 33 $p ||= $z;
92 66 *** 11 * 66 $x[ 6] ||= $y;
93 67 *** 11 * 33 $x[ 7] ||= $z;
9494 68 11 100 $x[ 8] ||= 1;
9595 69 11 100 $x[ 9] ||= {};
9696 70 11 100 $x[10] ||= \"foo";
9797 71 11 100 $x[11] ||= \$y;
9898 72 11 100 $x[12] ||= \*STDIO;
99 73 *** 11 100 0 $x[13] ||= sub { 1 };
100 *** 0
99 73 *** 11 100 *0 $x[13] ||= sub { 1 };
100 *** *0
101101 74 11 100 $x[14] ||= *::foo{SCALAR};
102 75 *** 11 50 $x[15] ||= *STDIO{IO};
102 75 *** 11 * 50 $x[15] ||= *STDIO{IO};
103103 76 11 100 $x[16] ||= bless {}, "XXX";
104104 77 11 100 $x[17] ||= $i == 1;
105 78 *** 11 33 $w ||= ref($i) eq "SCALAR";
105 78 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
106106 79 11 100 $x[18] ||= <<"EOD";
107107 80 blah
108108 81 EOD
109 82 *** 11 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 0 0 sub { $x[19] ||= 1 };
111 *** 0
109 82 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 * 0 *0 sub { $x[19] ||= 1 };
111 *** *0
112112 84 }
113113 85
114114 86 # print join(", ", @x), "\n";
213213 13 sub cond_dor {
214214 14 11 11 my ($x) = @_;
215215 15
216 16 *** 11 50 $x->[18] //= undef;
217 17 *** 11 50 $x->[18] //= 0;
218 18 *** 11 50 $x->[18] //= 0;
219 19 *** 11 50 $x->[18] //= 1;
220 20 *** 11 50 $x->[18] //= 1;
216 16 *** 11 * 50 $x->[18] //= undef;
217 17 *** 11 * 50 $x->[18] //= 0;
218 18 *** 11 * 50 $x->[18] //= 0;
219 19 *** 11 * 50 $x->[18] //= 1;
220 20 *** 11 * 50 $x->[18] //= 1;
221221 21
222222 22 11 100 $x->[19] //= 1;
223 23 *** 11 50 $x->[19] //= 1;
224 24 *** 11 50 $x->[19] //= 0;
225 25 *** 11 50 $x->[19] //= undef;
226 26 *** 11 50 $x->[19] //= 1;
223 23 *** 11 * 50 $x->[19] //= 1;
224 24 *** 11 * 50 $x->[19] //= 0;
225 25 *** 11 * 50 $x->[19] //= undef;
226 26 *** 11 * 50 $x->[19] //= 1;
227227 27
228 28 *** 11 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 50 $x->[20] = $x->[21] // 1;
228 28 *** 11 * 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 * 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 * 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 * 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 * 50 $x->[20] = $x->[21] // 1;
233233 33
234234 34 11 100 $x->[22] = $x->[22] // undef;
235235 35 11 100 $x->[22] = $x->[22] // 0;
236 36 *** 11 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 50 $x->[22] = $x->[22] // 1;
236 36 *** 11 * 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 * 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 * 50 $x->[22] = $x->[22] // 1;
239239 39 }
240240 40
241241 41 1;
4343 19 1 my $z = 0;
4444 20 1 $::foo = 17;
4545 21
46 22 *** 1 50 if ($] >= 5.009) {
46 22 *** 1 * 50 if ($] >= 5.009) {
4747 23 1 $ENV{PATH} = "/bin";
4848 24 1 system "pwd";
4949 25 1 1 use lib "tests";
5050 1
5151 1
5252 26 1 my $file = "cond_or.pl";
53 27 *** 1 50 unless (my $return = do $file) {
54 28 *** 0 0 die "couldn't parse $file: $@" if $@;
55 29 *** 0 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** 0 0 die "couldn't run $file" unless $return;
53 27 *** 1 * 50 unless (my $return = do $file) {
54 28 *** *0 * 0 die "couldn't parse $file: $@" if $@;
55 29 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** *0 * 0 die "couldn't run $file" unless $return;
5757 31 }
5858 32 }
5959 33
6060 34 1 for my $i (0 .. 10) {
61 35 *** 11 50 $y ||
61 35 *** 11 * 50 $y ||
6262 36 $x[1]++;
6363 37
64 38 *** 11 50 33 $y ||
64 38 *** 11 * 50 * 33 $y ||
6565 39 $x[0]++ ||
6666 40 $x[1]++;
6767 41
68 42 *** 11 50 $x[2]++
68 42 *** 11 * 50 $x[2]++
6969 43 unless $z;
7070 44
7171 45 11 for (0 .. 2) {
7272 46 33 $x[3]++;
7373 47 }
7474 48
75 49 *** 11 50 if ($z) {
76 50 *** 0 $x[4]++;
75 49 *** 11 * 50 if ($z) {
76 50 *** *0 $x[4]++;
7777 51 } else {
7878 52 11 $x[5]++;
7979 53 }
8080 54
81 55 *** 11 33 my $p = $y || $z;
82 56 *** 11 33 my $q = $z || $y;
81 55 *** 11 * 33 my $p = $y || $z;
82 56 *** 11 * 33 my $q = $z || $y;
8383 57 11 100 my $r = $i || "qqq";
8484 58 11 100 my $s = $i || [];
8585 59 11 my $t = $y | $z;
86 60 *** 11 50 my $u = $y || 0;
87 61 *** 11 50 my $v = $y || undef;
88 62 *** 11 50 my $w = $z || 0;
86 60 *** 11 * 50 my $u = $y || 0;
87 61 *** 11 * 50 my $v = $y || undef;
88 62 *** 11 * 50 my $w = $z || 0;
8989 63
90 64 *** 11 33 $p ||= $y;
91 65 *** 11 33 $p ||= $z;
92 66 *** 11 66 $x[ 6] ||= $y;
93 67 *** 11 33 $x[ 7] ||= $z;
90 64 *** 11 * 33 $p ||= $y;
91 65 *** 11 * 33 $p ||= $z;
92 66 *** 11 * 66 $x[ 6] ||= $y;
93 67 *** 11 * 33 $x[ 7] ||= $z;
9494 68 11 100 $x[ 8] ||= 1;
9595 69 11 100 $x[ 9] ||= {};
9696 70 11 100 $x[10] ||= \"foo";
9797 71 11 100 $x[11] ||= \$y;
9898 72 11 100 $x[12] ||= \*STDIO;
99 73 *** 11 100 0 $x[13] ||= sub { 1 };
100 *** 0
99 73 *** 11 100 *0 $x[13] ||= sub { 1 };
100 *** *0
101101 74 11 100 $x[14] ||= *::foo{SCALAR};
102 75 *** 11 50 $x[15] ||= *STDIO{IO};
102 75 *** 11 * 50 $x[15] ||= *STDIO{IO};
103103 76 11 100 $x[16] ||= bless {}, "XXX";
104104 77 11 100 $x[17] ||= $i == 1;
105 78 *** 11 33 $w ||= ref($i) eq "SCALAR";
105 78 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
106106 79 11 100 $x[18] ||= <<"EOD";
107107 80 blah
108108 81 EOD
109 82 *** 11 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 0 0 sub { $x[19] ||= 1 };
111 *** 0
109 82 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 * 0 *0 sub { $x[19] ||= 1 };
111 *** *0
112112 84 }
113113 85
114114 86 # print join(", ", @x), "\n";
213213 13 sub cond_dor {
214214 14 11 11 my ($x) = @_;
215215 15
216 16 *** 11 50 $x->[18] //= undef;
217 17 *** 11 50 $x->[18] //= 0;
218 18 *** 11 50 $x->[18] //= 0;
219 19 *** 11 50 $x->[18] //= 1;
220 20 *** 11 50 $x->[18] //= 1;
216 16 *** 11 * 50 $x->[18] //= undef;
217 17 *** 11 * 50 $x->[18] //= 0;
218 18 *** 11 * 50 $x->[18] //= 0;
219 19 *** 11 * 50 $x->[18] //= 1;
220 20 *** 11 * 50 $x->[18] //= 1;
221221 21
222222 22 11 100 $x->[19] //= 1;
223 23 *** 11 50 $x->[19] //= 1;
224 24 *** 11 50 $x->[19] //= 0;
225 25 *** 11 50 $x->[19] //= undef;
226 26 *** 11 50 $x->[19] //= 1;
223 23 *** 11 * 50 $x->[19] //= 1;
224 24 *** 11 * 50 $x->[19] //= 0;
225 25 *** 11 * 50 $x->[19] //= undef;
226 26 *** 11 * 50 $x->[19] //= 1;
227227 27
228 28 *** 11 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 50 $x->[20] = $x->[21] // 1;
228 28 *** 11 * 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 * 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 * 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 * 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 * 50 $x->[20] = $x->[21] // 1;
233233 33
234234 34 11 100 $x->[22] = $x->[22] // undef;
235235 35 11 100 $x->[22] = $x->[22] // 0;
236 36 *** 11 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 50 $x->[22] = $x->[22] // 1;
236 36 *** 11 * 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 * 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 * 50 $x->[22] = $x->[22] // 1;
239239 39 }
240240 40
241241 41 1;
4343 19 1 my $z = 0;
4444 20 1 $::foo = 17;
4545 21
46 22 *** 1 50 if ($] >= 5.009) {
46 22 *** 1 * 50 if ($] >= 5.009) {
4747 23 1 $ENV{PATH} = "/bin";
4848 24 1 system "pwd";
4949 25 1 1 use lib "tests";
5050 1
5151 1
5252 26 1 my $file = "cond_or.pl";
53 27 *** 1 50 unless (my $return = do $file) {
54 28 *** 0 0 die "couldn't parse $file: $@" if $@;
55 29 *** 0 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** 0 0 die "couldn't run $file" unless $return;
53 27 *** 1 * 50 unless (my $return = do $file) {
54 28 *** *0 * 0 die "couldn't parse $file: $@" if $@;
55 29 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** *0 * 0 die "couldn't run $file" unless $return;
5757 31 }
5858 32 }
5959 33
6060 34 1 for my $i (0 .. 10) {
61 35 *** 11 50 $y ||
61 35 *** 11 * 50 $y ||
6262 36 $x[1]++;
6363 37
64 38 *** 11 50 33 $y ||
64 38 *** 11 * 50 * 33 $y ||
6565 39 $x[0]++ ||
6666 40 $x[1]++;
6767 41
68 42 *** 11 50 $x[2]++
68 42 *** 11 * 50 $x[2]++
6969 43 unless $z;
7070 44
7171 45 11 for (0 .. 2) {
7272 46 33 $x[3]++;
7373 47 }
7474 48
75 49 *** 11 50 if ($z) {
76 50 *** 0 $x[4]++;
75 49 *** 11 * 50 if ($z) {
76 50 *** *0 $x[4]++;
7777 51 } else {
7878 52 11 $x[5]++;
7979 53 }
8080 54
81 55 *** 11 33 my $p = $y || $z;
82 56 *** 11 33 my $q = $z || $y;
81 55 *** 11 * 33 my $p = $y || $z;
82 56 *** 11 * 33 my $q = $z || $y;
8383 57 11 100 my $r = $i || "qqq";
8484 58 11 100 my $s = $i || [];
8585 59 11 my $t = $y | $z;
86 60 *** 11 50 my $u = $y || 0;
87 61 *** 11 50 my $v = $y || undef;
88 62 *** 11 50 my $w = $z || 0;
86 60 *** 11 * 50 my $u = $y || 0;
87 61 *** 11 * 50 my $v = $y || undef;
88 62 *** 11 * 50 my $w = $z || 0;
8989 63
90 64 *** 11 33 $p ||= $y;
91 65 *** 11 33 $p ||= $z;
92 66 *** 11 66 $x[ 6] ||= $y;
93 67 *** 11 33 $x[ 7] ||= $z;
90 64 *** 11 * 33 $p ||= $y;
91 65 *** 11 * 33 $p ||= $z;
92 66 *** 11 * 66 $x[ 6] ||= $y;
93 67 *** 11 * 33 $x[ 7] ||= $z;
9494 68 11 100 $x[ 8] ||= 1;
9595 69 11 100 $x[ 9] ||= {};
9696 70 11 100 $x[10] ||= \"foo";
9797 71 11 100 $x[11] ||= \$y;
9898 72 11 100 $x[12] ||= \*STDIO;
99 73 *** 11 66 0 $x[13] ||= sub { 1 };
100 *** 0
99 73 *** 11 * 66 *0 $x[13] ||= sub { 1 };
100 *** *0
101101 74 11 100 $x[14] ||= *::foo{SCALAR};
102 75 *** 11 50 $x[15] ||= *STDIO{IO};
102 75 *** 11 * 50 $x[15] ||= *STDIO{IO};
103103 76 11 100 $x[16] ||= bless {}, "XXX";
104104 77 11 100 $x[17] ||= $i == 1;
105 78 *** 11 33 $w ||= ref($i) eq "SCALAR";
105 78 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
106106 79 11 100 $x[18] ||= <<"EOD";
107107 80 blah
108108 81 EOD
109 82 *** 11 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 0 0 sub { $x[19] ||= 1 };
111 *** 0
109 82 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 * 0 *0 sub { $x[19] ||= 1 };
111 *** *0
112112 84 }
113113 85
114114 86 # print join(", ", @x), "\n";
213213 13 sub cond_dor {
214214 14 11 11 my ($x) = @_;
215215 15
216 16 *** 11 50 $x->[18] //= undef;
217 17 *** 11 50 $x->[18] //= 0;
218 18 *** 11 50 $x->[18] //= 0;
219 19 *** 11 50 $x->[18] //= 1;
220 20 *** 11 50 $x->[18] //= 1;
216 16 *** 11 * 50 $x->[18] //= undef;
217 17 *** 11 * 50 $x->[18] //= 0;
218 18 *** 11 * 50 $x->[18] //= 0;
219 19 *** 11 * 50 $x->[18] //= 1;
220 20 *** 11 * 50 $x->[18] //= 1;
221221 21
222222 22 11 100 $x->[19] //= 1;
223 23 *** 11 50 $x->[19] //= 1;
224 24 *** 11 50 $x->[19] //= 0;
225 25 *** 11 50 $x->[19] //= undef;
226 26 *** 11 50 $x->[19] //= 1;
223 23 *** 11 * 50 $x->[19] //= 1;
224 24 *** 11 * 50 $x->[19] //= 0;
225 25 *** 11 * 50 $x->[19] //= undef;
226 26 *** 11 * 50 $x->[19] //= 1;
227227 27
228 28 *** 11 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 50 $x->[20] = $x->[21] // 1;
228 28 *** 11 * 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 * 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 * 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 * 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 * 50 $x->[20] = $x->[21] // 1;
233233 33
234234 34 11 100 $x->[22] = $x->[22] // undef;
235235 35 11 100 $x->[22] = $x->[22] // 0;
236 36 *** 11 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 50 $x->[22] = $x->[22] // 1;
236 36 *** 11 * 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 * 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 * 50 $x->[22] = $x->[22] // 1;
239239 39 }
240240 40
241241 41 1;
4343 19 1 my $z = 0;
4444 20 1 $::foo = 17;
4545 21
46 22 *** 1 50 if ($] >= 5.009) {
46 22 *** 1 * 50 if ($] >= 5.009) {
4747 23 1 $ENV{PATH} = "/bin";
4848 24 1 system "pwd";
4949 25 1 1 use lib "tests";
5050 1
5151 1
5252 26 1 my $file = "cond_or.pl";
53 27 *** 1 50 unless (my $return = do $file) {
54 28 *** 0 0 die "couldn't parse $file: $@" if $@;
55 29 *** 0 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** 0 0 die "couldn't run $file" unless $return;
53 27 *** 1 * 50 unless (my $return = do $file) {
54 28 *** *0 * 0 die "couldn't parse $file: $@" if $@;
55 29 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
56 30 *** *0 * 0 die "couldn't run $file" unless $return;
5757 31 }
5858 32 }
5959 33
6060 34 1 for my $i (0 .. 10) {
61 35 *** 11 50 $y ||
61 35 *** 11 * 50 $y ||
6262 36 $x[1]++;
6363 37
64 38 *** 11 50 33 $y ||
64 38 *** 11 * 50 * 33 $y ||
6565 39 $x[0]++ ||
6666 40 $x[1]++;
6767 41
68 42 *** 11 50 $x[2]++
68 42 *** 11 * 50 $x[2]++
6969 43 unless $z;
7070 44
7171 45 11 for (0 .. 2) {
7272 46 33 $x[3]++;
7373 47 }
7474 48
75 49 *** 11 50 if ($z) {
76 50 *** 0 $x[4]++;
75 49 *** 11 * 50 if ($z) {
76 50 *** *0 $x[4]++;
7777 51 } else {
7878 52 11 $x[5]++;
7979 53 }
8080 54
81 55 *** 11 33 my $p = $y || $z;
82 56 *** 11 33 my $q = $z || $y;
81 55 *** 11 * 33 my $p = $y || $z;
82 56 *** 11 * 33 my $q = $z || $y;
8383 57 11 100 my $r = $i || "qqq";
84 58 *** 11 66 my $s = $i || [];
84 58 *** 11 * 66 my $s = $i || [];
8585 59 11 my $t = $y | $z;
86 60 *** 11 50 my $u = $y || 0;
87 61 *** 11 50 my $v = $y || undef;
88 62 *** 11 50 my $w = $z || 0;
86 60 *** 11 * 50 my $u = $y || 0;
87 61 *** 11 * 50 my $v = $y || undef;
88 62 *** 11 * 50 my $w = $z || 0;
8989 63
90 64 *** 11 33 $p ||= $y;
91 65 *** 11 33 $p ||= $z;
92 66 *** 11 66 $x[ 6] ||= $y;
93 67 *** 11 33 $x[ 7] ||= $z;
90 64 *** 11 * 33 $p ||= $y;
91 65 *** 11 * 33 $p ||= $z;
92 66 *** 11 * 66 $x[ 6] ||= $y;
93 67 *** 11 * 33 $x[ 7] ||= $z;
9494 68 11 100 $x[ 8] ||= 1;
95 69 *** 11 66 $x[ 9] ||= {};
95 69 *** 11 * 66 $x[ 9] ||= {};
9696 70 11 100 $x[10] ||= \"foo";
9797 71 11 100 $x[11] ||= \$y;
9898 72 11 100 $x[12] ||= \*STDIO;
99 73 *** 11 66 0 $x[13] ||= sub { 1 };
100 *** 0
99 73 *** 11 * 66 *0 $x[13] ||= sub { 1 };
100 *** *0
101101 74 11 100 $x[14] ||= *::foo{SCALAR};
102 75 *** 11 50 $x[15] ||= *STDIO{IO};
102 75 *** 11 * 50 $x[15] ||= *STDIO{IO};
103103 76 11 100 $x[16] ||= bless {}, "XXX";
104104 77 11 100 $x[17] ||= $i == 1;
105 78 *** 11 33 $w ||= ref($i) eq "SCALAR";
105 78 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
106106 79 11 100 $x[18] ||= <<"EOD";
107107 80 blah
108108 81 EOD
109 82 *** 11 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 0 0 sub { $x[19] ||= 1 };
111 *** 0
109 82 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
110 83 *** 11 * 0 *0 sub { $x[19] ||= 1 };
111 *** *0
112112 84 }
113113 85
114114 86 # print join(", ", @x), "\n";
213213 13 sub cond_dor {
214214 14 11 11 my ($x) = @_;
215215 15
216 16 *** 11 50 $x->[18] //= undef;
217 17 *** 11 50 $x->[18] //= 0;
218 18 *** 11 50 $x->[18] //= 0;
219 19 *** 11 50 $x->[18] //= 1;
220 20 *** 11 50 $x->[18] //= 1;
216 16 *** 11 * 50 $x->[18] //= undef;
217 17 *** 11 * 50 $x->[18] //= 0;
218 18 *** 11 * 50 $x->[18] //= 0;
219 19 *** 11 * 50 $x->[18] //= 1;
220 20 *** 11 * 50 $x->[18] //= 1;
221221 21
222222 22 11 100 $x->[19] //= 1;
223 23 *** 11 50 $x->[19] //= 1;
224 24 *** 11 50 $x->[19] //= 0;
225 25 *** 11 50 $x->[19] //= undef;
226 26 *** 11 50 $x->[19] //= 1;
223 23 *** 11 * 50 $x->[19] //= 1;
224 24 *** 11 * 50 $x->[19] //= 0;
225 25 *** 11 * 50 $x->[19] //= undef;
226 26 *** 11 * 50 $x->[19] //= 1;
227227 27
228 28 *** 11 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 50 $x->[20] = $x->[21] // 1;
228 28 *** 11 * 50 $x->[20] = $x->[21] // undef;
229 29 *** 11 * 50 $x->[20] = $x->[21] // 0;
230 30 *** 11 * 50 $x->[20] = $x->[21] // 0;
231 31 *** 11 * 50 $x->[20] = $x->[21] // 1;
232 32 *** 11 * 50 $x->[20] = $x->[21] // 1;
233233 33
234234 34 11 100 $x->[22] = $x->[22] // undef;
235235 35 11 100 $x->[22] = $x->[22] // 0;
236 36 *** 11 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 50 $x->[22] = $x->[22] // 1;
236 36 *** 11 * 50 $x->[22] = $x->[22] // 0;
237 37 *** 11 * 50 $x->[22] = $x->[22] // 1;
238 38 *** 11 * 50 $x->[22] = $x->[22] // 1;
239239 39 }
240240 40
241241 41 1;
4141 18 12 my $x = $y ^ $z;
4242 19 12 100 $x = ($y xor $z);
4343 20
44 21 *** 12 50 my $p = ($i xor $y);
45 22 *** 12 50 $p = ($j xor $y);
44 21 *** 12 * 50 my $p = ($i xor $y);
45 22 *** 12 * 50 $p = ($j xor $y);
4646 23 12 $p ^= $y;
4747 24 }
4848 25 }
3737 1
3838 1
3939 14
40 15 *** 1 0 $SIG{__WARN__} = sub { die @_ };
41 *** 0
40 15 *** 1 *0 $SIG{__WARN__} = sub { die @_ };
41 *** *0
4242 16 1 require COP;
4343
4444
3535 12
3636 13 sub p {
3737 14 2 100 2 my $x = shift || 11;
38 15 *** 2 66 my $y = shift || [];
39 16 *** 2 66 my $z = shift || {};
38 15 *** 2 * 66 my $y = shift || [];
39 16 *** 2 * 66 my $z = shift || {};
4040 17 }
4141 18
4242 19 1 p $_, $_, $_ for 0, 1;
3838 1
3939 14
4040 15 my $xx = sub {
41 16 *** 0 0 print "xx";
41 16 *** *0 *0 print "xx";
4242 17 1 };
4343 18
4444 19 1 print B::Deparse->new->coderef2text($xx)
2626 7 # The latest version of this software should be available from my homepage:
2727 8 # http://www.pjcj.net
2828 9
29 10 *** 0 0 sub unused { 0 }
30 11 *** 0 sub empty { }
29 10 *** *0 *0 sub unused { 0 }
30 11 *** *0 sub empty { }
3131 12
3232 13 sub gen {
3333 14 4 4 my $x = shift;
3434 15 sub {
3535 16 5 5 my $y = shift;
36 17 *** 5 50 return $x + $y if $y;
36 17 *** 5 * 50 return $x + $y if $y;
3737 18 }
3838 19 4 };
3939 20
3333 1
3434 1
3535 12
36 13 *** 1 50 1 use lib -d "t" ? "t" : "..";
36 13 *** 1 * 50 1 use lib -d "t" ? "t" : "..";
3737 1
3838 1
3939 14
4949 22 EOS
5050 23
5151 24 1 2 eval <<'EOS';
52 *** 2 0
52 *** 2 *0
5353 2 3
54 *** 0
54 *** *0
5555 3
5656 25 sub f {
5757 26 $x++;
3030 9
3131 10 print "E3\n";
3232 11
33 12 *** 0 0 sub E3 { print "E3::E3\n" }
33 12 *** *0 *0 sub E3 { print "E3::E3\n" }
3434 13
3535 14 1
3636
5757 9
5858 10 print "E4\n";
5959 11
60 12 *** 0 0 sub E4 { print "E4::E4\n" }
60 12 *** *0 *0 sub E4 { print "E4::E4\n" }
6161 13
6262 14 1
6363
8686 1
8787 1
8888 11
89 12 *** 1 50 $x = shift || 0;
89 12 *** 1 * 50 $x = shift || 0;
9090 13 1 print "1 - $x\n";
91 14 *** 1 50 if ($x) { eval 'use E2' }
92 *** 0
91 14 *** 1 * 50 if ($x) { eval 'use E2' }
92 *** *0
9393 15 1 print "3 - $x\n";
94 16 *** 1 50 1 if ($x < 4) { eval 'use E3' }
94 16 *** 1 * 50 1 if ($x < 4) { eval 'use E3' }
9595 1
9696 1
9797 1
9898 1
9999 17 1 print "4 - $x\n";
100 18 *** 1 50 1 if ($x < 6) { eval 'use E4' }
100 18 *** 1 * 50 1 if ($x < 6) { eval 'use E4' }
101101 1
102102 1
103103 1
3030 1
3131 1
3232 11
33 12 *** 1 50 $x = shift || 0;
33 12 *** 1 * 50 $x = shift || 0;
3434 13 1 print "1 - $x\n";
35 14 *** 1 50 if ($x) { eval 'sub s1 { print "s1\n" }'; s1() }
36 *** 0
37 *** 0
35 14 *** 1 * 50 if ($x) { eval 'sub s1 { print "s1\n" }'; s1() }
36 *** *0
37 *** *0
3838 15 1 print "3 - $x\n";
39 16 *** 1 50 1 if ($x < 4) { eval 'sub s2 { print "s2\n" }'; s2() }
39 16 *** 1 * 50 1 if ($x < 4) { eval 'sub s2 { print "s2\n" }'; s2() }
4040 1
4141 1
4242 1
4343 17 1 print "4 - $x\n";
44 18 *** 1 50 1 if ($x < 6) { eval 'sub s3 { print "s3\n" }'; s3() }
44 18 *** 1 * 50 1 if ($x < 6) { eval 'sub s3 { print "s3\n" }'; s3() }
4545 1
4646 1
4747 1
8686 1
8787 1
8888 11
89 12 *** 1 50 $x = shift || 0;
89 12 *** 1 * 50 $x = shift || 0;
9090 13 1 print "1 - $x\n";
91 14 *** 1 50 if (!$x) {
91 14 *** 1 * 50 if (!$x) {
9292 15 1 1 eval "use E2"; eval "use E3";
9393 1 1
9494 1
100100 16 1 E2::E2(); E3::E3();
101101 1
102102 17 } else {
103 18 *** 0 eval "use E3"; eval "use E4";
104 *** 0
105 19 *** 0 E3::E3(); E4::E4();
106 *** 0
103 18 *** *0 eval "use E3"; eval "use E4";
104 *** *0
105 19 *** *0 E3::E3(); E4::E4();
106 *** *0
107107 20 }
108108 21 1 print "2 - $x\n";
109109
3636 13 1 2 eval "eval q[ sub config { {} } ]";
3737 2
3838 14
39 15 *** 1 50 my $e1 = config() || {};
40 16 *** 1 50 my $e2 = config()->{mail} || {};
39 15 *** 1 * 50 my $e1 = config() || {};
40 16 *** 1 * 50 my $e2 = config()->{mail} || {};
4141
4242
4343 Conditions
3636 13 1 2 eval "eval q[ sub config { {} } ]";
3737 2
3838 14
39 15 *** 1 33 my $e1 = config() || {};
40 16 *** 1 33 my $e2 = config()->{mail} || {};
39 15 *** 1 * 33 my $e1 = config() || {};
40 16 *** 1 * 33 my $e2 = config()->{mail} || {};
4141
4242
4343 Conditions
2727 4
2828 5 1 my $i = 1;
2929 6
30 7 *** 1 50 if ($i == 2) {
31 8 *** 0 print STDERR "hello\n";
30 7 *** 1 * 50 if ($i == 2) {
31 8 *** *0 print STDERR "hello\n";
3232 9 } else {
3333 10 1 print STDERR "goodbye\n";
3434 11 }
3535 12
3636 13 1 eval {
37 14 *** 1 50 if ($i == 2) {
38 15 *** 0 print STDERR "hello\n";
37 14 *** 1 * 50 if ($i == 2) {
38 15 *** *0 print STDERR "hello\n";
3939 16 } else {
4040 17 1 print STDERR "goodbye\n";
4141 18 }
5151 28
5252 29 sub ev {
5353 30 1 1 eval {
54 31 *** 1 50 if ($i == 2) {
55 32 *** 0 print STDERR "hello\n";
54 31 *** 1 * 50 if ($i == 2) {
55 32 *** *0 print STDERR "hello\n";
5656 33 } else {
5757 34 1 print STDERR "goodbye\n";
5858 35 }
4949 9
5050 10 print "E2\n";
5151 11
52 12 *** 0 0 sub E2 { print "E2::E2\n" }
52 12 *** *0 *0 sub E2 { print "E2::E2\n" }
5353 13
5454 14 1
5555
7676 9
7777 10 print "E3\n";
7878 11
79 12 *** 0 0 sub E3 { print "E3::E3\n" }
79 12 *** *0 *0 sub E3 { print "E3::E3\n" }
8080 13
8181 14 1
8282
103103 9
104104 10 print "E4\n";
105105 11
106 12 *** 0 0 sub E4 { print "E4::E4\n" }
106 12 *** *0 *0 sub E4 { print "E4::E4\n" }
107107 13
108108 14 1
109109
3030 11
3131 12 1 exec "echo foo";
3232 13
33 14 *** 0 die "Unreachable";
33 14 *** *0 die "Unreachable";
3434
3535
2929 10 # __COVER__ skip_test $^O eq "MSWin32"
3030 11 # __COVER__ skip_reason Fork uses threads on Windows
3131 12
32 13 *** 1 50 die unless defined ($pid = fork);
32 13 *** 1 * 50 die unless defined ($pid = fork);
3333 14
34 15 *** 1 50 if ($pid) {
34 15 *** 1 * 50 if ($pid) {
3535 16 1 wait;
3636 17 } else {
37 18 *** 0 0 local *Devel::Cover::_report = sub { die "Badness happened!" };
38 *** 0
39 19 *** 0 exec "echo We want to be able to see this.";
37 18 *** *0 *0 local *Devel::Cover::_report = sub { die "Badness happened!" };
38 *** *0
39 19 *** *0 exec "echo We want to be able to see this.";
4040 20 }
4141
4242
3737 12
3838 13 2 $x = 1;
3939 14
40 15 *** 2 50 die unless defined ($pid = fork);
40 15 *** 2 * 50 die unless defined ($pid = fork);
4141 16
4242 17 2 100 if ($pid) {
4343 18 1 $x = 2;
3737 14
3838 15 1 $x = 0;
3939 16
40 17 *** 1 50 if ($x) {
41 18 *** 0 $p++
40 17 *** 1 * 50 if ($x) {
41 18 *** *0 $p++
4242 19 }
4343 20
44 21 *** 1 50 unless ($x) {
44 21 *** 1 * 50 unless ($x) {
4545 22 1 $q++
4646 23 }
4747 24
4848 25 1 $x = 1;
4949 26
50 27 *** 1 50 if ($x) {
50 27 *** 1 * 50 if ($x) {
5151 28 1 $r++
5252 29 }
5353 30
54 31 *** 1 50 if ($x) {
54 31 *** 1 * 50 if ($x) {
5555 32 1 $r++
5656 33 } else {
57 34 *** 0 $s++
57 34 *** *0 $s++
5858 35 }
5959 36
60 37 *** 1 50 unless ($x) {
61 38 *** 0 $s++
60 37 *** 1 * 50 unless ($x) {
61 38 *** *0 $s++
6262 39 }
6363
6464
3131 11 $y++;
3232 12
3333 13 sub _aa {
34 14 *** 0 0 $y++;
35 15 *** 0 die;
36 16 *** 0 die;
34 14 *** *0 *0 $y++;
35 15 *** *0 die;
36 16 *** *0 die;
3737 17 }
3838 18
3939 19 sub xx {
40 20 *** 0 0 $y++;
41 21 *** 0 die;
40 20 *** *0 *0 $y++;
41 21 *** *0 die;
4242 22 }
4343 23
4444 24 sub yy {
45 25 *** 0 0 $y++;
45 25 *** *0 *0 $y++;
4646 26 }
4747 27
4848 28 sub zz {
109109 24 }
110110 25
111111 26 1 for (0 .. 10) {
112 27 *** 11 50 if (time) {
112 27 *** 11 * 50 if (time) {
113113 28 11 xx(0);
114114 29 } else {
115 30 *** 0 $x[1]++;
115 30 *** *0 $x[1]++;
116116 31 }
117117 32 }
118118
3131 11 $y++;
3232 12
3333 13 sub _aa {
34 14 *** 0 0 $y++;
35 15 *** 0 die;
36 16 *** 0 die;
34 14 *** *0 *0 $y++;
35 15 *** *0 die;
36 16 *** *0 die;
3737 17 }
3838 18
3939 19 sub _xx {
40 20 *** 0 0 $y++;
41 21 *** 0 die;
40 20 *** *0 *0 $y++;
41 21 *** *0 die;
4242 22 }
4343 23
4444 24 sub yy {
45 25 *** 0 0 $y++;
45 25 *** *0 *0 $y++;
4646 26 }
4747 27
4848 28 sub zz {
109109 24 }
110110 25
111111 26 1 for (0 .. 10) {
112 27 *** 11 50 if (time) {
112 27 *** 11 * 50 if (time) {
113113 28 11 xx(0);
114114 29 } else {
115 30 *** 0 $x[1]++;
115 30 *** *0 $x[1]++;
116116 31 }
117117 32 }
118118
5151 24 }
5252 25
5353 26 1 for (0 .. 10) {
54 27 *** 11 50 if (time) {
54 27 *** 11 * 50 if (time) {
5555 28 11 xx(0);
5656 29 } else {
57 30 *** 0 $x[1]++;
57 30 *** *0 $x[1]++;
5858 31 }
5959 32 }
6060 33
6464 37 1 $y++;
6565 38
6666 39 sub _aa {
67 40 *** 0 0 $y++;
68 41 *** 0 die;
69 42 *** 0 die;
67 40 *** *0 *0 $y++;
68 41 *** *0 die;
69 42 *** *0 die;
7070 43 }
7171 44
7272 45 sub xx {
73 46 *** 0 0 $y++;
74 47 *** 0 die;
73 46 *** *0 *0 $y++;
74 47 *** *0 die;
7575 48 }
7676 49
7777 50 sub yy {
78 51 *** 0 0 $y++;
78 51 *** *0 *0 $y++;
7979 52 }
8080 53
8181 54 sub zz {
5353 28
5454 29 sub wagh {
5555 30 2 2 my ( $self ) = @_;
56 31 *** 2 50 my $x = $self || 0;
56 31 *** 2 * 50 my $x = $self || 0;
5757 32 2 100 return $self->meep->{marp} || 0;
5858 33 # return $self || 0;
5959 34 }
2828 9
2929 10 package Foo;
3030 11 use overload
31 12 *** 0 0 '""' => sub { shift->render},
31 12 *** *0 *0 '""' => sub { shift->render},
3232 13 1 1 bool => sub { die; 1 };
33 *** 1 0
33 *** 1 *0
3434 1
35 *** 0
36 *** 0
35 *** *0
36 *** *0
3737 14
3838 15 sub render {
39 16 *** 0 0 "foo";
39 16 *** *0 *0 "foo";
4040 17 }
4141 18
4242 19 1 my $foo = 1;
43 20 *** 1 50 bless {}, 'Foo' if $foo;
43 20 *** 1 * 50 bless {}, 'Foo' if $foo;
4444 21
4545 22 1;
4646
3434 1
3535 12
3636 13 {
37 14 *** 0 package Cat;
37 14 *** *0 package Cat;
3838 15
3939 16 1 1 use overload (bool => "meh");
4040 1
3434 1
3535 12
3636 13 {
37 14 *** 0 package Cat;
37 14 *** *0 package Cat;
3838 15
3939 16 1 1 use overload (bool => "meh");
4040 1
4545 23
4646 24 1 my $seven = new two_face ("vii", 7);
4747 25 1 printf "seven=$seven, seven=%d, eight=%d\n", $seven, $seven+1;
48 26 *** 1 50 print "seven contains `i'\n" if $seven =~ /i/;
48 26 *** 1 * 50 print "seven contains `i'\n" if $seven =~ /i/;
4949
5050
5151 Branches
2626 1
2727 1
2828 5
29 6 *** 1 50 if (my @x = 'foo' =~ m/(.)/) {
29 6 *** 1 * 50 if (my @x = 'foo' =~ m/(.)/) {
3030 7 } else {
3131 8 }
3232
2626 1
2727 1
2828 5
29 6 *** 1 50 if (my @x = 'foo' =~ m/(.)/) {
29 6 *** 1 * 50 if (my @x = 'foo' =~ m/(.)/) {
3030 7 } else {
3131 8 }
3232
2626 1
2727 1
2828 5
29 6 *** 1 50 if (my @x = 'foo' =~ m/(.)/) {
29 6 *** 1 * 50 if (my @x = 'foo' =~ m/(.)/) {
3030 7 } else {
3131 8 }
3232
2929 9
3030 10 print "E2\n";
3131 11
32 12 *** 0 0 sub E2 { print "E2::E2\n" }
32 12 *** *0 *0 sub E2 { print "E2::E2\n" }
3333 13
3434 14 1
3535
5454 7 # The latest version of this software should be available from my homepage:
5555 8 # http://www.pjcj.net
5656 9
57 10 *** 1 50 1 use lib -d "t" ? "." : "..";
57 10 *** 1 * 50 1 use lib -d "t" ? "." : "..";
5858 1
5959 1
6060 11 1 1 use File::Spec;
4949 19 }
5050 20
5151 21 1 my $x = xx(3, 4, 5);
52 22 *** 1 50 die unless $x == 18;
52 22 *** 1 * 50 die unless $x == 18;
5353
5454
5555 Branches
2929 10 sub main {
3030 11 1 1 my ($debug) = @_;
3131 12 1 print "main\n";
32 13 *** 1 50 print "debug1\n" if $debug;
33 14 *** 1 50 if ($debug) {
34 15 *** 0 print "debug2\n";
32 13 *** 1 * 50 print "debug1\n" if $debug;
33 14 *** 1 * 50 if ($debug) {
34 15 *** *0 print "debug2\n";
3535 16 }
3636 17 }
3737 18
3333 12 }
3434 13
3535 14 sub forwards {
36 15 *** 0 0 return $a cmp $b;
36 15 *** *0 *0 return $a cmp $b;
3737 16 }
3838 17
3939 18 sub GetAlgorithm {
3838 15 1 my $y = 1;
3939 16
4040 17 1 for (0 .. 10) {
41 18 *** 11 50 $y &&
41 18 *** 11 * 50 $y &&
4242 19 $x[1]++;
4343 20
44 21 *** 11 100 66 $y &&
44 21 *** 11 100 * 66 $y &&
4545 22 $x[0]++ &&
4646 23 $x[1]++;
4747 24
48 25 *** 11 50 $x[2]++
48 25 *** 11 * 50 $x[2]++
4949 26 if $y;
5050 27
5151 28 11 for (0 .. 2) {
5252 29 33 $x[3]++;
5353 30 }
5454 31
55 32 *** 11 50 if ($y) {
55 32 *** 11 * 50 if ($y) {
5656 33 11 $x[4]++;
5757 34 } else {
58 35 *** 0 $x[5]++;
58 35 *** *0 $x[5]++;
5959 36 }
6060 37 }
6161 38
4141 18
4242 19 1 for (0 .. 10) {
4343 20 time &&
44 21 *** 11 50 $x[1]++;
44 21 *** 11 * 50 $x[1]++;
4545 22
46 23 *** 11 50 $x[2]++
46 23 *** 11 * 50 $x[2]++
4747 24 if time;
4848 25
4949 26 11 for (0 .. 2) {
5050 27 33 $x[3]++;
5151 28 }
5252 29
53 30 *** 11 50 if (time) {
53 30 *** 11 * 50 if (time) {
5454 31 11 xx(4);
5555 32 } else {
56 33 *** 0 $x[5]++;
56 33 *** *0 $x[5]++;
5757 34 }
5858 35 }
5959
0 Reading database from ...
1
2
3 ----------------------- ------ ------ ------ ------ ------
4 File stmt bran cond sub total
5 ----------------------- ------ ------ ------ ------ ------
6 tests/uncoverable_error 82.3 62.5 83.3 100.0 78.7
7 Total 82.3 62.5 83.3 100.0 78.7
8 ----------------------- ------ ------ ------ ------ ------
9
10
11 Run: ...
12 Perl version: ...
13 OS: ...
14 Start: ...
15 Finish: ...
16
17 tests/uncoverable_error
18
19 line err stmt bran cond sub code
20 1 #!/usr/bin/perl
21 2
22 3 # Copyright 2023, Paul Johnson (paul@pjcj.net)
23 4
24 5 # This software is free. It is licensed under the same terms as Perl itself.
25 6
26 7 # The latest version of this software should be available from my homepage:
27 8 # http://www.pjcj.net
28 9
29 10 sub usub {
30 11 # uncoverable subroutine class:ignore_covered_err
31 12 # uncoverable statement class:ignore_covered_err
32 13 -1 -1 my $x = 1;
33 14 }
34 15
35 16 sub main {
36 17 1 1 my $x = 1;
37 18 # uncoverable branch false class:ignore_covered_err
38 19 # uncoverable branch true
39 20 1 - 50 if ($x > 1) {
40 21 *** *0 $x = 0;
41 22 # uncoverable statement class:ignore_covered_err
42 23 -0 $x = 2;
43 24 *** *0 * 0 if ($x > 3) {
44 25 *** *0 $x = 4;
45 26 }
46 27 }
47 28
48 29 1 my $y = 0;
49 30 # uncoverable branch true
50 31 # uncoverable condition left
51 32 # uncoverable condition right class:ignore_covered_err
52 33 # uncoverable condition false
53 34 1 - 50 - 33 if ($x > 0 && $y > 0) {
54 35 # uncoverable statement
55 36 -0 $y = 1;
56 37 }
57 38
58 39 1 while ($y < 4) {
59 40 # uncoverable branch false
60 41 # uncoverable condition left
61 42 # uncoverable condition right
62 43 *** 2 *-100 *- 66 if ($x > 0 && $y > 0) {
63 44 1 $y = 4;
64 45 } else {
65 46 1 $y++;
66 47 }
67 48 }
68 49
69 50 # uncoverable statement class:ignore_covered_err
70 51 -1 $x = 3;
71 52 1 usub;
72 53 }
73 54
74 55 1 main
75
76
77 Branches
78 --------
79
80 line err % true false branch
81 ----- --- ------ ------ ------ ------
82 20 - 50 -0 -1 if ($x > 1)
83 24 *** 0 0 0 if ($x > 3)
84 34 - 50 -0 1 if ($x > 0 and $y > 0)
85 43 *** -100 1 -1 if ($x > 0 and $y > 0) { }
86
87
88 Conditions
89 ----------
90
91 and 3 conditions
92
93 line err % !l l&&!r l&&r expr
94 ----- --- ------ ------ ------ ------ ----
95 34 - 33 -0 -1 -0 $x > 0 and $y > 0
96 43 *** - 66 -0 -1 1 $x > 0 and $y > 0
97
98
99 Covered Subroutines
100 -------------------
101
102 Subroutine Count Location
103 ---------- ----- --------------------------
104 main 1 tests/uncoverable_error:17
105 usub -1 tests/uncoverable_error:13
106
107
0 Reading database from ...
1
2
3 ------------------------------ ------ ------ ------ ------ ------
4 File stmt bran cond sub total
5 ------------------------------ ------ ------ ------ ------ ------
6 tests/uncoverable_error_ignore 82.3 75.0 66.6 100.0 78.7
7 Total 82.3 75.0 66.6 100.0 78.7
8 ------------------------------ ------ ------ ------ ------ ------
9
10
11 Run: ...
12 Perl version: ...
13 OS: ...
14 Start: ...
15 Finish: ...
16
17 tests/uncoverable_error_ignore
18
19 line err stmt bran cond sub code
20 1 #!/usr/bin/perl
21 2
22 3 # Copyright 2023, Paul Johnson (paul@pjcj.net)
23 4
24 5 # This software is free. It is licensed under the same terms as Perl itself.
25 6
26 7 # The latest version of this software should be available from my homepage:
27 8 # http://www.pjcj.net
28 9
29 10 # __COVER__ cover_parameters -ignore_covered_err
30 11
31 12 sub usub {
32 13 # uncoverable subroutine
33 14 # uncoverable statement
34 15 -1 -1 my $x = 1;
35 16 }
36 17
37 18 sub main {
38 19 1 1 my $x = 1;
39 20 # uncoverable branch false
40 21 # uncoverable branch true
41 22 1 - 50 if ($x > 1) {
42 23 *** *0 $x = 0;
43 24 # uncoverable statement
44 25 -0 $x = 2;
45 26 *** *0 * 0 if ($x > 3) {
46 27 *** *0 $x = 4;
47 28 }
48 29 }
49 30
50 31 1 my $y = 0;
51 32 # uncoverable branch true
52 33 # uncoverable condition right
53 34 *** 1 - 50 *- 33 if ($x > 0 && $y > 0) {
54 35 # uncoverable statement
55 36 -0 $y = 1;
56 37 }
57 38
58 39 1 while ($y < 4) {
59 40 # uncoverable branch false
60 41 # uncoverable condition left
61 42 # uncoverable condition right
62 43 2 -100 - 66 if ($x > 0 && $y > 0) {
63 44 1 $y = 4;
64 45 } else {
65 46 1 $y++;
66 47 }
67 48 }
68 49
69 50 # uncoverable statement
70 51 -1 $x = 3;
71 52 1 usub;
72 53 }
73 54
74 55 1 main
75
76
77 Branches
78 --------
79
80 line err % true false branch
81 ----- --- ------ ------ ------ ------
82 22 - 50 -0 -1 if ($x > 1)
83 26 *** 0 0 0 if ($x > 3)
84 34 - 50 -0 1 if ($x > 0 and $y > 0)
85 43 -100 1 -1 if ($x > 0 and $y > 0) { }
86
87
88 Conditions
89 ----------
90
91 and 3 conditions
92
93 line err % !l l&&!r l&&r expr
94 ----- --- ------ ------ ------ ------ ----
95 34 *** - 33 0 -1 0 $x > 0 and $y > 0
96 43 - 66 -0 -1 1 $x > 0 and $y > 0
97
98
99 Covered Subroutines
100 -------------------
101
102 Subroutine Count Location
103 ---------- ----- ---------------------------------
104 main 1 tests/uncoverable_error_ignore:19
105 usub -1 tests/uncoverable_error_ignore:15
106
107
0 #!/usr/bin/perl
1
2 # Copyright 2023, Paul Johnson (paul@pjcj.net)
3
4 # This software is free. It is licensed under the same terms as Perl itself.
5
6 # The latest version of this software should be available from my homepage:
7 # http://www.pjcj.net
8
9 sub usub {
10 # uncoverable subroutine class:ignore_covered_err
11 # uncoverable statement class:ignore_covered_err
12 my $x = 1;
13 }
14
15 sub main {
16 my $x = 1;
17 # uncoverable branch false class:ignore_covered_err
18 # uncoverable branch true
19 if ($x > 1) {
20 $x = 0;
21 # uncoverable statement class:ignore_covered_err
22 $x = 2;
23 if ($x > 3) {
24 $x = 4;
25 }
26 }
27
28 my $y = 0;
29 # uncoverable branch true
30 # uncoverable condition left
31 # uncoverable condition right class:ignore_covered_err
32 # uncoverable condition false
33 if ($x > 0 && $y > 0) {
34 # uncoverable statement
35 $y = 1;
36 }
37
38 while ($y < 4) {
39 # uncoverable branch false
40 # uncoverable condition left
41 # uncoverable condition right
42 if ($x > 0 && $y > 0) {
43 $y = 4;
44 } else {
45 $y++;
46 }
47 }
48
49 # uncoverable statement class:ignore_covered_err
50 $x = 3;
51 usub;
52 }
53
54 main
0 #!/usr/bin/perl
1
2 # Copyright 2023, Paul Johnson (paul@pjcj.net)
3
4 # This software is free. It is licensed under the same terms as Perl itself.
5
6 # The latest version of this software should be available from my homepage:
7 # http://www.pjcj.net
8
9 # __COVER__ cover_parameters -ignore_covered_err
10
11 sub usub {
12 # uncoverable subroutine
13 # uncoverable statement
14 my $x = 1;
15 }
16
17 sub main {
18 my $x = 1;
19 # uncoverable branch false
20 # uncoverable branch true
21 if ($x > 1) {
22 $x = 0;
23 # uncoverable statement
24 $x = 2;
25 if ($x > 3) {
26 $x = 4;
27 }
28 }
29
30 my $y = 0;
31 # uncoverable branch true
32 # uncoverable condition right
33 if ($x > 0 && $y > 0) {
34 # uncoverable statement
35 $y = 1;
36 }
37
38 while ($y < 4) {
39 # uncoverable branch false
40 # uncoverable condition left
41 # uncoverable condition right
42 if ($x > 0 && $y > 0) {
43 $y = 4;
44 } else {
45 $y++;
46 }
47 }
48
49 # uncoverable statement
50 $x = 3;
51 usub;
52 }
53
54 main