This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a problem with jump-tries, add (?FAIL) pattern.
[perl5.git] / t / op / stash.t
index 7441775..4d8bc7c 100644 (file)
@@ -5,9 +5,9 @@ BEGIN {
     @INC = qw(../lib);
 }
 
-require "./test.pl";
+BEGIN { require "./test.pl"; }
 
-plan( tests => 8 );
+plan( tests => 13 );
 
 # Used to segfault (bug #15479)
 fresh_perl_is(
@@ -36,3 +36,28 @@ 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) );