xref: /openbsd/gnu/usr.bin/perl/t/lib/charnames/alias (revision 898184e3)
1Tests for use charnames with compilation errors and aliases.
2__END__
3# NAME illegal :pragma
4use warnings;
5use charnames ":scoobydoo";
6"Here: \N{e_ACUTE}!\n";
7EXPECT
8OPTIONS regex
9unsupported special ':scoobydoo' in charnames at
10########
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########
34# NAME wrong type of alias (missing colon)
35no warnings;
36use charnames "alias";
37"Here: \N{e_ACUTE}!\n";
38EXPECT
39OPTIONS regex
40Unknown charname 'e_ACUTE' at
41########
42# NAME alias without an argument
43use warnings;
44use charnames ":alias";
45"Here: \N{e_ACUTE}!\n";
46EXPECT
47OPTIONS regex
48:alias needs an argument in charnames at
49########
50# NAME reversed sequence
51use warnings;
52use charnames ":alias" => ":full";
53"Here: \N{e_ACUTE}!\n";
54EXPECT
55OPTIONS regex
56:alias cannot use existing pragma :full \(reversed order\?\) at
57########
58# NAME alias with hashref but no :full
59use warnings;
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########
66# NAME alias with hashref but with :short
67use warnings;
68no warnings 'void';
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########
75# NAME alias with hashref to :full OK
76use warnings;
77no warnings 'void';
78use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
79"Here: \N{e_ACUTE}!\n";
80EXPECT
81OPTIONS regex
82$
83########
84# NAME alias with hashref to :loose OK
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########
93# NAME alias with :loose requires :full type name
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########
102# NAME alias with hashref to :short but using :full
103use warnings;
104no warnings 'void';
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########
111# NAME alias with hashref to :short OK
112use warnings;
113no warnings 'void';
114use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" };
115"Here: \N{e_ACUTE}!\n";
116EXPECT
117OPTIONS regex
118$
119########
120# NAME alias with bad hashref
121use warnings;
122no warnings 'void';
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########
129# NAME alias with arrayref
130use warnings;
131no warnings 'void';
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########
138# NAME alias with bad hashref
139no warnings;
140use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE", "a_ACUTE" };
141"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
142EXPECT
143OPTIONS regex
144Unknown charname 'a_ACUTE' at
145########
146# NAME alias with hashref two aliases
147use warnings;
148no warnings 'void';
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########
158# NAME alias with hashref two aliases
159use warnings;
160no warnings 'void';
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########
170# NAME alias with hashref using mixed aliases
171use warnings;
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########
181# NAME alias with hashref using mixed aliases
182use warnings;
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########
192# NAME alias with hashref using mixed aliases
193use warnings;
194no warnings 'void';
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########
204# NAME alias with nonexisting file
205use warnings;
206no warnings 'void';
207use charnames ":full", ":alias" => "non_existing_xyzzy";
208"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
209EXPECT
210OPTIONS regex
211unicore/non_existing_xyzzy_alias.pl cannot be used as alias file for charnames at
212########
213# NAME alias with bad file name
214use warnings;
215no warnings 'void';
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########
222# NAME alias with non_absolute (existing) file name (which it should /not/ use)
223use warnings;
224no warnings 'void';
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
232--FILE-- ../../lib/unicore/xyzzy_alias.pl
233#!perl
2340;
235--FILE--
236use warnings;
237no warnings 'void';
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
245--FILE-- ../../lib/unicore/xyzzy_alias.pl
246#!perl
247();
248--FILE--
249use warnings;
250no warnings 'void';
251use charnames ":full", ":alias" => "xyzzy";
252"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
253EXPECT
254OPTIONS regex
255Unknown charname 'e_ACUTE' at
256########
257# alias with file OK but file has :short aliases
258--FILE-- ../../lib/unicore/xyzzy_alias.pl
259#!perl
260(   e_ACUTE => "LATIN:e WITH ACUTE",
261    a_ACUTE => "LATIN:a WITH ACUTE",
262    );
263--FILE--
264use warnings;
265no warnings 'void';
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
273--FILE-- ../../lib/unicore/xyzzy_alias.pl
274#!perl
275(   e_ACUTE => "LATIN:e WITH ACUTE",
276    a_ACUTE => "LATIN:a WITH ACUTE",
277    );
278--FILE--
279use warnings;
280no warnings 'void';
281use charnames ":short", ":alias" => "xyzzy";
282"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
283EXPECT
284OPTIONS regex
285$
286########
287# alias with :short and file OK has :long aliases
288--FILE-- ../../lib/unicore/xyzzy_alias.pl
289#!perl
290(   e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
291    a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
292    );
293--FILE--
294use warnings;
295no warnings 'void';
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########
302# alias with file implicit :full but file has :short aliases
303--FILE-- ../../lib/unicore/xyzzy_alias.pl
304#!perl
305(   e_ACUTE => "LATIN:e WITH ACUTE",
306    a_ACUTE => "LATIN:a WITH ACUTE",
307    );
308--FILE--
309use warnings;
310no warnings 'void';
311use charnames ":alias" => ":xyzzy";
312"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
313EXPECT
314OPTIONS regex
315Unknown charname 'LATIN:e WITH ACUTE' at
316########
317# alias with file implicit :full and file has :long aliases
318--FILE-- ../../lib/unicore/xyzzy_alias.pl
319#!perl
320(   e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
321    a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
322    );
323--FILE--
324use warnings;
325no warnings 'void';
326use charnames ":alias" => ":xyzzy";
327"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
328EXPECT
329OPTIONS regex
330$
331########
332# NAME charnames with no import still works for runtime functions
333use warnings;
334no warnings 'void';
335use charnames ();
336charnames::vianame('SPACE');
337charnames::viacode(0x41);
338EXPECT
339OPTIONS regex
340$
341########
342# NAME no extraneous warning [perl #11560]
343use warnings;
344use charnames ();
345print charnames::viacode(0x80), "\n";
346EXPECT
347OPTIONS regex
348PADDING CHARACTER
349