Blame t/croak.t

Packit 14c646
#!./perl -w
Packit 14c646
Packit 14c646
# Please keep this test this simple. (ie just one test.)
Packit 14c646
# There's some sort of not-croaking properly problem in Storable when built
Packit 14c646
# with 5.005_03. This test shows it up, whereas malice.t does not.
Packit 14c646
# In particular, don't use Test; as this covers up the problem.
Packit 14c646
Packit 14c646
sub BEGIN {
Packit 14c646
    if ($ENV{PERL_CORE}) {
Packit 14c646
	require Config; import Config;
Packit 14c646
	%Config=%Config if 0; # cease -w
Packit 14c646
	if ($Config{'extensions'} !~ /\bStorable\b/) {
Packit 14c646
	    print "1..0 # Skip: Storable was not built\n";
Packit 14c646
	    exit 0;
Packit 14c646
	}
Packit 14c646
    }
Packit 14c646
}
Packit 14c646
Packit 14c646
use strict;
Packit 14c646
Packit 14c646
BEGIN {
Packit 14c646
  die "Oi! No! Don't change this test so that Carp is used before Storable"
Packit 14c646
    if defined &Carp::carp;
Packit 14c646
}
Packit 14c646
use Storable qw(freeze thaw);
Packit 14c646
Packit 14c646
print "1..2\n";
Packit 14c646
Packit 14c646
for my $test (1,2) {
Packit 14c646
  eval {thaw "\xFF\xFF"};
Packit 14c646
  if ($@ =~ /Storable binary image v127.255 more recent than I am \(v2\.\d+\)/)
Packit 14c646
    {
Packit 14c646
      print "ok $test\n";
Packit 14c646
    } else {
Packit 14c646
      chomp $@;
Packit 14c646
      print "not ok $test # Expected a meaningful croak. Got '$@'\n";
Packit 14c646
    }
Packit 14c646
}