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