This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
charnames.t: Attempt to fix probable timing issue
[perl5.git] / t / lib / charnames / alias
CommitLineData
fbb93542 1Tests for use charnames with compilation errors and aliases.
ea065648 2__END__
22dc4229 3# NAME illegal :pragma
8f852052 4use warnings;
ea065648
NC
5use charnames ":scoobydoo";
6"Here: \N{e_ACUTE}!\n";
7EXPECT
8OPTIONS regex
9unsupported special ':scoobydoo' in charnames at
10########
fbb93542
KW
11# NAME autoload doesn't get vianame
12print "Here: \N{DIGIT ONE}\n";
13charnames::vianame("DIGIT TWO");
14EXPECT
15Undefined subroutine &charnames::vianame called at - line 2.
16Here: 1
17########
18# NAME autoload doesn't get viacode
19print "Here: \N{DIGIT THREE}\n";
20charnames::viacode(0x34);
21EXPECT
22OPTIONS regex
23Undefined subroutine &charnames::viacode called at - line 2.
24Here: 3
25########
26# NAME autoload doesn't get string_vianame
27print "Here: \N{DIGIT FOUR}\n";
28charnames::string_vianame("DIGIT FIVE");
29EXPECT
30OPTIONS regex
31Undefined subroutine &charnames::string_vianame called at - line 2.
32Here: 4
33########
22dc4229 34# NAME wrong type of alias (missing colon)
8f852052 35no warnings;
ea065648
NC
36use charnames "alias";
37"Here: \N{e_ACUTE}!\n";
38EXPECT
39OPTIONS regex
40Unknown charname 'e_ACUTE' at
41########
22dc4229 42# NAME alias without an argument
8f852052 43use warnings;
ea065648
NC
44use charnames ":alias";
45"Here: \N{e_ACUTE}!\n";
46EXPECT
47OPTIONS regex
48:alias needs an argument in charnames at
49########
22dc4229 50# NAME reversed sequence
8f852052 51use warnings;
ea065648
NC
52use charnames ":alias" => ":full";
53"Here: \N{e_ACUTE}!\n";
54EXPECT
55OPTIONS regex
56:alias cannot use existing pragma :full \(reversed order\?\) at
57########
22dc4229 58# NAME alias with hashref but no :full
8f852052 59use warnings;
ea065648
NC
60use charnames ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
61"Here: \N{e_ACUTE}!\n";
62EXPECT
63OPTIONS regex
64Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
65########
22dc4229 66# NAME alias with hashref but with :short
8f852052
KW
67use warnings;
68no warnings 'void';
ea065648
NC
69use charnames ":short", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
70"Here: \N{e_ACUTE}!\n";
71EXPECT
72OPTIONS regex
73Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
74########
22dc4229 75# NAME alias with hashref to :full OK
8f852052
KW
76use warnings;
77no warnings 'void';
ea065648
NC
78use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
79"Here: \N{e_ACUTE}!\n";
80EXPECT
81OPTIONS regex
82$
83########
22dc4229 84# NAME alias with hashref to :loose OK
38f4139d
KW
85use warnings;
86no warnings 'void';
87use charnames ":loose", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
88"Here: \N{e_ACUTE}!\n";
89EXPECT
90OPTIONS regex
91$
92########
22dc4229 93# NAME alias with :loose requires :full type name
38f4139d
KW
94use warnings;
95no warnings 'void';
96use charnames ":loose", ":alias" => { e_ACUTE => "latin SMALL LETTER E WITH ACUTE" };
97"Here: \N{e_ACUTE}!\n";
98EXPECT
99OPTIONS regex
100Unknown charname 'latin SMALL LETTER E WITH ACUTE' at
101########
22dc4229 102# NAME alias with hashref to :short but using :full
8f852052
KW
103use warnings;
104no warnings 'void';
ea065648
NC
105use charnames ":full", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" };
106"Here: \N{e_ACUTE}!\n";
107EXPECT
108OPTIONS regex
109Unknown charname 'LATIN:e WITH ACUTE' at
110########
22dc4229 111# NAME alias with hashref to :short OK
8f852052
KW
112use warnings;
113no warnings 'void';
ea065648
NC
114use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" };
115"Here: \N{e_ACUTE}!\n";
116EXPECT
117OPTIONS regex
118$
119########
22dc4229 120# NAME alias with bad hashref
8f852052
KW
121use warnings;
122no warnings 'void';
ea065648
NC
123use charnames ":short", ":alias" => "e_ACUTE";
124"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
125EXPECT
126OPTIONS regex
127unicore/e_ACUTE_alias.pl cannot be used as alias file for charnames at
128########
22dc4229 129# NAME alias with arrayref
8f852052
KW
130use warnings;
131no warnings 'void';
ea065648
NC
132use charnames ":short", ":alias" => [ e_ACUTE => "LATIN:e WITH ACUTE" ];
133"Here: \N{e_ACUTE}!\n";
134EXPECT
135OPTIONS regex
136Only HASH reference supported as argument to :alias at
137########
22dc4229 138# NAME alias with bad hashref
8f852052 139no warnings;
ea065648
NC
140use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE", "a_ACUTE" };
141"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
142EXPECT
143OPTIONS regex
84374e30 144Unknown charname 'a_ACUTE' at
ea065648 145########
22dc4229 146# NAME alias with hashref two aliases
8f852052
KW
147use warnings;
148no warnings 'void';
ea065648
NC
149use charnames ":short", ":alias" => {
150 e_ACUTE => "LATIN:e WITH ACUTE",
151 a_ACUTE => "",
152 };
153"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
154EXPECT
155OPTIONS regex
156Unknown charname '' at
157########
22dc4229 158# NAME alias with hashref two aliases
8f852052
KW
159use warnings;
160no warnings 'void';
ea065648
NC
161use charnames ":short", ":alias" => {
162 e_ACUTE => "LATIN:e WITH ACUTE",
163 a_ACUTE => "LATIN:a WITH ACUTE",
164 };
165"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
166EXPECT
167OPTIONS regex
168$
169########
22dc4229 170# NAME alias with hashref using mixed aliases
8f852052 171use warnings;
ea065648
NC
172use charnames ":short", ":alias" => {
173 e_ACUTE => "LATIN:e WITH ACUTE",
174 a_ACUTE => "LATIN SMALL LETTER A WITH ACUT",
175 };
176"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
177EXPECT
178OPTIONS regex
179Unknown charname 'LATIN SMALL LETTER A WITH ACUT' at
180########
22dc4229 181# NAME alias with hashref using mixed aliases
8f852052 182use warnings;
ea065648
NC
183use charnames ":short", ":alias" => {
184 e_ACUTE => "LATIN:e WITH ACUTE",
185 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
186 };
187"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
188EXPECT
189OPTIONS regex
190Unknown charname 'LATIN SMALL LETTER A WITH ACUTE' at
191########
22dc4229 192# NAME alias with hashref using mixed aliases
8f852052
KW
193use warnings;
194no warnings 'void';
ea065648
NC
195use charnames ":full", ":alias" => {
196 e_ACUTE => "LATIN:e WITH ACUTE",
197 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
198 };
199"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
200EXPECT
201OPTIONS regex
202Unknown charname 'LATIN:e WITH ACUTE' at
203########
22dc4229 204# NAME alias with nonexisting file
8f852052
KW
205use warnings;
206no warnings 'void';
34ea573b 207use charnames ":full", ":alias" => "non_existing_xyzzy";
ea065648
NC
208"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
209EXPECT
210OPTIONS regex
34ea573b 211unicore/non_existing_xyzzy_alias.pl cannot be used as alias file for charnames at
ea065648 212########
22dc4229 213# NAME alias with bad file name
8f852052
KW
214use warnings;
215no warnings 'void';
ea065648
NC
216use charnames ":full", ":alias" => "xy 7-";
217"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
218EXPECT
219OPTIONS regex
220Charnames alias files can only have identifier characters at
221########
22dc4229 222# NAME alias with non_absolute (existing) file name (which it should /not/ use)
8f852052
KW
223use warnings;
224no warnings 'void';
ea065648
NC
225use charnames ":full", ":alias" => "perl";
226"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
227EXPECT
228OPTIONS regex
229unicore/perl_alias.pl cannot be used as alias file for charnames at
230########
231# alias with bad file
463cf062 232--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
233#!perl
2340;
235--FILE--
8f852052
KW
236use warnings;
237no warnings 'void';
ea065648
NC
238use charnames ":full", ":alias" => "xyzzy";
239"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
240EXPECT
241OPTIONS regex
242unicore/xyzzy_alias.pl did not return a \(valid\) list of alias pairs at
243########
244# alias with file with empty list
463cf062 245--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
246#!perl
247();
248--FILE--
8f852052
KW
249use warnings;
250no warnings 'void';
ea065648
NC
251use charnames ":full", ":alias" => "xyzzy";
252"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
253EXPECT
254OPTIONS regex
255Unknown charname 'e_ACUTE' at
256########
93f09d7b 257# alias with file OK but file has :short aliases
463cf062 258--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
259#!perl
260( e_ACUTE => "LATIN:e WITH ACUTE",
261 a_ACUTE => "LATIN:a WITH ACUTE",
262 );
263--FILE--
8f852052
KW
264use warnings;
265no warnings 'void';
ea065648
NC
266use charnames ":full", ":alias" => "xyzzy";
267"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
268EXPECT
269OPTIONS regex
270Unknown charname 'LATIN:e WITH ACUTE' at
271########
272# alias with :short and file OK
463cf062 273--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
274#!perl
275( e_ACUTE => "LATIN:e WITH ACUTE",
276 a_ACUTE => "LATIN:a WITH ACUTE",
277 );
278--FILE--
8f852052
KW
279use warnings;
280no warnings 'void';
ea065648
NC
281use charnames ":short", ":alias" => "xyzzy";
282"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
283EXPECT
284OPTIONS regex
285$
286########
93f09d7b 287# alias with :short and file OK has :long aliases
463cf062 288--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
289#!perl
290( e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
291 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
292 );
293--FILE--
8f852052
KW
294use warnings;
295no warnings 'void';
ea065648
NC
296use charnames ":short", ":alias" => "xyzzy";
297"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
298EXPECT
299OPTIONS regex
300Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
301########
93f09d7b 302# alias with file implicit :full but file has :short aliases
463cf062 303--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
304#!perl
305( e_ACUTE => "LATIN:e WITH ACUTE",
306 a_ACUTE => "LATIN:a WITH ACUTE",
307 );
308--FILE--
8f852052
KW
309use warnings;
310no warnings 'void';
ea065648
NC
311use charnames ":alias" => ":xyzzy";
312"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
313EXPECT
314OPTIONS regex
315Unknown charname 'LATIN:e WITH ACUTE' at
316########
93f09d7b 317# alias with file implicit :full and file has :long aliases
463cf062 318--FILE-- ../../lib/unicore/xyzzy_alias.pl
ea065648
NC
319#!perl
320( e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
321 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
322 );
323--FILE--
8f852052
KW
324use warnings;
325no warnings 'void';
ea065648
NC
326use charnames ":alias" => ":xyzzy";
327"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
328EXPECT
329OPTIONS regex
330$
03f95285 331########
22dc4229 332# NAME charnames with no import still works for runtime functions
03f95285
KW
333use warnings;
334no warnings 'void';
335use charnames ();
336charnames::vianame('SPACE');
337charnames::viacode(0x41);
338EXPECT
339OPTIONS regex
340$