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 | # |
10 | # $Log: utf8.t,v $ |
11 | # Revision 1.0.1.2 2000/09/28 21:44:17 ram |
12 | # patch2: fixed stupid typo |
13 | # |
14 | # Revision 1.0.1.1 2000/09/17 16:48:12 ram |
15 | # patch1: created. |
16 | # |
17 | # |
18 | |
19 | sub BEGIN { |
20 | if ($] < 5.006) { |
21 | print "1..0 # Skip: no utf8 support\n"; |
22 | exit 0; |
23 | } |
0c384302 |
24 | if ($ENV{PERL_CORE}){ |
25 | chdir('t') if -d 't'; |
7dadce44 |
26 | @INC = ('.', '../lib', '../ext/Storable/t'); |
372cb964 |
27 | } else { |
28 | unshift @INC, 't'; |
0c384302 |
29 | } |
dd19458b |
30 | require Config; import Config; |
0c384302 |
31 | if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) { |
dd19458b |
32 | print "1..0 # Skip: Storable was not built\n"; |
33 | exit 0; |
34 | } |
372cb964 |
35 | require 'st-dump.pl'; |
dd19458b |
36 | } |
37 | |
e16e2ff8 |
38 | use strict; |
dd19458b |
39 | sub ok; |
40 | |
41 | use Storable qw(thaw freeze); |
42 | |
e16e2ff8 |
43 | print "1..3\n"; |
dd19458b |
44 | |
e16e2ff8 |
45 | my $x = chr(1234); |
dd19458b |
46 | ok 1, $x eq ${thaw freeze \$x}; |
47 | |
e16e2ff8 |
48 | # Long scalar |
49 | $x = join '', map {chr $_} (0..1023); |
50 | ok 2, $x eq ${thaw freeze \$x}; |
51 | |
52 | # Char in the range 127-255 (probably) in utf8 |
53 | $x = chr (175) . chr (256); |
54 | chop $x; |
55 | ok 3, $x eq ${thaw freeze \$x}; |