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