From: Vincent Pit Date: Fri, 14 Sep 2012 12:25:43 +0000 (+0200) Subject: Test 'return from do' in special cases X-Git-Tag: v0.20~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=3852d1e712b2e4f5c1ab14efe303ce7d7a95464d;p=perl%2Fmodules%2FScope-Upper.git Test 'return from do' in special cases --- diff --git a/t/58-yield-misc.t b/t/58-yield-misc.t index 16556e8..ca6fda0 100644 --- a/t/58-yield-misc.t +++ b/t/58-yield-misc.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4 * 3 + 3; +use Test::More tests => 4 * 3 + 1 + 3; use lib 't/lib'; use VPIT::TestHelpers; @@ -75,6 +75,34 @@ sub guard { VPIT::TestHelpers::Guard->new(sub { ++$destroyed }) } is $destroyed, 1, "$desc: destroyed 2"; } +# Test 'return from do' in special cases + +{ + no warnings 'void'; + my @res = (1, do { + my $cxt = HERE; + my $thing = (777, do { + my @stuff = (888, do { + yield 2, 3 => $cxt; + map { my $x; $_ x 3 } qw + }, 999); + if (@stuff) { + my $y; + ++$y; + 'YYY'; + } else { + die 'not reached'; + } + }); + if (1) { + my $z; + 'ZZZ'; + } + 'VVV' + }, 4); + is "@res", '1 2 3 4', 'yield() found the op to return to'; +} + # Test leave {