add test to check non-capture of out of scope lexical
[p5sagit/Eval-WithLexicals.git] / t / simple.t
index e4316f3..d529ac8 100644 (file)
@@ -27,4 +27,16 @@ 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'
+);
+
 done_testing;