6 unless(grep /blib/, @INC) {
10 $SIG{__WARN__} = sub { push @WARN, @_ };
17 use charnames ':full';
19 print "not " unless "Here\N{EXCLAMATION MARK}?" eq "Here!?";
23 use bytes; # TEST -utf8 can switch utf8 on
25 print "# \$res=$res \$\@='$@'\nnot "
26 if $res = eval <<'EOE'
27 use charnames ":full";
28 "Here: \N{CYRILLIC SMALL LETTER BE}!";
31 or $@ !~ /above 0xFF/;
33 # print "# \$res=$res \$\@='$@'\n";
35 print "# \$res=$res \$\@='$@'\nnot "
36 if $res = eval <<'EOE'
37 use charnames 'cyrillic';
41 or $@ !~ /CYRILLIC CAPITAL LETTER BE.*above 0xFF/;
45 # If octal representation of unicode char is \0xyzt, then the utf8 is \3xy\2zt
46 if (ord('A') == 65) { # as on ASCII or UTF-8 machines
47 $encoded_be = "\320\261";
48 $encoded_alpha = "\316\261";
49 $encoded_bet = "\327\221";
50 $encoded_deseng = "\360\220\221\215";
52 else { # EBCDIC where UTF-EBCDIC may be used (this may be 1047 specific since
53 # UTF-EBCDIC is codepage specific)
54 $encoded_be = "\270\102\130";
55 $encoded_alpha = "\264\130";
56 $encoded_bet = "\270\125\130";
57 $encoded_deseng = "\336\102\103\124";
65 use charnames ':full';
67 print "not " unless to_bytes("\N{CYRILLIC SMALL LETTER BE}") eq $encoded_be;
70 use charnames qw(cyrillic greek :short);
72 print "not " unless to_bytes("\N{be},\N{alpha},\N{hebrew:bet}")
73 eq "$encoded_be,$encoded_alpha,$encoded_bet";
78 use charnames ':full';
79 print "not " unless "\x{263a}" eq "\N{WHITE SMILING FACE}";
81 print "not " unless length("\x{263a}") == 1;
83 print "not " unless length("\N{WHITE SMILING FACE}") == 1;
85 print "not " unless sprintf("%vx", "\x{263a}") eq "263a";
87 print "not " unless sprintf("%vx", "\N{WHITE SMILING FACE}") eq "263a";
89 print "not " unless sprintf("%vx", "\xFF\N{WHITE SMILING FACE}") eq "ff.263a";
91 print "not " unless sprintf("%vx", "\x{ff}\N{WHITE SMILING FACE}") eq "ff.263a";
96 use charnames qw(:full);
100 my $named = "\N{CUBE ROOT}";
102 print "not " unless ord($x) == ord($named);
107 use charnames qw(:full);
109 print "not " unless "\x{100}\N{CENT SIGN}" eq "\x{100}"."\N{CENT SIGN}";
114 use charnames ':full';
117 unless to_bytes("\N{DESERET SMALL LETTER ENG}") eq $encoded_deseng;
124 no utf8; # naked Latin-1
126 if (ord("Ä") == 0xc4) { # Try to do this only on Latin-1.
127 use charnames ':full';
128 my $text = "\N{LATIN CAPITAL LETTER A WITH DIAERESIS}";
129 print "not " unless $text eq "\xc4" && ord($text) == 0xc4;
132 print "ok 16 # Skip: not Latin-1\n";
137 print "not " unless charnames::viacode(0x1234) eq "ETHIOPIC SYLLABLE SEE";
141 print "not " unless charnames::viacode(0x0590) eq chr(0xFFFD);
147 sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
151 defined charnames::vianame("NONE SUCH");
156 # check that caching at least hasn't broken anything
158 print "not " unless charnames::viacode(0x1234) eq "ETHIOPIC SYLLABLE SEE";
162 sprintf "%04X\n", charnames::vianame("GOTHIC LETTER AHSA") eq "10330";
167 print "not " unless "\N{CHARACTER TABULATION}" eq "\t";
170 print "not " unless "\N{ESCAPE}" eq "\e";
173 print "not " unless "\N{NULL}" eq "\c@";
176 print "not " unless "\N{LINE FEED (LF)}" eq "\n";
179 print "not " unless "\N{LINE FEED}" eq "\n";
182 print "not " unless "\N{LF}" eq "\n";
185 my $nel = ord("A") == 193 ? qr/^(?:\x15|\x25)$/ : qr/^\x85$/;
187 print "not " unless "\N{NEXT LINE (NEL)}" =~ $nel;
190 print "not " unless "\N{NEXT LINE}" =~ $nel;
193 print "not " unless "\N{NEL}" =~ $nel;
196 print "not " unless "\N{BYTE ORDER MARK}" eq chr(0xFEFF);
199 print "not " unless "\N{BOM}" eq chr(0xFEFF);
203 use warnings 'deprecated';
205 print "not " unless "\N{HORIZONTAL TABULATION}" eq "\t";
208 print "not " unless grep { /"HORIZONTAL TABULATION" is deprecated/ } @WARN;
211 no warnings 'deprecated';
213 print "not " unless "\N{VERTICAL TABULATION}" eq "\013";
216 print "not " if grep { /"VERTICAL TABULATION" is deprecated/ } @WARN;
220 print "not " unless charnames::viacode(0xFEFF) eq "ZERO WIDTH NO-BREAK SPACE";