3 # $Id: overload.t,v 1.0.1.1 2001/02/17 12:27:22 ram Exp $
5 # Copyright (c) 1995-2000, Raphael Manfredi
7 # You may redistribute only under the same terms as Perl 5, as specified
8 # in the README file that comes with the distribution.
10 # $Log: overload.t,v $
11 # Revision 1.0.1.1 2001/02/17 12:27:22 ram
12 # patch8: added test for structures with indirect ref to overloaded
14 # Revision 1.0 2000/09/01 19:40:42 ram
15 # Baseline for first official release.
21 @INC = ('.', '../lib', '../ext/Storable/t');
25 require Config; import Config;
26 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
27 print "1..0 # Skip: Storable was not built\n";
35 use Storable qw(freeze thaw);
42 '""' => sub { $_[0][0] };
46 $a = bless [77], OVERLOADED;
49 ok 1, ref $b eq 'OVERLOADED';
53 ok 3, ref $c eq 'REF';
54 ok 4, ref $$c eq 'OVERLOADED';
57 $d = thaw freeze [$a, $a];
58 ok 6, "$d->[0]" eq "77";
60 ok 7, "$d->[1]" eq "78";
65 my $self = bless {}, shift;
67 $self->{over} = $over;
75 '""' => sub { ref $_[0] };
82 my $self = bless {}, shift;
83 my $ref = REF_TO_OVER->make($self);
93 ok 8, ref $b eq 'OVER';
95 ok 10, ref $b->{ref} eq 'REF_TO_OVER';
96 ok 11, "$b->{ref}->{over}" eq "$b";
97 ok 12, $b + $b == 314;