Storable stand alone tests
[p5sagit/p5-mst-13.2.git] / ext / Storable / t / utf8.t
1 #!./perl -w
2
3 # $Id: utf8.t,v 1.0.1.2 2000/09/28 21:44:17 ram Exp $
4 #
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.
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     }
24     if ($ENV{PERL_CORE}){
25         chdir('t') if -d 't';
26         @INC = ('.', '../lib', '../t/lib');
27     } else {
28         unshift @INC, 't';
29     }
30     require Config; import Config;
31     if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
32         print "1..0 # Skip: Storable was not built\n";
33         exit 0;
34     }
35     require 'st-dump.pl';
36 }
37
38 use strict;
39 sub ok;
40
41 use Storable qw(thaw freeze);
42
43 print "1..3\n";
44
45 my $x = chr(1234);
46 ok 1, $x eq ${thaw freeze \$x};
47
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};