This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
charnames: Change so :short syntax can have spaces
[perl5.git] / t / lib / charnames / alias
CommitLineData
ea065648
NC
1Tests 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
5use charnames ":scoobydoo";
6"Here: \N{e_ACUTE}!\n";
7EXPECT
8OPTIONS regex
9unsupported special ':scoobydoo' in charnames at
10########
11# wrong type of alias (missing colon)
12use charnames "alias";
13"Here: \N{e_ACUTE}!\n";
14EXPECT
15OPTIONS regex
16Unknown charname 'e_ACUTE' at
17########
18# alias without an argument
19use charnames ":alias";
20"Here: \N{e_ACUTE}!\n";
21EXPECT
22OPTIONS regex
23:alias needs an argument in charnames at
24########
25# reversed sequence
26use charnames ":alias" => ":full";
27"Here: \N{e_ACUTE}!\n";
28EXPECT
29OPTIONS regex
30:alias cannot use existing pragma :full \(reversed order\?\) at
31########
32# alias with hashref but no :full
33use charnames ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
34"Here: \N{e_ACUTE}!\n";
35EXPECT
36OPTIONS regex
37Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
38########
39# alias with hashref but with :short
40use charnames ":short", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
41"Here: \N{e_ACUTE}!\n";
42EXPECT
43OPTIONS regex
44Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
45########
46# alias with hashref to :full OK
47use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" };
48"Here: \N{e_ACUTE}!\n";
49EXPECT
50OPTIONS regex
51$
52########
53# alias with hashref to :short but using :full
54use charnames ":full", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" };
55"Here: \N{e_ACUTE}!\n";
56EXPECT
57OPTIONS regex
58Unknown charname 'LATIN:e WITH ACUTE' at
59########
60# alias with hashref to :short OK
61use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" };
62"Here: \N{e_ACUTE}!\n";
63EXPECT
64OPTIONS regex
65$
66########
67# alias with bad hashref
68use charnames ":short", ":alias" => "e_ACUTE";
69"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
70EXPECT
71OPTIONS regex
72unicore/e_ACUTE_alias.pl cannot be used as alias file for charnames at
73########
74# alias with arrayref
75use charnames ":short", ":alias" => [ e_ACUTE => "LATIN:e WITH ACUTE" ];
76"Here: \N{e_ACUTE}!\n";
77EXPECT
78OPTIONS regex
79Only HASH reference supported as argument to :alias at
80########
81# alias with bad hashref
82use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE", "a_ACUTE" };
83"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
84EXPECT
85OPTIONS regex
84374e30 86Unknown charname 'a_ACUTE' at
ea065648
NC
87########
88# alias with hashref two aliases
89use charnames ":short", ":alias" => {
90 e_ACUTE => "LATIN:e WITH ACUTE",
91 a_ACUTE => "",
92 };
93"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
94EXPECT
95OPTIONS regex
96Unknown charname '' at
97########
98# alias with hashref two aliases
99use charnames ":short", ":alias" => {
100 e_ACUTE => "LATIN:e WITH ACUTE",
101 a_ACUTE => "LATIN:a WITH ACUTE",
102 };
103"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
104EXPECT
105OPTIONS regex
106$
107########
108# alias with hashref using mixed aliasses
109use charnames ":short", ":alias" => {
110 e_ACUTE => "LATIN:e WITH ACUTE",
111 a_ACUTE => "LATIN SMALL LETTER A WITH ACUT",
112 };
113"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
114EXPECT
115OPTIONS regex
116Unknown charname 'LATIN SMALL LETTER A WITH ACUT' at
117########
118# alias with hashref using mixed aliasses
119use charnames ":short", ":alias" => {
120 e_ACUTE => "LATIN:e WITH ACUTE",
121 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
122 };
123"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
124EXPECT
125OPTIONS regex
126Unknown charname 'LATIN SMALL LETTER A WITH ACUTE' at
127########
128# alias with hashref using mixed aliasses
129use charnames ":full", ":alias" => {
130 e_ACUTE => "LATIN:e WITH ACUTE",
131 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
132 };
133"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
134EXPECT
135OPTIONS regex
136Unknown charname 'LATIN:e WITH ACUTE' at
137########
138# alias with nonexisting file
139use charnames ":full", ":alias" => "xyzzy";
140"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
141EXPECT
142OPTIONS regex
143unicore/xyzzy_alias.pl cannot be used as alias file for charnames at
144########
145# alias with bad file name
146use charnames ":full", ":alias" => "xy 7-";
147"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
148EXPECT
149OPTIONS regex
150Charnames alias files can only have identifier characters at
151########
152# alias with non_absolute (existing) file name (which it should /not/ use)
153use charnames ":full", ":alias" => "perl";
154"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
155EXPECT
156OPTIONS regex
157unicore/perl_alias.pl cannot be used as alias file for charnames at
158########
159# alias with bad file
160--FILE-- ../lib/unicore/xyzzy_alias.pl
161#!perl
1620;
163--FILE--
164use charnames ":full", ":alias" => "xyzzy";
165"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
166EXPECT
167OPTIONS regex
168unicore/xyzzy_alias.pl did not return a \(valid\) list of alias pairs at
169########
170# alias with file with empty list
171--FILE-- ../lib/unicore/xyzzy_alias.pl
172#!perl
173();
174--FILE--
175use charnames ":full", ":alias" => "xyzzy";
176"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
177EXPECT
178OPTIONS regex
179Unknown charname 'e_ACUTE' at
180########
181# alias with file OK but file has :short aliasses
182--FILE-- ../lib/unicore/xyzzy_alias.pl
183#!perl
184( e_ACUTE => "LATIN:e WITH ACUTE",
185 a_ACUTE => "LATIN:a WITH ACUTE",
186 );
187--FILE--
188use charnames ":full", ":alias" => "xyzzy";
189"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
190EXPECT
191OPTIONS regex
192Unknown charname 'LATIN:e WITH ACUTE' at
193########
194# alias with :short and file OK
195--FILE-- ../lib/unicore/xyzzy_alias.pl
196#!perl
197( e_ACUTE => "LATIN:e WITH ACUTE",
198 a_ACUTE => "LATIN:a WITH ACUTE",
199 );
200--FILE--
201use charnames ":short", ":alias" => "xyzzy";
202"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
203EXPECT
204OPTIONS regex
205$
206########
207# alias with :short and file OK has :long aliasses
208--FILE-- ../lib/unicore/xyzzy_alias.pl
209#!perl
210( e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
211 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
212 );
213--FILE--
214use charnames ":short", ":alias" => "xyzzy";
215"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
216EXPECT
217OPTIONS regex
218Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at
219########
220# alias with file implicit :full but file has :short aliasses
221--FILE-- ../lib/unicore/xyzzy_alias.pl
222#!perl
223( e_ACUTE => "LATIN:e WITH ACUTE",
224 a_ACUTE => "LATIN:a WITH ACUTE",
225 );
226--FILE--
227use charnames ":alias" => ":xyzzy";
228"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
229EXPECT
230OPTIONS regex
231Unknown charname 'LATIN:e WITH ACUTE' at
232########
233# alias with file implicit :full and file has :long aliasses
234--FILE-- ../lib/unicore/xyzzy_alias.pl
235#!perl
236( e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
237 a_ACUTE => "LATIN SMALL LETTER A WITH ACUTE",
238 );
239--FILE--
240use charnames ":alias" => ":xyzzy";
241"Here: \N{e_ACUTE}\N{a_ACUTE}!\n";
242EXPECT
243OPTIONS regex
244$