Regression tests for proxy subroutine glob assignment.
[p5sagit/p5-mst-13.2.git] / t / op / stash.t
index c8fe0ae..7441775 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
 
 require "./test.pl";
 
-plan( tests => 1 );
+plan( tests => 8 );
 
 # Used to segfault (bug #15479)
 fresh_perl_is(
@@ -16,3 +16,23 @@ fresh_perl_is(
     { switches => [ '-w' ] },
     'delete $::{STDERR} and print a warning',
 );
+
+# Used to segfault
+fresh_perl_is(
+    'BEGIN { $::{"X::"} = 2 }',
+    '',
+    { switches => [ '-w' ] },
+    q(Insert a non-GV in a stash, under warnings 'once'),
+);
+
+ok( !defined %oedipa::maas::, q(stashes aren't defined if not used) );
+ok( !defined %{"oedipa::maas::"}, q(- work with hard refs too) );
+
+ok( defined %tyrone::slothrop::, q(stashes are defined if seen at compile time) );
+ok( defined %{"tyrone::slothrop::"}, q(- work with hard refs too) );
+
+ok( defined %bongo::shaftsbury::, q(stashes are defined if a var is seen at compile time) );
+ok( defined %{"bongo::shaftsbury::"}, q(- work with hard refs too) );
+
+package tyrone::slothrop;
+$bongo::shaftsbury::scalar = 1;