Add a test that "eval" does not create additional reference to ouside variables.
[p5sagit/p5-mst-13.2.git] / t / op / stash.t
index 578f937..8ea829b 100644 (file)
@@ -25,14 +25,17 @@ fresh_perl_is(
     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) );
+{
+    no warnings 'deprecated';
+    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 %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) );
+    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;
@@ -53,19 +56,20 @@ package main;
 
 # now tests in eval
 
-ok( !eval  { defined %achtfaden:: },   'works in eval{}' );
-ok( !eval q{ defined %schoenmaker:: }, 'works in eval("")' );
+ok( !eval  { no warnings 'deprecated'; defined %achtfaden:: },   'works in eval{}' );
+ok( !eval q{ no warnings 'deprecated'; defined %schoenmaker:: }, 'works in eval("")' );
 
 # now tests with strictures
 
 {
     use strict;
+    no warnings 'deprecated';
     ok( !defined %pig::, q(referencing a non-existent stash doesn't produce stricture errors) );
     ok( !exists $pig::{bodine}, q(referencing a non-existent stash element doesn't produce stricture errors) );
 }
 
 SKIP: {
-    eval { require B; 1 } or skip "no B", 12;
+    eval { require B; 1 } or skip "no B", 18;
 
     *b = \&B::svref_2object;
     my $CVf_ANON = B::CVf_ANON();
@@ -109,9 +113,8 @@ SKIP: {
     TODO: {
         local $TODO = "anon CVs not accounted for yet";
 
-        my @results = split "\n", runperl
+        my @results = split "\n", runperl(
             switches    => [ "-MB", "-l" ],
-            stderr      => 1,
             prog        => q{
                 my $sub = do {
                     package four;
@@ -138,7 +141,9 @@ SKIP: {
                 print $st eq q/__ANON__/ ? q/ok/ : q/not ok/;
 
                 print q/done/;
-            };
+            },
+            ($^O eq 'VMS') ? (stderr => 1) : ()
+        );
 
         ok( @results == 5 && $results[4] eq "done",
             "anon CVs in undefed stash don't segfault" )