Re: perl@16433
[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';
11 @INC = '.';
12 push @INC, '../lib';
13 }
14 require Config; import Config;
15 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
16 print "1..0 # Skip: Storable was not built\n";
17 exit 0;
18 }
19 # require 'lib/st-dump.pl';
20}
21
22use strict;
23
24BEGIN {
25 die "Oi! No! Don't change this test so that Carp is used before Storable"
26 if defined &Carp::carp;
27}
28use Storable qw(freeze thaw);
29
30print "1..2\n";
31
32for my $test (1,2) {
33 eval {thaw "\xFF\xFF"};
34 if ($@ =~ /Storable binary image v127.255 more recent than I am \(v2\.\d+\)/)
35 {
36 print "ok $test\n";
37 } else {
38 chomp $@;
39 print "not ok $test # Expected a meaningful croak. Got '$@'\n";
40 }
41}