This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add clarifying comments to charnames.t
[perl5.git] / lib / charnames.t
CommitLineData
423cee85 1#!./perl
a0d8d8c5 2use strict;
423cee85 3
da85ecb8
KW
4# Because \N{} is compile time, any warnings will get generated before
5# execution, so have to have an array, and arrange things so no warning
6# is generated twice to verify that in fact a warning did happen
52ea3e69
JH
7my @WARN;
8
423cee85
JH
9BEGIN {
10 unless(grep /blib/, @INC) {
11 chdir 't' if -d 't';
20822f61 12 @INC = '../lib';
423cee85 13 }
52ea3e69 14 $SIG{__WARN__} = sub { push @WARN, @_ };
423cee85
JH
15}
16
16036bcd 17our $local_tests = 424;
63c6dcc1 18
ea065648
NC
19# ---- For the alias extensions
20require "../t/lib/common.pl";
423cee85
JH
21
22use charnames ':full';
23
a0d8d8c5 24is("Here\N{EXCLAMATION MARK}?", "Here!?");
423cee85 25
c82a54e6 26{
a0d8d8c5 27 use bytes; # TEST -utf8 can switch utf8 on
c82a54e6 28
a0d8d8c5 29 my $res = eval <<'EOE';
423cee85 30use charnames ":full";
4a2d328f 31"Here: \N{CYRILLIC SMALL LETTER BE}!";
423cee85
JH
321
33EOE
423cee85 34
a0d8d8c5
KW
35 like($@, "above 0xFF");
36 is($res, undef);
37
38 $res = eval <<'EOE';
423cee85 39use charnames 'cyrillic';
4a2d328f 40"Here: \N{Be}!";
423cee85
JH
411
42EOE
a0d8d8c5 43 like($@, "CYRILLIC CAPITAL LETTER BE.*above 0xFF");
16036bcd
KW
44
45 $res = eval <<'EOE';
46use charnames ':full', ":alias" => { BOM => "LATIN SMALL LETTER B" };
47"\N{BOM}";
48EOE
49 is ($@, "");
50 is ($res, 'b', "Verify that can redefine a standard alias");
c82a54e6 51}
423cee85 52
a0d8d8c5
KW
53my $encoded_be;
54my $encoded_alpha;
55my $encoded_bet;
56my $encoded_deseng;
57
423cee85 58# If octal representation of unicode char is \0xyzt, then the utf8 is \3xy\2zt
210db7fc
PP
59if (ord('A') == 65) { # as on ASCII or UTF-8 machines
60 $encoded_be = "\320\261";
61 $encoded_alpha = "\316\261";
62 $encoded_bet = "\327\221";
63 $encoded_deseng = "\360\220\221\215";
64}
65else { # EBCDIC where UTF-EBCDIC may be used (this may be 1047 specific since
66 # UTF-EBCDIC is codepage specific)
67 $encoded_be = "\270\102\130";
68 $encoded_alpha = "\264\130";
69 $encoded_bet = "\270\125\130";
70 $encoded_deseng = "\336\102\103\124";
71}
c5cc3500
GS
72
73sub to_bytes {
f337b084 74 unpack"U0a*", shift;
c5cc3500
GS
75}
76
423cee85
JH
77{
78 use charnames ':full';
423cee85 79
a0d8d8c5 80 is(to_bytes("\N{CYRILLIC SMALL LETTER BE}"), $encoded_be);
423cee85
JH
81
82 use charnames qw(cyrillic greek :short);
83
a0d8d8c5
KW
84 is(to_bytes("\N{be},\N{alpha},\N{hebrew:bet}"),
85 "$encoded_be,$encoded_alpha,$encoded_bet");
423cee85 86}
e1992b6d
GS
87
88{
89 use charnames ':full';
a0d8d8c5
KW
90 is("\x{263a}", "\N{WHITE SMILING FACE}");
91 cmp_ok(length("\x{263a}"), '==', 1);
92 cmp_ok(length("\N{WHITE SMILING FACE}"), '==', 1);
93 is(sprintf("%vx", "\x{263a}"), "263a");
94 is(sprintf("%vx", "\N{WHITE SMILING FACE}"), "263a");
95 is(sprintf("%vx", "\xFF\N{WHITE SMILING FACE}"), "ff.263a");
96 is(sprintf("%vx", "\x{ff}\N{WHITE SMILING FACE}"), "ff.263a");
e1992b6d 97}
c00525d4
SP
98
99{
a0d8d8c5
KW
100 use charnames qw(:full);
101 use utf8;
51cf30b6 102
c00525d4
SP
103 my $x = "\x{221b}";
104 my $named = "\N{CUBE ROOT}";
105
a0d8d8c5 106 cmp_ok(ord($x), '==', ord($named));
c00525d4
SP
107}
108
f9a63242 109{
a0d8d8c5
KW
110 use charnames qw(:full);
111 use utf8;
112 is("\x{100}\N{CENT SIGN}", "\x{100}"."\N{CENT SIGN}");
f9a63242
JH
113}
114
b896c7a5 115{
a0d8d8c5 116 use charnames ':full';
b896c7a5 117
a0d8d8c5 118 is(to_bytes("\N{DESERET SMALL LETTER ENG}"), $encoded_deseng);
4765795a 119}
b896c7a5 120
4765795a 121{
a0d8d8c5
KW
122 # 20001114.001
123
124 no utf8; # naked Latin-1
125
126 use charnames ':full';
127 my $text = "\N{LATIN CAPITAL LETTER A WITH DIAERESIS}";
128 is($text, latin1_to_native("\xc4"));
129
130 # I'm not sure that this tests anything different from the above.
131 cmp_ok(ord($text), '==', ord(latin1_to_native("\xc4")));
b896c7a5
A
132}
133
daf0d493 134{
a0d8d8c5 135 is(charnames::viacode(0x1234), "ETHIOPIC SYLLABLE SEE");
daf0d493 136
a23c04e4 137 # Unused Hebrew.
a0d8d8c5 138 ok(! defined charnames::viacode(0x0590));
daf0d493
JH
139}
140
141{
a0d8d8c5
KW
142 is(sprintf("%04X", charnames::vianame("GOTHIC LETTER AHSA")), "10330");
143 ok (! defined charnames::vianame("NONE SUCH"));
daf0d493 144}
4e2cda5d
JH
145
146{
147 # check that caching at least hasn't broken anything
148
a0d8d8c5 149 is(charnames::viacode(0x1234), "ETHIOPIC SYLLABLE SEE");
4e2cda5d 150
a0d8d8c5 151 is(sprintf("%04X", charnames::vianame("GOTHIC LETTER AHSA")), "10330");
4e2cda5d
JH
152
153}
301a3cda 154
a0d8d8c5 155is("\N{CHARACTER TABULATION}", "\t");
a2e77dd4 156
a0d8d8c5
KW
157is("\N{ESCAPE}", "\e");
158is("\N{NULL}", "\c@");
159is("\N{LINE FEED (LF)}", "\n");
160is("\N{LINE FEED}", "\n");
161is("\N{LF}", "\n");
52ea3e69 162
a0d8d8c5
KW
163my $nel = latin1_to_native("\x85");
164$nel = qr/^$nel$/;
52ea3e69 165
a0d8d8c5
KW
166like("\N{NEXT LINE (NEL)}", $nel);
167like("\N{NEXT LINE}", $nel);
168like("\N{NEL}", $nel);
169is("\N{BYTE ORDER MARK}", chr(0xFEFF));
170is("\N{BOM}", chr(0xFEFF));
51e9e896 171
52ea3e69
JH
172{
173 use warnings 'deprecated';
174
a0d8d8c5 175 is("\N{HORIZONTAL TABULATION}", "\t");
52ea3e69 176
16036bcd 177 ok(grep { /"HORIZONTAL TABULATION" is deprecated.*CHARACTER TABULATION/ } @WARN);
822ebcc8 178
52ea3e69
JH
179 no warnings 'deprecated';
180
a0d8d8c5 181 is("\N{VERTICAL TABULATION}", "\013");
52ea3e69 182
a0d8d8c5 183 ok(! grep { /"VERTICAL TABULATION" is deprecated/ } @WARN);
52ea3e69 184}
822ebcc8 185
a0d8d8c5 186is(charnames::viacode(0xFEFF), "ZERO WIDTH NO-BREAK SPACE");
a23c04e4 187
872c91ae
JH
188{
189 use warnings;
a0d8d8c5 190 cmp_ok(ord("\N{BOM}"), '==', 0xFEFF);
872c91ae
JH
191}
192
a0d8d8c5 193cmp_ok(ord("\N{ZWNJ}"), '==', 0x200C);
24b5d5cc 194
a0d8d8c5 195cmp_ok(ord("\N{ZWJ}"), '==', 0x200D);
dbc0d4f2 196
a0d8d8c5 197is("\N{U+263A}", "\N{WHITE SMILING FACE}");
dbc0d4f2 198
51b0dbc4 199{
a0d8d8c5
KW
200 cmp_ok( 0x3093, '==', charnames::vianame("HIRAGANA LETTER N"));
201 cmp_ok(0x0397, '==', charnames::vianame("GREEK CAPITAL LETTER ETA"));
51b0dbc4
TS
202}
203
a0d8d8c5
KW
204ok(! defined charnames::viacode(0x110000));
205ok(! grep { /you asked for U+110000/ } @WARN);
e10d7780 206
c8002005
KW
207is(charnames::viacode(0), "NULL");
208is(charnames::viacode("BE"), "VULGAR FRACTION THREE QUARTERS");
209is(charnames::viacode("U+00000000000FEED"), "ARABIC LETTER WAW ISOLATED FORM");
210
16036bcd
KW
211{
212 no warnings 'deprecated';
213 is("\N{LINE FEED}", "\N{LINE FEED (LF)}");
214 is("\N{FORM FEED}", "\N{FORM FEED (FF)}");
215 is("\N{CARRIAGE RETURN}", "\N{CARRIAGE RETURN (CR)}");
216 is("\N{NEXT LINE}", "\N{NEXT LINE (NEL)}");
217 is("\N{NUL}", "\N{NULL}");
218 is("\N{SOH}", "\N{START OF HEADING}");
219 is("\N{STX}", "\N{START OF TEXT}");
220 is("\N{ETX}", "\N{END OF TEXT}");
221 is("\N{EOT}", "\N{END OF TRANSMISSION}");
222 is("\N{ENQ}", "\N{ENQUIRY}");
223 is("\N{ACK}", "\N{ACKNOWLEDGE}");
224 is("\N{BEL}", "\N{BELL}");
225 is("\N{BS}", "\N{BACKSPACE}");
226 is("\N{HT}", "\N{HORIZONTAL TABULATION}");
227 is("\N{LF}", "\N{LINE FEED (LF)}");
228 is("\N{VT}", "\N{VERTICAL TABULATION}");
229 is("\N{FF}", "\N{FORM FEED (FF)}");
230 is("\N{CR}", "\N{CARRIAGE RETURN (CR)}");
231 is("\N{SO}", "\N{SHIFT OUT}");
232 is("\N{SI}", "\N{SHIFT IN}");
233 is("\N{DLE}", "\N{DATA LINK ESCAPE}");
234 is("\N{DC1}", "\N{DEVICE CONTROL ONE}");
235 is("\N{DC2}", "\N{DEVICE CONTROL TWO}");
236 is("\N{DC3}", "\N{DEVICE CONTROL THREE}");
237 is("\N{DC4}", "\N{DEVICE CONTROL FOUR}");
238 is("\N{NAK}", "\N{NEGATIVE ACKNOWLEDGE}");
239 is("\N{SYN}", "\N{SYNCHRONOUS IDLE}");
240 is("\N{ETB}", "\N{END OF TRANSMISSION BLOCK}");
241 is("\N{CAN}", "\N{CANCEL}");
242 is("\N{EOM}", "\N{END OF MEDIUM}");
243 is("\N{SUB}", "\N{SUBSTITUTE}");
244 is("\N{ESC}", "\N{ESCAPE}");
245 is("\N{FS}", "\N{FILE SEPARATOR}");
246 is("\N{GS}", "\N{GROUP SEPARATOR}");
247 is("\N{RS}", "\N{RECORD SEPARATOR}");
248 is("\N{US}", "\N{UNIT SEPARATOR}");
249 is("\N{DEL}", "\N{DELETE}");
250 is("\N{BPH}", "\N{BREAK PERMITTED HERE}");
251 is("\N{NBH}", "\N{NO BREAK HERE}");
252 is("\N{NEL}", "\N{NEXT LINE (NEL)}");
253 is("\N{SSA}", "\N{START OF SELECTED AREA}");
254 is("\N{ESA}", "\N{END OF SELECTED AREA}");
255 is("\N{HTS}", "\N{CHARACTER TABULATION SET}");
256 is("\N{HTJ}", "\N{CHARACTER TABULATION WITH JUSTIFICATION}");
257 is("\N{VTS}", "\N{LINE TABULATION SET}");
258 is("\N{PLD}", "\N{PARTIAL LINE FORWARD}");
259 is("\N{PLU}", "\N{PARTIAL LINE BACKWARD}");
260 is("\N{RI }", "\N{REVERSE LINE FEED}");
261 is("\N{SS2}", "\N{SINGLE SHIFT TWO}");
262 is("\N{SS3}", "\N{SINGLE SHIFT THREE}");
263 is("\N{DCS}", "\N{DEVICE CONTROL STRING}");
264 is("\N{PU1}", "\N{PRIVATE USE ONE}");
265 is("\N{PU2}", "\N{PRIVATE USE TWO}");
266 is("\N{STS}", "\N{SET TRANSMIT STATE}");
267 is("\N{CCH}", "\N{CANCEL CHARACTER}");
268 is("\N{MW }", "\N{MESSAGE WAITING}");
269 is("\N{SPA}", "\N{START OF GUARDED AREA}");
270 is("\N{EPA}", "\N{END OF GUARDED AREA}");
271 is("\N{SOS}", "\N{START OF STRING}");
272 is("\N{SCI}", "\N{SINGLE CHARACTER INTRODUCER}");
273 is("\N{CSI}", "\N{CONTROL SEQUENCE INTRODUCER}");
274 is("\N{ST }", "\N{STRING TERMINATOR}");
275 is("\N{OSC}", "\N{OPERATING SYSTEM COMMAND}");
276 is("\N{PM }", "\N{PRIVACY MESSAGE}");
277 is("\N{APC}", "\N{APPLICATION PROGRAM COMMAND}");
278 is("\N{PADDING CHARACTER}", "\N{PAD}");
279 is("\N{HIGH OCTET PRESET}","\N{HOP}");
280 is("\N{INDEX}", "\N{IND}");
281 is("\N{SINGLE GRAPHIC CHARACTER INTRODUCER}", "\N{SGC}");
282 is("\N{BOM}", "\N{BYTE ORDER MARK}");
283 is("\N{CGJ}", "\N{COMBINING GRAPHEME JOINER}");
284 is("\N{FVS1}", "\N{MONGOLIAN FREE VARIATION SELECTOR ONE}");
285 is("\N{FVS2}", "\N{MONGOLIAN FREE VARIATION SELECTOR TWO}");
286 is("\N{FVS3}", "\N{MONGOLIAN FREE VARIATION SELECTOR THREE}");
287 is("\N{LRE}", "\N{LEFT-TO-RIGHT EMBEDDING}");
288 is("\N{LRM}", "\N{LEFT-TO-RIGHT MARK}");
289 is("\N{LRO}", "\N{LEFT-TO-RIGHT OVERRIDE}");
290 is("\N{MMSP}", "\N{MEDIUM MATHEMATICAL SPACE}");
291 is("\N{MVS}", "\N{MONGOLIAN VOWEL SEPARATOR}");
292 is("\N{NBSP}", "\N{NO-BREAK SPACE}");
293 is("\N{NNBSP}", "\N{NARROW NO-BREAK SPACE}");
294 is("\N{PDF}", "\N{POP DIRECTIONAL FORMATTING}");
295 is("\N{RLE}", "\N{RIGHT-TO-LEFT EMBEDDING}");
296 is("\N{RLM}", "\N{RIGHT-TO-LEFT MARK}");
297 is("\N{RLO}", "\N{RIGHT-TO-LEFT OVERRIDE}");
298 is("\N{SHY}", "\N{SOFT HYPHEN}");
299 is("\N{WJ}", "\N{WORD JOINER}");
300 is("\N{ZWJ}", "\N{ZERO WIDTH JOINER}");
301 is("\N{ZWNJ}", "\N{ZERO WIDTH NON-JOINER}");
302 is("\N{ZWSP}", "\N{ZERO WIDTH SPACE}");
303 is("\N{HORIZONTAL TABULATION}", "\N{CHARACTER TABULATION}");
304 is("\N{VERTICAL TABULATION}", "\N{LINE TABULATION}");
305 is("\N{FILE SEPARATOR}", "\N{INFORMATION SEPARATOR FOUR}");
306 is("\N{GROUP SEPARATOR}", "\N{INFORMATION SEPARATOR THREE}");
307 is("\N{RECORD SEPARATOR}", "\N{INFORMATION SEPARATOR TWO}");
308 is("\N{UNIT SEPARATOR}", "\N{INFORMATION SEPARATOR ONE}");
309 is("\N{HORIZONTAL TABULATION SET}", "\N{CHARACTER TABULATION SET}");
310 is("\N{HORIZONTAL TABULATION WITH JUSTIFICATION}", "\N{CHARACTER TABULATION WITH JUSTIFICATION}");
311 is("\N{PARTIAL LINE DOWN}", "\N{PARTIAL LINE FORWARD}");
312 is("\N{PARTIAL LINE UP}", "\N{PARTIAL LINE BACKWARD}");
313 is("\N{VERTICAL TABULATION SET}", "\N{LINE TABULATION SET}");
314 is("\N{REVERSE INDEX}", "\N{REVERSE LINE FEED}");
315 is("\N{SINGLE-SHIFT 2}", "\N{SINGLE SHIFT TWO}");
316 is("\N{SINGLE-SHIFT 3}", "\N{SINGLE SHIFT THREE}");
317 is("\N{PRIVATE USE 1}", "\N{PRIVATE USE ONE}");
318 is("\N{PRIVATE USE 2}", "\N{PRIVATE USE TWO}");
319 is("\N{START OF PROTECTED AREA}", "\N{START OF GUARDED AREA}");
320 is("\N{END OF PROTECTED AREA}", "\N{END OF GUARDED AREA}");
321 is("\N{VS1}", "\N{VARIATION SELECTOR-1}");
322 is("\N{VS2}", "\N{VARIATION SELECTOR-2}");
323 is("\N{VS3}", "\N{VARIATION SELECTOR-3}");
324 is("\N{VS4}", "\N{VARIATION SELECTOR-4}");
325 is("\N{VS5}", "\N{VARIATION SELECTOR-5}");
326 is("\N{VS6}", "\N{VARIATION SELECTOR-6}");
327 is("\N{VS7}", "\N{VARIATION SELECTOR-7}");
328 is("\N{VS8}", "\N{VARIATION SELECTOR-8}");
329 is("\N{VS9}", "\N{VARIATION SELECTOR-9}");
330 is("\N{VS10}", "\N{VARIATION SELECTOR-10}");
331 is("\N{VS11}", "\N{VARIATION SELECTOR-11}");
332 is("\N{VS12}", "\N{VARIATION SELECTOR-12}");
333 is("\N{VS13}", "\N{VARIATION SELECTOR-13}");
334 is("\N{VS14}", "\N{VARIATION SELECTOR-14}");
335 is("\N{VS15}", "\N{VARIATION SELECTOR-15}");
336 is("\N{VS16}", "\N{VARIATION SELECTOR-16}");
337 is("\N{VS17}", "\N{VARIATION SELECTOR-17}");
338 is("\N{VS18}", "\N{VARIATION SELECTOR-18}");
339 is("\N{VS19}", "\N{VARIATION SELECTOR-19}");
340 is("\N{VS20}", "\N{VARIATION SELECTOR-20}");
341 is("\N{VS21}", "\N{VARIATION SELECTOR-21}");
342 is("\N{VS22}", "\N{VARIATION SELECTOR-22}");
343 is("\N{VS23}", "\N{VARIATION SELECTOR-23}");
344 is("\N{VS24}", "\N{VARIATION SELECTOR-24}");
345 is("\N{VS25}", "\N{VARIATION SELECTOR-25}");
346 is("\N{VS26}", "\N{VARIATION SELECTOR-26}");
347 is("\N{VS27}", "\N{VARIATION SELECTOR-27}");
348 is("\N{VS28}", "\N{VARIATION SELECTOR-28}");
349 is("\N{VS29}", "\N{VARIATION SELECTOR-29}");
350 is("\N{VS30}", "\N{VARIATION SELECTOR-30}");
351 is("\N{VS31}", "\N{VARIATION SELECTOR-31}");
352 is("\N{VS32}", "\N{VARIATION SELECTOR-32}");
353 is("\N{VS33}", "\N{VARIATION SELECTOR-33}");
354 is("\N{VS34}", "\N{VARIATION SELECTOR-34}");
355 is("\N{VS35}", "\N{VARIATION SELECTOR-35}");
356 is("\N{VS36}", "\N{VARIATION SELECTOR-36}");
357 is("\N{VS37}", "\N{VARIATION SELECTOR-37}");
358 is("\N{VS38}", "\N{VARIATION SELECTOR-38}");
359 is("\N{VS39}", "\N{VARIATION SELECTOR-39}");
360 is("\N{VS40}", "\N{VARIATION SELECTOR-40}");
361 is("\N{VS41}", "\N{VARIATION SELECTOR-41}");
362 is("\N{VS42}", "\N{VARIATION SELECTOR-42}");
363 is("\N{VS43}", "\N{VARIATION SELECTOR-43}");
364 is("\N{VS44}", "\N{VARIATION SELECTOR-44}");
365 is("\N{VS45}", "\N{VARIATION SELECTOR-45}");
366 is("\N{VS46}", "\N{VARIATION SELECTOR-46}");
367 is("\N{VS47}", "\N{VARIATION SELECTOR-47}");
368 is("\N{VS48}", "\N{VARIATION SELECTOR-48}");
369 is("\N{VS49}", "\N{VARIATION SELECTOR-49}");
370 is("\N{VS50}", "\N{VARIATION SELECTOR-50}");
371 is("\N{VS51}", "\N{VARIATION SELECTOR-51}");
372 is("\N{VS52}", "\N{VARIATION SELECTOR-52}");
373 is("\N{VS53}", "\N{VARIATION SELECTOR-53}");
374 is("\N{VS54}", "\N{VARIATION SELECTOR-54}");
375 is("\N{VS55}", "\N{VARIATION SELECTOR-55}");
376 is("\N{VS56}", "\N{VARIATION SELECTOR-56}");
377 is("\N{VS57}", "\N{VARIATION SELECTOR-57}");
378 is("\N{VS58}", "\N{VARIATION SELECTOR-58}");
379 is("\N{VS59}", "\N{VARIATION SELECTOR-59}");
380 is("\N{VS60}", "\N{VARIATION SELECTOR-60}");
381 is("\N{VS61}", "\N{VARIATION SELECTOR-61}");
382 is("\N{VS62}", "\N{VARIATION SELECTOR-62}");
383 is("\N{VS63}", "\N{VARIATION SELECTOR-63}");
384 is("\N{VS64}", "\N{VARIATION SELECTOR-64}");
385 is("\N{VS65}", "\N{VARIATION SELECTOR-65}");
386 is("\N{VS66}", "\N{VARIATION SELECTOR-66}");
387 is("\N{VS67}", "\N{VARIATION SELECTOR-67}");
388 is("\N{VS68}", "\N{VARIATION SELECTOR-68}");
389 is("\N{VS69}", "\N{VARIATION SELECTOR-69}");
390 is("\N{VS70}", "\N{VARIATION SELECTOR-70}");
391 is("\N{VS71}", "\N{VARIATION SELECTOR-71}");
392 is("\N{VS72}", "\N{VARIATION SELECTOR-72}");
393 is("\N{VS73}", "\N{VARIATION SELECTOR-73}");
394 is("\N{VS74}", "\N{VARIATION SELECTOR-74}");
395 is("\N{VS75}", "\N{VARIATION SELECTOR-75}");
396 is("\N{VS76}", "\N{VARIATION SELECTOR-76}");
397 is("\N{VS77}", "\N{VARIATION SELECTOR-77}");
398 is("\N{VS78}", "\N{VARIATION SELECTOR-78}");
399 is("\N{VS79}", "\N{VARIATION SELECTOR-79}");
400 is("\N{VS80}", "\N{VARIATION SELECTOR-80}");
401 is("\N{VS81}", "\N{VARIATION SELECTOR-81}");
402 is("\N{VS82}", "\N{VARIATION SELECTOR-82}");
403 is("\N{VS83}", "\N{VARIATION SELECTOR-83}");
404 is("\N{VS84}", "\N{VARIATION SELECTOR-84}");
405 is("\N{VS85}", "\N{VARIATION SELECTOR-85}");
406 is("\N{VS86}", "\N{VARIATION SELECTOR-86}");
407 is("\N{VS87}", "\N{VARIATION SELECTOR-87}");
408 is("\N{VS88}", "\N{VARIATION SELECTOR-88}");
409 is("\N{VS89}", "\N{VARIATION SELECTOR-89}");
410 is("\N{VS90}", "\N{VARIATION SELECTOR-90}");
411 is("\N{VS91}", "\N{VARIATION SELECTOR-91}");
412 is("\N{VS92}", "\N{VARIATION SELECTOR-92}");
413 is("\N{VS93}", "\N{VARIATION SELECTOR-93}");
414 is("\N{VS94}", "\N{VARIATION SELECTOR-94}");
415 is("\N{VS95}", "\N{VARIATION SELECTOR-95}");
416 is("\N{VS96}", "\N{VARIATION SELECTOR-96}");
417 is("\N{VS97}", "\N{VARIATION SELECTOR-97}");
418 is("\N{VS98}", "\N{VARIATION SELECTOR-98}");
419 is("\N{VS99}", "\N{VARIATION SELECTOR-99}");
420 is("\N{VS100}", "\N{VARIATION SELECTOR-100}");
421 is("\N{VS101}", "\N{VARIATION SELECTOR-101}");
422 is("\N{VS102}", "\N{VARIATION SELECTOR-102}");
423 is("\N{VS103}", "\N{VARIATION SELECTOR-103}");
424 is("\N{VS104}", "\N{VARIATION SELECTOR-104}");
425 is("\N{VS105}", "\N{VARIATION SELECTOR-105}");
426 is("\N{VS106}", "\N{VARIATION SELECTOR-106}");
427 is("\N{VS107}", "\N{VARIATION SELECTOR-107}");
428 is("\N{VS108}", "\N{VARIATION SELECTOR-108}");
429 is("\N{VS109}", "\N{VARIATION SELECTOR-109}");
430 is("\N{VS110}", "\N{VARIATION SELECTOR-110}");
431 is("\N{VS111}", "\N{VARIATION SELECTOR-111}");
432 is("\N{VS112}", "\N{VARIATION SELECTOR-112}");
433 is("\N{VS113}", "\N{VARIATION SELECTOR-113}");
434 is("\N{VS114}", "\N{VARIATION SELECTOR-114}");
435 is("\N{VS115}", "\N{VARIATION SELECTOR-115}");
436 is("\N{VS116}", "\N{VARIATION SELECTOR-116}");
437 is("\N{VS117}", "\N{VARIATION SELECTOR-117}");
438 is("\N{VS118}", "\N{VARIATION SELECTOR-118}");
439 is("\N{VS119}", "\N{VARIATION SELECTOR-119}");
440 is("\N{VS120}", "\N{VARIATION SELECTOR-120}");
441 is("\N{VS121}", "\N{VARIATION SELECTOR-121}");
442 is("\N{VS122}", "\N{VARIATION SELECTOR-122}");
443 is("\N{VS123}", "\N{VARIATION SELECTOR-123}");
444 is("\N{VS124}", "\N{VARIATION SELECTOR-124}");
445 is("\N{VS125}", "\N{VARIATION SELECTOR-125}");
446 is("\N{VS126}", "\N{VARIATION SELECTOR-126}");
447 is("\N{VS127}", "\N{VARIATION SELECTOR-127}");
448 is("\N{VS128}", "\N{VARIATION SELECTOR-128}");
449 is("\N{VS129}", "\N{VARIATION SELECTOR-129}");
450 is("\N{VS130}", "\N{VARIATION SELECTOR-130}");
451 is("\N{VS131}", "\N{VARIATION SELECTOR-131}");
452 is("\N{VS132}", "\N{VARIATION SELECTOR-132}");
453 is("\N{VS133}", "\N{VARIATION SELECTOR-133}");
454 is("\N{VS134}", "\N{VARIATION SELECTOR-134}");
455 is("\N{VS135}", "\N{VARIATION SELECTOR-135}");
456 is("\N{VS136}", "\N{VARIATION SELECTOR-136}");
457 is("\N{VS137}", "\N{VARIATION SELECTOR-137}");
458 is("\N{VS138}", "\N{VARIATION SELECTOR-138}");
459 is("\N{VS139}", "\N{VARIATION SELECTOR-139}");
460 is("\N{VS140}", "\N{VARIATION SELECTOR-140}");
461 is("\N{VS141}", "\N{VARIATION SELECTOR-141}");
462 is("\N{VS142}", "\N{VARIATION SELECTOR-142}");
463 is("\N{VS143}", "\N{VARIATION SELECTOR-143}");
464 is("\N{VS144}", "\N{VARIATION SELECTOR-144}");
465 is("\N{VS145}", "\N{VARIATION SELECTOR-145}");
466 is("\N{VS146}", "\N{VARIATION SELECTOR-146}");
467 is("\N{VS147}", "\N{VARIATION SELECTOR-147}");
468 is("\N{VS148}", "\N{VARIATION SELECTOR-148}");
469 is("\N{VS149}", "\N{VARIATION SELECTOR-149}");
470 is("\N{VS150}", "\N{VARIATION SELECTOR-150}");
471 is("\N{VS151}", "\N{VARIATION SELECTOR-151}");
472 is("\N{VS152}", "\N{VARIATION SELECTOR-152}");
473 is("\N{VS153}", "\N{VARIATION SELECTOR-153}");
474 is("\N{VS154}", "\N{VARIATION SELECTOR-154}");
475 is("\N{VS155}", "\N{VARIATION SELECTOR-155}");
476 is("\N{VS156}", "\N{VARIATION SELECTOR-156}");
477 is("\N{VS157}", "\N{VARIATION SELECTOR-157}");
478 is("\N{VS158}", "\N{VARIATION SELECTOR-158}");
479 is("\N{VS159}", "\N{VARIATION SELECTOR-159}");
480 is("\N{VS160}", "\N{VARIATION SELECTOR-160}");
481 is("\N{VS161}", "\N{VARIATION SELECTOR-161}");
482 is("\N{VS162}", "\N{VARIATION SELECTOR-162}");
483 is("\N{VS163}", "\N{VARIATION SELECTOR-163}");
484 is("\N{VS164}", "\N{VARIATION SELECTOR-164}");
485 is("\N{VS165}", "\N{VARIATION SELECTOR-165}");
486 is("\N{VS166}", "\N{VARIATION SELECTOR-166}");
487 is("\N{VS167}", "\N{VARIATION SELECTOR-167}");
488 is("\N{VS168}", "\N{VARIATION SELECTOR-168}");
489 is("\N{VS169}", "\N{VARIATION SELECTOR-169}");
490 is("\N{VS170}", "\N{VARIATION SELECTOR-170}");
491 is("\N{VS171}", "\N{VARIATION SELECTOR-171}");
492 is("\N{VS172}", "\N{VARIATION SELECTOR-172}");
493 is("\N{VS173}", "\N{VARIATION SELECTOR-173}");
494 is("\N{VS174}", "\N{VARIATION SELECTOR-174}");
495 is("\N{VS175}", "\N{VARIATION SELECTOR-175}");
496 is("\N{VS176}", "\N{VARIATION SELECTOR-176}");
497 is("\N{VS177}", "\N{VARIATION SELECTOR-177}");
498 is("\N{VS178}", "\N{VARIATION SELECTOR-178}");
499 is("\N{VS179}", "\N{VARIATION SELECTOR-179}");
500 is("\N{VS180}", "\N{VARIATION SELECTOR-180}");
501 is("\N{VS181}", "\N{VARIATION SELECTOR-181}");
502 is("\N{VS182}", "\N{VARIATION SELECTOR-182}");
503 is("\N{VS183}", "\N{VARIATION SELECTOR-183}");
504 is("\N{VS184}", "\N{VARIATION SELECTOR-184}");
505 is("\N{VS185}", "\N{VARIATION SELECTOR-185}");
506 is("\N{VS186}", "\N{VARIATION SELECTOR-186}");
507 is("\N{VS187}", "\N{VARIATION SELECTOR-187}");
508 is("\N{VS188}", "\N{VARIATION SELECTOR-188}");
509 is("\N{VS189}", "\N{VARIATION SELECTOR-189}");
510 is("\N{VS190}", "\N{VARIATION SELECTOR-190}");
511 is("\N{VS191}", "\N{VARIATION SELECTOR-191}");
512 is("\N{VS192}", "\N{VARIATION SELECTOR-192}");
513 is("\N{VS193}", "\N{VARIATION SELECTOR-193}");
514 is("\N{VS194}", "\N{VARIATION SELECTOR-194}");
515 is("\N{VS195}", "\N{VARIATION SELECTOR-195}");
516 is("\N{VS196}", "\N{VARIATION SELECTOR-196}");
517 is("\N{VS197}", "\N{VARIATION SELECTOR-197}");
518 is("\N{VS198}", "\N{VARIATION SELECTOR-198}");
519 is("\N{VS199}", "\N{VARIATION SELECTOR-199}");
520 is("\N{VS200}", "\N{VARIATION SELECTOR-200}");
521 is("\N{VS201}", "\N{VARIATION SELECTOR-201}");
522 is("\N{VS202}", "\N{VARIATION SELECTOR-202}");
523 is("\N{VS203}", "\N{VARIATION SELECTOR-203}");
524 is("\N{VS204}", "\N{VARIATION SELECTOR-204}");
525 is("\N{VS205}", "\N{VARIATION SELECTOR-205}");
526 is("\N{VS206}", "\N{VARIATION SELECTOR-206}");
527 is("\N{VS207}", "\N{VARIATION SELECTOR-207}");
528 is("\N{VS208}", "\N{VARIATION SELECTOR-208}");
529 is("\N{VS209}", "\N{VARIATION SELECTOR-209}");
530 is("\N{VS210}", "\N{VARIATION SELECTOR-210}");
531 is("\N{VS211}", "\N{VARIATION SELECTOR-211}");
532 is("\N{VS212}", "\N{VARIATION SELECTOR-212}");
533 is("\N{VS213}", "\N{VARIATION SELECTOR-213}");
534 is("\N{VS214}", "\N{VARIATION SELECTOR-214}");
535 is("\N{VS215}", "\N{VARIATION SELECTOR-215}");
536 is("\N{VS216}", "\N{VARIATION SELECTOR-216}");
537 is("\N{VS217}", "\N{VARIATION SELECTOR-217}");
538 is("\N{VS218}", "\N{VARIATION SELECTOR-218}");
539 is("\N{VS219}", "\N{VARIATION SELECTOR-219}");
540 is("\N{VS220}", "\N{VARIATION SELECTOR-220}");
541 is("\N{VS221}", "\N{VARIATION SELECTOR-221}");
542 is("\N{VS222}", "\N{VARIATION SELECTOR-222}");
543 is("\N{VS223}", "\N{VARIATION SELECTOR-223}");
544 is("\N{VS224}", "\N{VARIATION SELECTOR-224}");
545 is("\N{VS225}", "\N{VARIATION SELECTOR-225}");
546 is("\N{VS226}", "\N{VARIATION SELECTOR-226}");
547 is("\N{VS227}", "\N{VARIATION SELECTOR-227}");
548 is("\N{VS228}", "\N{VARIATION SELECTOR-228}");
549 is("\N{VS229}", "\N{VARIATION SELECTOR-229}");
550 is("\N{VS230}", "\N{VARIATION SELECTOR-230}");
551 is("\N{VS231}", "\N{VARIATION SELECTOR-231}");
552 is("\N{VS232}", "\N{VARIATION SELECTOR-232}");
553 is("\N{VS233}", "\N{VARIATION SELECTOR-233}");
554 is("\N{VS234}", "\N{VARIATION SELECTOR-234}");
555 is("\N{VS235}", "\N{VARIATION SELECTOR-235}");
556 is("\N{VS236}", "\N{VARIATION SELECTOR-236}");
557 is("\N{VS237}", "\N{VARIATION SELECTOR-237}");
558 is("\N{VS238}", "\N{VARIATION SELECTOR-238}");
559 is("\N{VS239}", "\N{VARIATION SELECTOR-239}");
560 is("\N{VS240}", "\N{VARIATION SELECTOR-240}");
561 is("\N{VS241}", "\N{VARIATION SELECTOR-241}");
562 is("\N{VS242}", "\N{VARIATION SELECTOR-242}");
563 is("\N{VS243}", "\N{VARIATION SELECTOR-243}");
564 is("\N{VS244}", "\N{VARIATION SELECTOR-244}");
565 is("\N{VS245}", "\N{VARIATION SELECTOR-245}");
566 is("\N{VS246}", "\N{VARIATION SELECTOR-246}");
567 is("\N{VS247}", "\N{VARIATION SELECTOR-247}");
568 is("\N{VS248}", "\N{VARIATION SELECTOR-248}");
569 is("\N{VS249}", "\N{VARIATION SELECTOR-249}");
570 is("\N{VS250}", "\N{VARIATION SELECTOR-250}");
571 is("\N{VS251}", "\N{VARIATION SELECTOR-251}");
572 is("\N{VS252}", "\N{VARIATION SELECTOR-252}");
573 is("\N{VS253}", "\N{VARIATION SELECTOR-253}");
574 is("\N{VS254}", "\N{VARIATION SELECTOR-254}");
575 is("\N{VS255}", "\N{VARIATION SELECTOR-255}");
576 is("\N{VS256}", "\N{VARIATION SELECTOR-256}");
577}
578
579# ---- Alias extensions
580
581my $alifile = File::Spec->catfile(File::Spec->updir, qw(lib unicore xyzzy_alias.pl));
582
583my @prgs;
584{
585 local $/ = undef;
586 @prgs = split "\n########\n", <DATA>;
587}
588
589for (@prgs) {
590 my ($code, $exp) = ((split m/\nEXPECT\n/), '$');
da85ecb8
KW
591
592 # FILE is the code that generates any abbreviations
16036bcd
KW
593 my ($prog, $fil) = ((split m/\nFILE\n/, $code), "");
594 my $tmpfile = tempfile();
595 open my $tmp, "> $tmpfile" or die "Could not open $tmpfile: $!";
596 print $tmp $prog, "\n";
597 close $tmp or die "Could not close $tmpfile: $!";
598 if ($fil) {
599 $fil .= "\n";
600 open my $ali, "> $alifile" or die "Could not open $alifile: $!";
601 print $ali $fil;
602 close $ali or die "Could not close $alifile: $!";
603 }
604 my $switch = "";
605 my $res = runperl( switches => $switch,
606 progfile => $tmpfile,
607 stderr => 1 );
608 my $status = $?;
609 $res =~ s/[\r\n]+$//;
610 $res =~ s/tmp\d+/-/g; # fake $prog from STDIN
611 $res =~ s/\n%[A-Z]+-[SIWEF]-.*$// # clip off DCL status msg
612 if $^O eq "VMS";
613 $exp =~ s/[\r\n]+$//;
614 my $pfx = ($res =~ s/^PREFIX\n//);
615 my $rexp = qr{^$exp};
616 my $expected = ""; # Unsure why this is here, as was never initialized
617
618 SKIP: {
619 skip $res, 1, if $res =~ s/^SKIPPED\n//;
620 if (($pfx and $res !~ /^\Q$expected/) or
621 (!$pfx and $res !~ $rexp))
622 {
623 fail("PROG:\n$prog\nFILE:\n${fil}EXPECTED:\n$exp\nGOT:\n$res");
624 } else {
625 pass("");
626 }
627 }
628 $fil or next;
629 1 while unlink $alifile;
630}
631
e5c3f898
MG
632# [perl #30409] charnames.pm clobbers default variable
633$_ = 'foobar';
634eval "use charnames ':full';";
a0d8d8c5 635is($_, 'foobar');
e5c3f898 636
c776535e
NC
637# Unicode slowdown noted by Phil Pennock, traced to a bug fix in index
638# SADAHIRO Tomoyuki's suggestion is to ensure that the UTF-8ness of both
639# arguments are indentical before calling index.
640# To do this can take advantage of the fact that unicore/Name.pl is 7 bit
e5d6fe1e
KW
641# (or at least should be). So assert that that it's true here. EBCDIC
642# may be a problem (khw).
c776535e
NC
643
644my $names = do "unicore/Name.pl";
a0d8d8c5
KW
645ok(defined $names);
646my $non_ascii = native_to_latin1($names) =~ tr/\0-\177//c;
647ok(! $non_ascii, "Make sure all names are ASCII-only");
c776535e 648
eb915052
RGS
649# Verify that charnames propagate to eval("")
650my $evaltry = eval q[ "Eval: \N{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}" ];
651if ($@) {
a0d8d8c5
KW
652 fail('charnames failed to propagate to eval("")');
653 fail('next test also fails to make the same number of tests');
eb915052 654} else {
a0d8d8c5
KW
655 pass('charnames propagated to eval("")');
656 is($evaltry, "Eval: \N{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}");
eb915052 657}
c776535e 658
ae6979a8 659# Verify that db includes the normative NameAliases.txt names
a0d8d8c5 660is("\N{U+1D0C5}", "\N{BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS}");
ae6979a8 661
ec34a119
DM
662# [perl #73174] use of \N{FOO} used to reset %^H
663
664{
665 use charnames ":full";
666 my $res;
667 BEGIN { $^H{73174} = "foo" }
668 BEGIN { $res = ($^H{73174} // "") }
669 # forces loading of utf8.pm, which used to reset %^H
670 $res .= '-1' if ":" =~ /\N{COLON}/i;
671 BEGIN { $res .= '-' . ($^H{73174} // "") }
672 $res .= '-' . ($^H{73174} // "");
673 $res .= '-2' if ":" =~ /\N{COLON}/;
674 $res .= '-3' if ":" =~ /\N{COLON}/i;
a0d8d8c5 675 is($res, "foo-foo-1--2-3");
ec34a119 676}