Fix bug whereby length on a tied scalar that returned a UTF-8 value
[p5sagit/p5-mst-13.2.git] / t / uni / chr.t
1
2 BEGIN {
3     if ($ENV{'PERL_CORE'}){
4         chdir 't';
5         @INC = '../lib';
6     }
7     require Config; import Config;
8     if ($Config{'extensions'} !~ /\bEncode\b/) {
9       print "1..0 # Skip: Encode was not built\n";
10       exit 0;
11     }
12     if (ord("A") == 193) {
13         print "1..0 # Skip: EBCDIC\n";
14         exit 0;
15     }
16     unless (PerlIO::Layer->find('perlio')){
17         print "1..0 # Skip: PerlIO required\n";
18         exit 0;
19     }
20     if ($ENV{PERL_CORE_MINITEST}) {
21         print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
22         exit 0;
23     }
24     $| = 1;
25 }
26
27 use strict;
28 use Test::More tests => 6;
29 use Encode;
30
31 use encoding 'johab';
32
33 ok(chr(0x7f) eq "\x7f");
34 ok(chr(0x80) eq "\x80");
35 ok(chr(0xff) eq "\xff");
36
37 for my $i (127, 128, 255) {
38     ok(chr($i) eq pack('C', $i));
39 }
40
41 __END__