Re: [ID 20020601.005] Storable: STORABLE_freeze mechanism leaks memory (unfreed SVs)
[p5sagit/p5-mst-13.2.git] / ext / Storable / t / croak.t
CommitLineData
530b72ba 1#!./perl -w
2
3# Please keep this test this simple. (ie just one test.)
4# There's some sort of not-croaking properly problem in Storable when built
5# with 5.005_03. This test shows it up, whereas malice.t does not.
6# In particular, don't use Test; as this covers up the problem.
7
8sub BEGIN {
9 if ($ENV{PERL_CORE}){
10 chdir('t') if -d 't';
372cb964 11 @INC = ('.', '../lib');
530b72ba 12 }
13 require Config; import Config;
14 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
15 print "1..0 # Skip: Storable was not built\n";
16 exit 0;
17 }
530b72ba 18}
19
20use strict;
21
22BEGIN {
23 die "Oi! No! Don't change this test so that Carp is used before Storable"
24 if defined &Carp::carp;
25}
26use Storable qw(freeze thaw);
27
28print "1..2\n";
29
30for my $test (1,2) {
31 eval {thaw "\xFF\xFF"};
32 if ($@ =~ /Storable binary image v127.255 more recent than I am \(v2\.\d+\)/)
33 {
34 print "ok $test\n";
35 } else {
36 chomp $@;
37 print "not ok $test # Expected a meaningful croak. Got '$@'\n";
38 }
39}