rename byte:: to bytes::
[p5sagit/p5-mst-13.2.git] / t / lib / charnames.t
CommitLineData
423cee85 1#!./perl
2
3BEGIN {
4 unless(grep /blib/, @INC) {
5 chdir 't' if -d 't';
6 unshift @INC, '../lib' if -d '../lib';
7 }
8}
9
10$| = 1;
11print "1..5\n";
12
13use charnames ':full';
14
f70c35af 15print "not " unless "Here\N{EXCLAMATION MARK}?" eq "Here\041?";
423cee85 16print "ok 1\n";
17
c82a54e6 18{
8058d7ab 19 use bytes; # UTEST can switch utf8 on
c82a54e6 20
21 print "# \$res=$res \$\@='$@'\nnot "
22 if $res = eval <<'EOE'
423cee85 23use charnames ":full";
4a2d328f 24"Here: \N{CYRILLIC SMALL LETTER BE}!";
423cee85 251
26EOE
c82a54e6 27 or $@ !~ /above 0xFF/;
28 print "ok 2\n";
29 # print "# \$res=$res \$\@='$@'\n";
423cee85 30
c82a54e6 31 print "# \$res=$res \$\@='$@'\nnot "
32 if $res = eval <<'EOE'
423cee85 33use charnames 'cyrillic';
4a2d328f 34"Here: \N{Be}!";
423cee85 351
36EOE
c82a54e6 37 or $@ !~ /CYRILLIC CAPITAL LETTER BE.*above 0xFF/;
38 print "ok 3\n";
39}
423cee85 40
41# If octal representation of unicode char is \0xyzt, then the utf8 is \3xy\2zt
42$encoded_be = "\320\261";
43$encoded_alpha = "\316\261";
44$encoded_bet = "\327\221";
45{
46 use charnames ':full';
47 use utf8;
48
4a2d328f 49 print "not " unless "\N{CYRILLIC SMALL LETTER BE}" eq $encoded_be;
423cee85 50 print "ok 4\n";
51
52 use charnames qw(cyrillic greek :short);
53
4a2d328f 54 print "not " unless "\N{be},\N{alpha},\N{hebrew:bet}"
423cee85 55 eq "$encoded_be,$encoded_alpha,$encoded_bet";
56 print "ok 5\n";
57}