BEGIN { require "./test.pl"; }
-plan( tests => 57 );
+plan( tests => 50 );
# Used to segfault (bug #15479)
fresh_perl_like(
- '%:: = ""',
+ 'delete $::{STDERR}; my %a = ""',
qr/Odd number of elements in hash assignment at - line 1\./,
{ switches => [ '-w' ] },
'delete $::{STDERR} and print a warning',
);
}
-{
- no warnings 'deprecated';
- ok( defined %oedipa::maas::, q(stashes happen to be 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;
{
local $ENV{PERL_DESTRUCT_LEVEL} = 2;
fresh_perl_is(
- 'package A; sub a { // }; %::=""',
+ 'package A::B; sub a { // }; %A::=""',
'',
+ {},
+ );
+ # Variant of the above which creates an object that persists until global
+ # destruction, and triggers an assertion failure prior to change
+ # a420522db95b7762
+ fresh_perl_is(
+ 'use Exporter; package A; sub a { // }; delete $::{$_} for keys %::',
'',
+ {},
);
}
-# now tests 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) );
}
sub foo{};
1
', 'no crashing or errors when clobbering the current package';
+
+# Bareword lookup should not vivify stashes
+is runperl(
+ prog =>
+ 'sub foo { print shift, qq-\n- } SUPER::foo bar if 0; foo SUPER',
+ stderr => 1,
+ ),
+ "SUPER\n",
+ 'bareword lookup does not vivify stashes';