Commit | Line | Data |
---|---|---|
6b78add2 RGS |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = qw(../lib); | |
6 | } | |
7 | ||
768fd157 | 8 | BEGIN { require "./test.pl"; } |
6b78add2 | 9 | |
d6069db2 | 10 | plan( tests => 13 ); |
6b78add2 RGS |
11 | |
12 | # Used to segfault (bug #15479) | |
13 | fresh_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 | |
21 | fresh_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 | |
28 | ok( !defined %oedipa::maas::, q(stashes aren't defined if not used) ); | |
29 | ok( !defined %{"oedipa::maas::"}, q(- work with hard refs too) ); | |
30 | ||
31 | ok( defined %tyrone::slothrop::, q(stashes are defined if seen at compile time) ); | |
32 | ok( defined %{"tyrone::slothrop::"}, q(- work with hard refs too) ); | |
33 | ||
34 | ok( defined %bongo::shaftsbury::, q(stashes are defined if a var is seen at compile time) ); | |
35 | ok( defined %{"bongo::shaftsbury::"}, q(- work with hard refs too) ); | |
36 | ||
37 | package tyrone::slothrop; | |
38 | $bongo::shaftsbury::scalar = 1; | |
aec56d99 NC |
39 | |
40 | package main; | |
41 | ||
42 | # Used to warn | |
43 | # Unbalanced string table refcount: (1) for "A::" during global destruction. | |
44 | # for ithreads. | |
45 | { | |
46 | local $ENV{PERL_DESTRUCT_LEVEL} = 2; | |
47 | fresh_perl_is( | |
48 | 'package A; sub a { // }; %::=""', | |
49 | '', | |
50 | '', | |
51 | ); | |
52 | } | |
ce10b5d1 | 53 | |
d6069db2 RGS |
54 | # now tests in eval |
55 | ||
56 | ok( !eval { defined %achtfaden:: }, 'works in eval{}' ); | |
57 | ok( !eval q{ defined %schoenmaker:: }, 'works in eval("")' ); | |
58 | ||
ce10b5d1 RGS |
59 | # now tests with strictures |
60 | ||
61 | use strict; | |
62 | ok( !defined %pig::, q(referencing a non-existent stash doesn't produce stricture errors) ); | |
63 | ok( !exists $pig::{bodine}, q(referencing a non-existent stash element doesn't produce stricture errors) ); |