X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FEval-WithLexicals.git;a=blobdiff_plain;f=t%2Fsimple.t;h=e8157ba78d639cf843c4ee53fbdef992d0888e10;hp=e4316f3c1c3e145c678375567942967f83023b12;hb=2b376bd0dc102f9019e007d889a844f94b3a87b9;hpb=6f914695d80ef46fe45ac39758eb956f0f5389a6 diff --git a/t/simple.t b/t/simple.t index e4316f3..e8157ba 100644 --- a/t/simple.t +++ b/t/simple.t @@ -27,4 +27,24 @@ is_deeply( 'Inner scope plus lexical ok' ); +is_deeply( + [ $eval->eval('{ my $y = 0 }; $x') ], + [ 1 ], + 'Inner scope and other lexical ok' +); + +is_deeply( + [ keys %{$eval->lexicals} ], + [ '$x' ], + 'No capture of invisible $y' +); + +$eval->eval('my $y = sub { $_[0]+1 }'); + +is_deeply( + [ $eval->eval('$y->(2)') ], + [ 3 ], + 'Sub created ok' +); + done_testing;