Add a test that "eval" does not create additional reference to ouside variables.
[p5sagit/p5-mst-13.2.git] / t / op / lex.t
index 3f00248..0789077 100644 (file)
@@ -1,9 +1,10 @@
-#!perl -w
+#!perl
 use strict;
+use warnings;
 
 require './test.pl';
 
-plan(tests => 2);
+plan(tests => 4);
 
 {
     no warnings 'deprecated';
@@ -20,3 +21,27 @@ $yow
 }
 
 curr_test(3);
+
+
+{
+    my %foo = (aap => "monkey");
+    my $foo = '';
+    is("@{[$foo{'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript');
+    is("@{[$foo {'aap'}]}", 'monkey', 'interpolation of hash lookup with space between lexical variable and subscript - test for [perl #70091]');
+
+# Original bug report [perl #70091]
+#  #!perl
+#  use warnings;
+#  my %foo;
+#  my $foo = '';
+#  (my $tmp = $foo) =~ s/^/$foo {$0}/e;
+#  __END__
+#
+#  This program causes a segfault with 5.10.0 and 5.10.1.
+#
+#  The space between '$foo' and '{' is essential, which is why piping
+#  it through perl -MO=Deparse "fixes" it.
+#
+
+}
+