This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re-attempt to clear the hash in S_hfreeentries if anything adds to it.
[perl5.git] / t / op / stash.t
CommitLineData
6b78add2
RGS
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = qw(../lib);
6}
7
8require "./test.pl";
9
adc51b97 10plan( tests => 8 );
6b78add2
RGS
11
12# Used to segfault (bug #15479)
13fresh_perl_is(
14 '%:: = ""',
15 'Odd number of elements in hash assignment at - line 1.',
16 { switches => [ '-w' ] },
17 'delete $::{STDERR} and print a warning',
18);
b862623f
RGS
19
20# Used to segfault
21fresh_perl_is(
22 'BEGIN { $::{"X::"} = 2 }',
23 '',
24 { switches => [ '-w' ] },
25 q(Insert a non-GV in a stash, under warnings 'once'),
26);
adc51b97
RGS
27
28ok( !defined %oedipa::maas::, q(stashes aren't defined if not used) );
29ok( !defined %{"oedipa::maas::"}, q(- work with hard refs too) );
30
31ok( defined %tyrone::slothrop::, q(stashes are defined if seen at compile time) );
32ok( defined %{"tyrone::slothrop::"}, q(- work with hard refs too) );
33
34ok( defined %bongo::shaftsbury::, q(stashes are defined if a var is seen at compile time) );
35ok( defined %{"bongo::shaftsbury::"}, q(- work with hard refs too) );
36
37package tyrone::slothrop;
38$bongo::shaftsbury::scalar = 1;