xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/ext/Storable/t/utf8.t (revision 0:68f95e015346)
1#!./perl -w
2#
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.
7#
8
9sub BEGIN {
10    if ($] < 5.006) {
11	print "1..0 # Skip: no utf8 support\n";
12	exit 0;
13    }
14    if ($ENV{PERL_CORE}){
15	chdir('t') if -d 't';
16	@INC = ('.', '../lib', '../ext/Storable/t');
17    } else {
18	unshift @INC, 't';
19    }
20    require Config; import Config;
21    if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
22        print "1..0 # Skip: Storable was not built\n";
23        exit 0;
24    }
25    require 'st-dump.pl';
26}
27
28use strict;
29sub ok;
30
31use Storable qw(thaw freeze);
32
33print "1..3\n";
34
35my $x = chr(1234);
36ok 1, $x eq ${thaw freeze \$x};
37
38# Long scalar
39$x = join '', map {chr $_} (0..1023);
40ok 2, $x eq ${thaw freeze \$x};
41
42# Char in the range 127-255 (probably) in utf8
43$x = chr (175) . chr (256);
44chop $x;
45ok 3, $x eq ${thaw freeze \$x};
46