3 # This test harness will (eventually) test the "tie" functionality
4 # without the need for a *DBM* implementation.
6 # Currently it only tests the untie warning
9 unshift @INC, "../lib";
10 $ENV{PERL5LIB} = "../lib";
14 # catch warnings into fatal errors
15 $SIG{__WARN__} = sub { die "WARNING: @_" } ;
18 @prgs = split "\n########\n", <DATA>;
19 print "1..", scalar @prgs, "\n";
22 my($prog,$expected) = split(/\nEXPECT\n/, $_);
27 $expected =~ s/\n+$//;
28 if ( $status or $results and $results !~ /^WARNING: $expected/){
29 print STDERR "STATUS: $status\n";
30 print STDERR "PROG: $prog\n";
31 print STDERR "EXPECTED:\n$expected\n";
32 print STDERR "GOT:\n$results\n";
35 print "ok ", ++$i, "\n";
40 # standard behaviour, without any extra references
47 # standard behaviour, with 1 extra reference
49 $a = tie %h, Tie::StdHash;
54 # standard behaviour, with 1 extra reference via tied
62 # standard behaviour, with 1 extra reference which is destroyed
64 $a = tie %h, Tie::StdHash;
70 # standard behaviour, with 1 extra reference via tied which is destroyed
79 # strict behaviour, without any extra references
88 # strict behaviour, with 1 extra references generating an error
92 $a = tie %h, Tie::StdHash;
95 untie attempted while 1 inner references still exist
98 # strict behaviour, with 1 extra references via tied generating an error
102 tie %h, Tie::StdHash;
106 untie attempted while 1 inner references still exist
109 # strict behaviour, with 1 extra references which are destroyed
113 $a = tie %h, Tie::StdHash;
119 # strict behaviour, with extra 1 references via tied which are destroyed
123 tie %h, Tie::StdHash;
130 # strict error behaviour, with 2 extra references
134 $a = tie %h, Tie::StdHash;
138 untie attempted while 2 inner references still exist
141 # strict behaviour, check scope of strictness.
145 $A = tie %H, Tie::StdHash;
151 tie %h, Tie::StdHash;
158 # verify no leak when underlying object is selfsame tied variable
160 sub Self::TIEHASH { bless $_[1], $_[0] }
161 sub Self::DESTROY { $b = $_[0] + 0; }
165 tie %b5, 'Self', \%b5;
170 # Interaction of tie and vec
174 tie $a,Tie::StdScalar or die;