X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F58-yield-misc.t;h=ca6fda079334e27586e939bab85fb4259c7c39ac;hb=3852d1e712b2e4f5c1ab14efe303ce7d7a95464d;hp=16556e850fc8b7e7670d058584594022db1ae670;hpb=9f4e270a50090f065bbeebbcac06fd6b4297e45c;p=perl%2Fmodules%2FScope-Upper.git 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 {