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