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