Change 30191 by [EMAIL PROTECTED] on 2007/02/10 17:19:08

        Integrate the tests from:
        [ 26370]
        Don't autovivify stashes as soon as the lexer sees them.
        This makes defined %foo::bar:: work again.
        Add tests for it, remove note in perldelta about having broken it.
        
        [ 26548]
        Add a test for change 26547. (We no longer expect to see errors about
        unbalanced string table reference counts.)
        
        [ 26574]
        Since we no longer autovivify stashes (change #26370), we need
        to turn off strict-refs on them, or we'll have a stricture
        error the first time we'd try to access them (when they'll be
        actually autovivified).
        
        [ 26867]
        defined %foo::bar:: wasn't working like it used to do in evals
        (and, consequently, when require'ing modules.)

Affected files ...

... //depot/maint-5.8/perl/t/op/stash.t#3 edit

Differences ...

==== //depot/maint-5.8/perl/t/op/stash.t#3 (text) ====
Index: perl/t/op/stash.t
--- perl/t/op/stash.t#2~19653~  2003-06-01 00:35:55.000000000 -0700
+++ perl/t/op/stash.t   2007-02-10 09:19:08.000000000 -0800
@@ -7,7 +7,7 @@
 
 require "./test.pl";
 
-plan( tests => 2 );
+plan( tests => 11 );
 
 # Used to segfault (bug #15479)
 fresh_perl_is(
@@ -24,3 +24,37 @@
     { 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 %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;
+
+package main;
+
+# Used to warn
+# Unbalanced string table refcount: (1) for "A::" during global destruction.
+# for ithreads.
+{
+    local $ENV{PERL_DESTRUCT_LEVEL} = 2;
+    fresh_perl_is(
+                 'package A; sub a { // }; %::=""',
+                 '',
+                 '',
+                 );
+}
+
+# now tests in eval
+
+ok( !eval  { defined %achtfaden:: },   'works in eval{}' );
+ok( !eval q{ defined %schoenmaker:: }, 'works in eval("")' );
+
+# now tests with strictures
+
+use strict;
+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) );
End of Patch.

Reply via email to