X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fautovivification.git;a=blobdiff_plain;f=t%2F43-peep.t;h=88d2afd7082c8d77ddb33e4b7ebb21570b6b1512;hp=a91b5f4632b6abc237eba4ff86ef610912d9a33b;hb=7112826bde64279aa69215293b5c94cc584d7388;hpb=c2237219516974eb5eba3b1a71a4b1e49d72c4e0 diff --git a/t/43-peep.t b/t/43-peep.t index a91b5f4..88d2afd 100644 --- a/t/43-peep.t +++ b/t/43-peep.t @@ -8,7 +8,7 @@ use Test::More; use lib 't/lib'; use VPIT::TestHelpers; -plan tests => 11 + 1 * 2 + 5 * 3; +plan tests => 11 + 5 * 2 + 5 * 3; { my $desc = 'peephole optimization of conditionals'; @@ -113,8 +113,9 @@ plan tests => 11 + 1 * 2 + 5 * 3; } { + my $base_desc = 'peephole optimization of infinite'; my %infinite_tests = ( - 'peephole optimization of infinite for loops (RT #64435)' => <<' TESTCASE', + "$base_desc for loops (RT #64435)" => <<' TESTCASE', no autovivification; my $ret = 0; for (;;) { @@ -123,6 +124,36 @@ plan tests => 11 + 1 * 2 + 5 * 3; } exit $ret; TESTCASE + "$base_desc while loops" => <<' TESTCASE', + no autovivification; + my $ret = 0; + while (1) { + ++$ret; + exit $ret; + } + exit $ret; + TESTCASE + "$base_desc postfix while (RT #99458)" => <<' TESTCASE', + no autovivification; + my $ret = 0; + ++$ret && exit $ret while 1; + exit $ret; + TESTCASE + "$base_desc until loops" => <<' TESTCASE', + no autovivification; + my $ret = 0; + until (0) { + ++$ret; + exit $ret; + } + exit $ret; + TESTCASE + "$base_desc postfix until" => <<' TESTCASE', + no autovivification; + my $ret = 0; + ++$ret && exit $ret until 0; + exit $ret; + TESTCASE ); for my $desc (keys %infinite_tests) {