Skip to content

Commit

Permalink
update cond_or to drop pre-5.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 20, 2024
1 parent 9164def commit 0fb044b
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 460 deletions.
251 changes: 124 additions & 127 deletions test_output/cover/cond_or.5.012000
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Reading database from ...
---------------- ------ ------ ------ ------ ------
File stmt bran cond sub total
---------------- ------ ------ ------ ------ ------
tests/cond_or 89.6 35.0 64.4 60.0 70.4
tests/cond_or 89.4 33.3 64.4 60.0 70.5
tests/cond_or.pl 100.0 n/a 57.5 100.0 75.7
Total 92.9 35.0 61.6 75.0 72.1
Total 92.8 33.3 61.6 75.0 72.2
---------------- ------ ------ ------ ------ ------


Expand All @@ -28,8 +28,8 @@ line err stmt bran cond sub code
7 # The latest version of this software should be available from my homepage:
8 # http://www.pjcj.net
9
10 # __COVER__ skip_test $] < 5.008 || $^O eq "cygwin"
11 # __COVER__ skip_reason Busted on 5.6 and cygwin
10 # __COVER__ skip_test $^O eq "cygwin"
11 # __COVER__ skip_reason Busted on cygwin
12
13 1 1 use strict;
1
Expand All @@ -44,92 +44,89 @@ line err stmt bran cond sub code
19 1 my $z = 0;
20 1 $::foo = 17;
21
22 *** 1 * 50 if ($] >= 5.009) {
23 1 $ENV{PATH} = "/bin";
24 1 system "pwd";
25 1 1 use lib "tests";
22 1 $ENV{PATH} = "/bin";
23 1 system "pwd";
24 1 1 use lib "tests";
1
1
26 1 my $file = "cond_or.pl";
27 *** 1 * 50 unless (my $return = do $file) {
28 *** *0 * 0 die "couldn't parse $file: $@" if $@;
29 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
30 *** *0 * 0 die "couldn't run $file" unless $return;
31 }
32 }
33
34 1 for my $i (0 .. 10) {
35 *** 11 * 50 $y ||
36 $x[1]++;
37
38 *** 11 * 50 * 33 $y ||
39 $x[0]++ ||
40 $x[1]++;
41
42 *** 11 * 50 $x[2]++
43 unless $z;
44
45 11 for (0 .. 2) {
46 33 $x[3]++;
47 }
48
49 *** 11 * 50 if ($z) {
50 *** *0 $x[4]++;
51 } else {
52 11 $x[5]++;
53 }
54
55 *** 11 * 33 my $p = $y || $z;
56 *** 11 * 33 my $q = $z || $y;
57 11 100 my $r = $i || "qqq";
58 11 100 my $s = $i || [];
59 11 my $t = $y | $z;
60 *** 11 * 50 my $u = $y || 0;
61 *** 11 * 50 my $v = $y || undef;
62 *** 11 * 50 my $w = $z || 0;
63
64 *** 11 * 33 $p ||= $y;
65 *** 11 * 33 $p ||= $z;
66 *** 11 * 66 $x[ 6] ||= $y;
67 *** 11 * 33 $x[ 7] ||= $z;
68 11 100 $x[ 8] ||= 1;
69 11 100 $x[ 9] ||= {};
70 11 100 $x[10] ||= \"foo";
71 11 100 $x[11] ||= \$y;
72 11 100 $x[12] ||= \*STDIO;
73 *** 11 100 *0 $x[13] ||= sub { 1 };
25 1 my $file = "cond_or.pl";
26 *** 1 * 50 unless (my $return = do $file) {
27 *** *0 * 0 die "couldn't parse $file: $@" if $@;
28 *** *0 * 0 die "couldn't do $file: $!" unless defined $return;
29 *** *0 * 0 die "couldn't run $file" unless $return;
30 }
31
32 1 for my $i (0 .. 10) {
33 *** 11 * 50 $y ||
34 $x[1]++;
35
36 *** 11 * 50 * 33 $y ||
37 $x[0]++ ||
38 $x[1]++;
39
40 *** 11 * 50 $x[2]++
41 unless $z;
42
43 11 for (0 .. 2) {
44 33 $x[3]++;
45 }
46
47 *** 11 * 50 if ($z) {
48 *** *0 $x[4]++;
49 } else {
50 11 $x[5]++;
51 }
52
53 *** 11 * 33 my $p = $y || $z;
54 *** 11 * 33 my $q = $z || $y;
55 11 100 my $r = $i || "qqq";
56 11 100 my $s = $i || [];
57 11 my $t = $y | $z;
58 *** 11 * 50 my $u = $y || 0;
59 *** 11 * 50 my $v = $y || undef;
60 *** 11 * 50 my $w = $z || 0;
61
62 *** 11 * 33 $p ||= $y;
63 *** 11 * 33 $p ||= $z;
64 *** 11 * 66 $x[ 6] ||= $y;
65 *** 11 * 33 $x[ 7] ||= $z;
66 11 100 $x[ 8] ||= 1;
67 11 100 $x[ 9] ||= {};
68 11 100 $x[10] ||= \"foo";
69 11 100 $x[11] ||= \$y;
70 11 100 $x[12] ||= \*STDIO;
71 *** 11 100 *0 $x[13] ||= sub { 1 };
*** *0
74 11 100 $x[14] ||= *::foo{SCALAR};
75 *** 11 * 50 $x[15] ||= *STDIO{IO};
76 11 100 $x[16] ||= bless {}, "XXX";
77 11 100 $x[17] ||= $i == 1;
78 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
79 11 100 $x[18] ||= <<"EOD";
80 blah
81 EOD
82 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
83 *** 11 * 0 *0 sub { $x[19] ||= 1 };
72 11 100 $x[14] ||= *::foo{SCALAR};
73 *** 11 * 50 $x[15] ||= *STDIO{IO};
74 11 100 $x[16] ||= bless {}, "XXX";
75 11 100 $x[17] ||= $i == 1;
76 *** 11 * 33 $w ||= ref($i) eq "SCALAR";
77 11 100 $x[18] ||= <<"EOD";
78 blah
79 EOD
80 *** 11 * 50 cond_dor(\@x) if exists &cond_dor;
81 *** 11 * 0 *0 sub { $x[19] ||= 1 };
*** *0
84 }
85
86 # print join(", ", @x), "\n";
82 }
83
84 # print join(", ", @x), "\n";


Branches
--------

line err % true false branch
----- --- ------ ------ ------ ------
22 *** 50 1 0 if ($] >= "5.009")
27 *** 50 0 1 unless (my $return = do $file)
28 *** 0 0 0 if $@
29 *** 0 0 0 unless defined $return
30 *** 0 0 0 unless $return
35 *** 50 0 11 unless $y
38 *** 50 0 11 unless $y or $x[0]++
42 *** 50 11 0 unless $z
49 *** 50 0 11 if ($z) { }
82 *** 50 11 0 if exists &cond_dor
26 *** 50 0 1 unless (my $return = do $file)
27 *** 0 0 0 if $@
28 *** 0 0 0 unless defined $return
29 *** 0 0 0 unless $return
33 *** 50 0 11 unless $y
36 *** 50 0 11 unless $y or $x[0]++
40 *** 50 11 0 unless $z
47 *** 50 0 11 if ($z) { }
80 *** 50 11 0 if exists &cond_dor


Conditions
Expand All @@ -139,39 +136,39 @@ or 2 conditions

line err % l !l expr
----- --- ------ ------ ------ ----
57 100 10 1 $i || 'qqq'
58 100 10 1 $i || []
60 *** 50 11 0 $y || 0
61 *** 50 11 0 $y || undef
62 *** 50 0 11 $z || 0
68 100 10 1 $x[8] ||= 1
69 100 10 1 $x[9] ||= {}
70 100 10 1 $x[10] ||= \"foo"
71 100 10 1 $x[11] ||= \$y
72 100 10 1 $x[12] ||= \*STDIO
73 100 10 1 $x[13] ||= sub {
55 100 10 1 $i || 'qqq'
56 100 10 1 $i || []
58 *** 50 11 0 $y || 0
59 *** 50 11 0 $y || undef
60 *** 50 0 11 $z || 0
66 100 10 1 $x[8] ||= 1
67 100 10 1 $x[9] ||= {}
68 100 10 1 $x[10] ||= \"foo"
69 100 10 1 $x[11] ||= \$y
70 100 10 1 $x[12] ||= \*STDIO
71 100 10 1 $x[13] ||= sub {
1;
}

74 100 10 1 $x[14] ||= *foo{"SCALAR"}
75 *** 50 0 11 $x[15] ||= *STDIO{"IO"}
76 100 10 1 $x[16] ||= bless({}, "XXX")
79 100 10 1 $x[18] ||= "blah\n"
83 *** 0 0 0 $x[19] ||= 1
72 100 10 1 $x[14] ||= *foo{"SCALAR"}
73 *** 50 0 11 $x[15] ||= *STDIO{"IO"}
74 100 10 1 $x[16] ||= bless({}, "XXX")
77 100 10 1 $x[18] ||= "blah\n"
81 *** 0 0 0 $x[19] ||= 1

or 3 conditions

line err % l !l&&r !l&&!r expr
----- --- ------ ------ ------ ------ ----
38 *** 33 11 0 0 $y or $x[0]++
55 *** 33 11 0 0 $y || $z
56 *** 33 0 11 0 $z || $y
64 *** 33 11 0 0 $p ||= $y
65 *** 33 11 0 0 $p ||= $z
66 *** 66 10 1 0 $x[6] ||= $y
67 *** 33 0 0 11 $x[7] ||= $z
77 100 9 1 1 $x[17] ||= $i == 1
78 *** 33 0 0 11 $w ||= ref $i eq "SCALAR"
36 *** 33 11 0 0 $y or $x[0]++
53 *** 33 11 0 0 $y || $z
54 *** 33 0 11 0 $z || $y
62 *** 33 11 0 0 $p ||= $y
63 *** 33 11 0 0 $p ||= $z
64 *** 66 10 1 0 $x[6] ||= $y
65 *** 33 0 0 11 $x[7] ||= $z
75 100 9 1 1 $x[17] ||= $i == 1
76 *** 33 0 0 11 $w ||= ref $i eq "SCALAR"


Covered Subroutines
Expand All @@ -181,15 +178,15 @@ Subroutine Count Location
---------- ----- ----------------
BEGIN 1 tests/cond_or:13
BEGIN 1 tests/cond_or:14
BEGIN 1 tests/cond_or:25
BEGIN 1 tests/cond_or:24

Uncovered Subroutines
---------------------

Subroutine Count Location
---------- ----- ----------------
__ANON__ 0 tests/cond_or:73
__ANON__ 0 tests/cond_or:83
__ANON__ 0 tests/cond_or:71
__ANON__ 0 tests/cond_or:81


tests/cond_or.pl
Expand Down Expand Up @@ -249,26 +246,26 @@ or 2 conditions

line err % l !l expr
----- --- ------ ------ ------ ----
16 *** 50 1 0 $$x[18] //= undef
17 *** 50 1 0 $$x[18] //= 0
18 *** 50 1 0 $$x[18] //= 0
19 *** 50 1 0 $$x[18] //= 1
20 *** 50 1 0 $$x[18] //= 1
22 100 1 1 $$x[19] //= 1
23 *** 50 1 0 $$x[19] //= 1
24 *** 50 1 0 $$x[19] //= 0
25 *** 50 1 0 $$x[19] //= undef
26 *** 50 1 0 $$x[19] //= 1
28 *** 50 0 1 $$x[21] // undef
29 *** 50 0 1 $$x[21] // 0
30 *** 50 0 1 $$x[21] // 0
31 *** 50 0 1 $$x[21] // 1
32 *** 50 0 1 $$x[21] // 1
34 100 1 1 $$x[22] // undef
35 100 1 1 $$x[22] // 0
36 *** 50 1 0 $$x[22] // 0
37 *** 50 1 0 $$x[22] // 1
38 *** 50 1 0 $$x[22] // 1
16 *** 50 11 0 $$x[18] //= undef
17 *** 50 11 0 $$x[18] //= 0
18 *** 50 11 0 $$x[18] //= 0
19 *** 50 11 0 $$x[18] //= 1
20 *** 50 11 0 $$x[18] //= 1
22 100 10 1 $$x[19] //= 1
23 *** 50 11 0 $$x[19] //= 1
24 *** 50 11 0 $$x[19] //= 0
25 *** 50 11 0 $$x[19] //= undef
26 *** 50 11 0 $$x[19] //= 1
28 *** 50 0 11 $$x[21] // undef
29 *** 50 0 11 $$x[21] // 0
30 *** 50 0 11 $$x[21] // 0
31 *** 50 0 11 $$x[21] // 1
32 *** 50 0 11 $$x[21] // 1
34 100 10 1 $$x[22] // undef
35 100 10 1 $$x[22] // 0
36 *** 50 11 0 $$x[22] // 0
37 *** 50 11 0 $$x[22] // 1
38 *** 50 11 0 $$x[22] // 1


Covered Subroutines
Expand Down
Loading

0 comments on commit 0fb044b

Please sign in to comment.