Commit | Line | Data |
---|---|---|
ea065648 NC |
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 charnames ":scoobydoo"; | |
6 | "Here: \N{e_ACUTE}!\n"; | |
7 | EXPECT | |
8 | OPTIONS regex | |
9 | unsupported special ':scoobydoo' in charnames at | |
10 | ######## | |
11 | # wrong type of alias (missing colon) | |
12 | use charnames "alias"; | |
13 | "Here: \N{e_ACUTE}!\n"; | |
14 | EXPECT | |
15 | OPTIONS regex | |
16 | Unknown charname 'e_ACUTE' at | |
17 | ######## | |
18 | # alias without an argument | |
19 | use charnames ":alias"; | |
20 | "Here: \N{e_ACUTE}!\n"; | |
21 | EXPECT | |
22 | OPTIONS regex | |
23 | :alias needs an argument in charnames at | |
24 | ######## | |
25 | # reversed sequence | |
26 | use charnames ":alias" => ":full"; | |
27 | "Here: \N{e_ACUTE}!\n"; | |
28 | EXPECT | |
29 | OPTIONS regex | |
30 | :alias cannot use existing pragma :full \(reversed order\?\) at | |
31 | ######## | |
32 | # alias with hashref but no :full | |
33 | use charnames ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" }; | |
34 | "Here: \N{e_ACUTE}!\n"; | |
35 | EXPECT | |
36 | OPTIONS regex | |
37 | Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at | |
38 | ######## | |
39 | # alias with hashref but with :short | |
40 | use charnames ":short", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" }; | |
41 | "Here: \N{e_ACUTE}!\n"; | |
42 | EXPECT | |
43 | OPTIONS regex | |
44 | Unknown charname 'LATIN SMALL LETTER E WITH ACUTE' at | |
45 | ######## | |
46 | # alias with hashref to :full OK | |
47 | use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" }; | |
48 | "Here: \N{e_ACUTE}!\n"; | |
49 | EXPECT | |
50 | OPTIONS regex | |
51 | $ | |
52 | ######## | |
53 | # alias with hashref to :short but using :full | |
54 | use charnames ":full", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" }; | |
55 | "Here: \N{e_ACUTE}!\n"; | |
56 | EXPECT | |
57 | OPTIONS regex | |
58 | Unknown charname 'LATIN:e WITH ACUTE' at | |
59 | ######## | |
60 | # alias with hashref to :short OK | |
61 | use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" }; | |
62 | "Here: \N{e_ACUTE}!\n"; | |
63 | EXPECT | |
64 | OPTIONS regex | |
65 | $ | |
66 | ######## | |
67 | # alias with bad hashref | |
68 | use charnames ":short", ":alias" => "e_ACUTE"; | |
69 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
70 | EXPECT | |
71 | OPTIONS regex | |
72 | unicore/e_ACUTE_alias.pl cannot be used as alias file for charnames at | |
73 | ######## | |
74 | # alias with arrayref | |
75 | use charnames ":short", ":alias" => [ e_ACUTE => "LATIN:e WITH ACUTE" ]; | |
76 | "Here: \N{e_ACUTE}!\n"; | |
77 | EXPECT | |
78 | OPTIONS regex | |
79 | Only HASH reference supported as argument to :alias at | |
80 | ######## | |
81 | # alias with bad hashref | |
82 | use charnames ":short", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE", "a_ACUTE" }; | |
83 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
84 | EXPECT | |
85 | OPTIONS regex | |
84374e30 | 86 | Unknown charname 'a_ACUTE' at |
ea065648 NC |
87 | ######## |
88 | # alias with hashref two aliases | |
89 | use charnames ":short", ":alias" => { | |
90 | e_ACUTE => "LATIN:e WITH ACUTE", | |
91 | a_ACUTE => "", | |
92 | }; | |
93 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
94 | EXPECT | |
95 | OPTIONS regex | |
96 | Unknown charname '' at | |
97 | ######## | |
98 | # alias with hashref two aliases | |
99 | use 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"; | |
104 | EXPECT | |
105 | OPTIONS regex | |
106 | $ | |
107 | ######## | |
108 | # alias with hashref using mixed aliasses | |
109 | use 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"; | |
114 | EXPECT | |
115 | OPTIONS regex | |
116 | Unknown charname 'LATIN SMALL LETTER A WITH ACUT' at | |
117 | ######## | |
118 | # alias with hashref using mixed aliasses | |
119 | use 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"; | |
124 | EXPECT | |
125 | OPTIONS regex | |
126 | Unknown charname 'LATIN SMALL LETTER A WITH ACUTE' at | |
127 | ######## | |
128 | # alias with hashref using mixed aliasses | |
129 | use 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"; | |
134 | EXPECT | |
135 | OPTIONS regex | |
136 | Unknown charname 'LATIN:e WITH ACUTE' at | |
137 | ######## | |
138 | # alias with nonexisting file | |
139 | use charnames ":full", ":alias" => "xyzzy"; | |
140 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
141 | EXPECT | |
142 | OPTIONS regex | |
143 | unicore/xyzzy_alias.pl cannot be used as alias file for charnames at | |
144 | ######## | |
145 | # alias with bad file name | |
146 | use charnames ":full", ":alias" => "xy 7-"; | |
147 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
148 | EXPECT | |
149 | OPTIONS regex | |
150 | Charnames alias files can only have identifier characters at | |
151 | ######## | |
152 | # alias with non_absolute (existing) file name (which it should /not/ use) | |
153 | use charnames ":full", ":alias" => "perl"; | |
154 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
155 | EXPECT | |
156 | OPTIONS regex | |
157 | unicore/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 | |
162 | 0; | |
163 | --FILE-- | |
164 | use charnames ":full", ":alias" => "xyzzy"; | |
165 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
166 | EXPECT | |
167 | OPTIONS regex | |
168 | unicore/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-- | |
175 | use charnames ":full", ":alias" => "xyzzy"; | |
176 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
177 | EXPECT | |
178 | OPTIONS regex | |
179 | Unknown 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-- | |
188 | use charnames ":full", ":alias" => "xyzzy"; | |
189 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
190 | EXPECT | |
191 | OPTIONS regex | |
192 | Unknown 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-- | |
201 | use charnames ":short", ":alias" => "xyzzy"; | |
202 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
203 | EXPECT | |
204 | OPTIONS 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-- | |
214 | use charnames ":short", ":alias" => "xyzzy"; | |
215 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
216 | EXPECT | |
217 | OPTIONS regex | |
218 | Unknown 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-- | |
227 | use charnames ":alias" => ":xyzzy"; | |
228 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
229 | EXPECT | |
230 | OPTIONS regex | |
231 | Unknown 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-- | |
240 | use charnames ":alias" => ":xyzzy"; | |
241 | "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; | |
242 | EXPECT | |
243 | OPTIONS regex | |
244 | $ |