Commit | Line | Data |
---|---|---|
e16e2ff8 | 1 | #!./perl -w |
dd19458b | 2 | # |
e16e2ff8 | 3 | # Copyright (c) 1995-2000, Raphael Manfredi |
4 | # | |
5 | # You may redistribute only under the same terms as Perl 5, as specified | |
6 | # in the README file that comes with the distribution. | |
dd19458b | 7 | # |
dd19458b | 8 | |
9 | sub BEGIN { | |
10 | if ($] < 5.006) { | |
11 | print "1..0 # Skip: no utf8 support\n"; | |
12 | exit 0; | |
13 | } | |
0c384302 | 14 | if ($ENV{PERL_CORE}){ |
15 | chdir('t') if -d 't'; | |
7dadce44 | 16 | @INC = ('.', '../lib', '../ext/Storable/t'); |
372cb964 | 17 | } else { |
18 | unshift @INC, 't'; | |
0c384302 | 19 | } |
dd19458b | 20 | require Config; import Config; |
0c384302 | 21 | if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) { |
dd19458b | 22 | print "1..0 # Skip: Storable was not built\n"; |
23 | exit 0; | |
24 | } | |
372cb964 | 25 | require 'st-dump.pl'; |
dd19458b | 26 | } |
27 | ||
e16e2ff8 | 28 | use strict; |
dd19458b | 29 | sub ok; |
30 | ||
31 | use Storable qw(thaw freeze); | |
32 | ||
e16e2ff8 | 33 | print "1..3\n"; |
dd19458b | 34 | |
e16e2ff8 | 35 | my $x = chr(1234); |
dd19458b | 36 | ok 1, $x eq ${thaw freeze \$x}; |
37 | ||
e16e2ff8 | 38 | # Long scalar |
39 | $x = join '', map {chr $_} (0..1023); | |
40 | ok 2, $x eq ${thaw freeze \$x}; | |
41 | ||
42 | # Char in the range 127-255 (probably) in utf8 | |
43 | $x = chr (175) . chr (256); | |
44 | chop $x; | |
45 | ok 3, $x eq ${thaw freeze \$x}; |