Skip to content

Commit 4cb2d3f

Browse files
wolfsageFather Chrysostomos
authored and
Father Chrysostomos
committed
Tests for rpeep optimisations in e45d898
1 parent 4748e00 commit 4cb2d3f

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

ext/B/t/optree_samples.t

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BEGIN {
1414
}
1515
use OptreeCheck;
1616
use Config;
17-
plan tests => 37;
17+
plan tests => 43;
1818

1919
pass("GENERAL OPTREE EXAMPLES");
2020

@@ -653,6 +653,60 @@ EOT_EOT
653653
# 3 <1> leavesub[1 ref] K/REFC,1
654654
EONT_EONT
655655

656+
pass("rpeep - if ($a || $b)");
657+
658+
checkOptree ( name => 'if ($a || $b) { } return 1',
659+
code => 'if ($a || $b) { } return 1',
660+
bcopts => '-exec',
661+
expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
662+
# 1 <;> nextstate(main 997 (eval 15):1) v
663+
# 2 <#> gvsv[*a] s
664+
# 3 <|> or(other->4) sK/1
665+
# 4 <#> gvsv[*b] s
666+
# 5 <|> and(other->6) vK/1
667+
# 6 <0> stub v
668+
# 7 <;> nextstate(main 997 (eval 15):1) v
669+
# 8 <$> const[IV 1] s
670+
# 9 <1> leavesub[1 ref] K/REFC,1
671+
EOT_EOT
672+
# 1 <;> nextstate(main 997 (eval 15):1) v
673+
# 2 <$> gvsv(*a) s
674+
# 3 <|> or(other->4) sK/1
675+
# 4 <$> gvsv(*b) s
676+
# 5 <|> and(other->6) vK/1
677+
# 6 <0> stub v
678+
# 7 <;> nextstate(main 3 (eval 3):1) v
679+
# 8 <$> const(IV 1) s
680+
# 9 <1> leavesub[1 ref] K/REFC,1
681+
EONT_EONT
682+
683+
pass("rpeep - unless ($a && $b)");
684+
685+
checkOptree ( name => 'unless ($a && $b) { } return 1',
686+
code => 'unless ($a && $b) { } return 1',
687+
bcopts => '-exec',
688+
expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
689+
# 1 <;> nextstate(main 997 (eval 15):1) v
690+
# 2 <#> gvsv[*a] s
691+
# 3 <|> and(other->4) sK/1
692+
# 4 <#> gvsv[*b] s
693+
# 5 <|> or(other->6) vK/1
694+
# 6 <0> stub v
695+
# 7 <;> nextstate(main 997 (eval 15):1) v
696+
# 8 <$> const[IV 1] s
697+
# 9 <1> leavesub[1 ref] K/REFC,1
698+
EOT_EOT
699+
# 1 <;> nextstate(main 997 (eval 15):1) v
700+
# 2 <$> gvsv(*a) s
701+
# 3 <|> and(other->4) sK/1
702+
# 4 <$> gvsv(*b) s
703+
# 5 <|> or(other->6) vK/1
704+
# 6 <0> stub v
705+
# 7 <;> nextstate(main 3 (eval 3):1) v
706+
# 8 <$> const(IV 1) s
707+
# 9 <1> leavesub[1 ref] K/REFC,1
708+
EONT_EONT
709+
656710
__END__
657711
658712
#######################################################################

0 commit comments

Comments
 (0)