X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Feval.t;h=6aef5b88e57daec664472df1616a6df0246de94d;hb=69938bbac29d5bcb76b80f6eccb27c5ff84cee37;hp=a6d78c4dbd3c3c290fb3d5c4c82a60c62d5d3eb4;hpb=77d32bb7b5e051854298049d5aa8bdccf2df099a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/eval.t b/t/op/eval.t index a6d78c4..6aef5b8 100755 --- a/t/op/eval.t +++ b/t/op/eval.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..88\n"; +print "1..91\n"; eval 'print "ok 1\n";'; @@ -422,3 +422,19 @@ $test++; sub Foo {} print Foo(eval {}); print "ok ",$test++," - #20798 (used to dump core)\n"; + +# check for context in string eval +{ + my(@r,$r,$c); + sub context { defined(wantarray) ? (wantarray ? ($c='A') : ($c='S')) : ($c='V') } + + my $code = q{ context() }; + @r = qw( a b ); + $r = 'ab'; + @r = eval $code; + print "@r$c" eq 'AA' ? "ok " : "# '@r$c' ne 'AA'\nnot ok ", $test++, "\n"; + $r = eval $code; + print "$r$c" eq 'SS' ? "ok " : "# '$r$c' ne 'SS'\nnot ok ", $test++, "\n"; + eval $code; + print $c eq 'V' ? "ok " : "# '$c' ne 'V'\nnot ok ", $test++, "\n"; +}