This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document string- and number-specific bitops in perlop
[perl5.git] / dist / Storable / t / croak.t
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
8 sub BEGIN {
9     if ($ENV{PERL_CORE}) {
10         require Config; import Config;
11         %Config=%Config if 0; # cease -w
12         if ($Config{'extensions'} !~ /\bStorable\b/) {
13             print "1..0 # Skip: Storable was not built\n";
14             exit 0;
15         }
16     }
17 }
18
19 use strict;
20
21 BEGIN {
22   die "Oi! No! Don't change this test so that Carp is used before Storable"
23     if defined &Carp::carp;
24 }
25 use Storable qw(freeze thaw);
26
27 print "1..2\n";
28
29 for my $test (1,2) {
30   eval {thaw "\xFF\xFF"};
31   if ($@ =~ /Storable binary image v127.255 more recent than I am \(v2\.\d+\)/)
32     {
33       print "ok $test\n";
34     } else {
35       chomp $@;
36       print "not ok $test # Expected a meaningful croak. Got '$@'\n";
37     }
38 }