5 |
## ISSUE: Message::URI::URIReference module. |
## ISSUE: Message::URI::URIReference module. |
6 |
|
|
7 |
use Test; |
use Test; |
8 |
BEGIN { plan tests => 49 } |
BEGIN { plan tests => 81 } |
9 |
|
|
10 |
my $Cases = [ |
my $Cases = [ |
11 |
{ |
{ |
89 |
}, |
}, |
90 |
{ |
{ |
91 |
data => q<HTTP://example/>, |
data => q<HTTP://example/>, |
92 |
errors => ['s:1:uppercase scheme name'], |
errors => ['s::uppercase scheme name'], |
93 |
}, |
}, |
94 |
{ |
{ |
95 |
data => q<Http://example/>, |
data => q<Http://example/>, |
96 |
errors => ['s:1:uppercase scheme name'], |
errors => ['s::uppercase scheme name'], |
97 |
}, |
}, |
98 |
{ |
{ |
99 |
data => q<datA:,>, |
data => q<datA:,>, |
100 |
errors => ['s:1:uppercase scheme name'], |
errors => ['s::uppercase scheme name'], |
101 |
}, |
}, |
102 |
{ |
{ |
103 |
data => q<dat%41:,>, |
data => q<dat%41:,>, |
104 |
errors => ['m::syntax error', |
errors => ['m::syntax error', |
105 |
|
's::uppercase scheme name', |
106 |
's:4:percent-encoded unreserved'], |
's:4:percent-encoded unreserved'], |
107 |
}, |
}, |
108 |
{ |
{ |
109 |
data => q<g%5A:,>, |
data => q<g%5A:,>, |
110 |
errors => ['m::syntax error', |
errors => ['m::syntax error', |
111 |
|
's::uppercase scheme name', |
112 |
's:2:percent-encoded unreserved'], |
's:2:percent-encoded unreserved'], |
113 |
}, |
}, |
114 |
{ |
{ |
153 |
errors => ['w::address format not supported:v0'], |
errors => ['w::address format not supported:v0'], |
154 |
}, |
}, |
155 |
{ |
{ |
156 |
|
data => q<http://user@[V0A.aaa]/>, |
157 |
|
errors => ['w::address format not supported:V0A', |
158 |
|
's::uppercase host'], |
159 |
|
}, |
160 |
|
{ |
161 |
data => q<http://127.0.0.1/>, |
data => q<http://127.0.0.1/>, |
162 |
errors => [], |
errors => [], |
163 |
}, |
}, |
221 |
data => q<http://a.b-c.test/>, |
data => q<http://a.b-c.test/>, |
222 |
errors => [], |
errors => [], |
223 |
}, |
}, |
224 |
|
{ |
225 |
|
data => qq<http://\x{123}\x{456}.test/>, |
226 |
|
errors => ['s::non-DNS host'], |
227 |
|
}, |
228 |
|
{ |
229 |
|
data => qq<http://\x{4E00}%80.test/>, |
230 |
|
errors => ['s::non-DNS host', |
231 |
|
'm::non UTF-8 host'], |
232 |
|
}, |
233 |
|
{ |
234 |
|
data => q<http://a.%E3%81%82%E3%81%84.test/>, |
235 |
|
errors => ['s::non-DNS host'], |
236 |
|
}, |
237 |
|
{ |
238 |
|
data => q<example://a/b/c/%7Bfoo%7D>, |
239 |
|
errors => [], |
240 |
|
}, |
241 |
|
{ |
242 |
|
data => q<eXAMPLE://a/./b/../b/%63/%7bfoo%7d>, |
243 |
|
errors => ['s::uppercase scheme name', |
244 |
|
's:22:percent-encoded unreserved', |
245 |
|
's:26:lowercase hexadecimal digit', |
246 |
|
's:32:lowercase hexadecimal digit', |
247 |
|
's::dot-segment'], |
248 |
|
}, |
249 |
|
{ |
250 |
|
data => q<example://a/.htaccess>, |
251 |
|
errors => [], |
252 |
|
}, |
253 |
|
{ |
254 |
|
data => q<example://a/.>, |
255 |
|
errors => ['s::dot-segment'], |
256 |
|
}, |
257 |
|
{ |
258 |
|
data => q<http://example.com>, |
259 |
|
errors => ['s::empty path'], |
260 |
|
}, |
261 |
|
{ |
262 |
|
data => q<http://example.com/>, |
263 |
|
errors => [], |
264 |
|
}, |
265 |
|
{ |
266 |
|
data => q<http://example.com:/>, |
267 |
|
errors => ['s::empty port'], |
268 |
|
}, |
269 |
|
{ |
270 |
|
data => q<http://example.com:80/>, |
271 |
|
errors => ['s::default port'], |
272 |
|
}, |
273 |
|
{ |
274 |
|
data => q<hTTP://example.com:80/>, |
275 |
|
errors => ['s::uppercase scheme name', |
276 |
|
's::default port'], |
277 |
|
}, |
278 |
|
{ |
279 |
|
data => q<%68ttp://example.com:80/>, |
280 |
|
errors => ['m::syntax error', |
281 |
|
's:1:percent-encoded unreserved', |
282 |
|
's::default port'], |
283 |
|
}, |
284 |
|
{ |
285 |
|
data => q<file://user@/>, |
286 |
|
errors => ['s::empty host'], |
287 |
|
}, |
288 |
|
{ |
289 |
|
data => q<http://example.com/?>, |
290 |
|
errors => [], |
291 |
|
}, |
292 |
|
{ |
293 |
|
data => q<mailto:Joe@Example.COM>, |
294 |
|
errors => [], |
295 |
|
}, |
296 |
|
{ |
297 |
|
data => q<mailto:Joe@example.com>, |
298 |
|
errors => [], |
299 |
|
}, |
300 |
|
{ |
301 |
|
data => q<http://example.com/data>, |
302 |
|
errors => [], |
303 |
|
}, |
304 |
|
{ |
305 |
|
data => q<ftp://cnn.example.com&story=breaking_news@10.0.0.1/top_story.htm>, |
306 |
|
errors => [], |
307 |
|
}, |
308 |
|
{ |
309 |
|
data => qq<http://r\xE9sum\xE9.example.org>, |
310 |
|
errors => ['s::non-DNS host', |
311 |
|
's::empty path'], |
312 |
|
}, |
313 |
|
{ |
314 |
|
data => qq<http://validator.w3.org/check?uri=http%3A%2F%2Fr\xE9;sum\xE9.example.com>, |
315 |
|
errors => [], |
316 |
|
}, |
317 |
|
{ |
318 |
|
data => q<http://validator.w3.org/check?uri=http%3A%2F%2Fr%C3%A9sum%C3%A9.example.com>, |
319 |
|
errors => [], |
320 |
|
}, |
321 |
|
{ |
322 |
|
data => qq<http://example.com/\x{10300}\x{10301}\x{10302}>, |
323 |
|
errors => [], |
324 |
|
}, |
325 |
|
{ |
326 |
|
data => q<http://example.com/%F0%90%8C%80%F0%90%8C%81%F0%90%8C%82>, |
327 |
|
errors => [], |
328 |
|
}, |
329 |
|
{ |
330 |
|
data => q<http://www.example.org/r%E9sum%E9.html>, |
331 |
|
errors => [], |
332 |
|
}, |
333 |
|
{ |
334 |
|
data => q<http://xn--99zt52a.example.org/%e2%80%ae>, |
335 |
|
errors => ['s:32:lowercase hexadecimal digit', |
336 |
|
's:38:lowercase hexadecimal digit'], |
337 |
|
}, |
338 |
|
{ |
339 |
|
data => qq<example://a/b/c/%7Bfoo%7D/ros\xE9>, |
340 |
|
errors => [], |
341 |
|
}, |
342 |
|
{ |
343 |
|
data => qq<eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9>, |
344 |
|
errors => ['s::uppercase scheme name', |
345 |
|
's:22:percent-encoded unreserved', |
346 |
|
's:26:lowercase hexadecimal digit', |
347 |
|
's:32:lowercase hexadecimal digit', |
348 |
|
's::dot-segment'], |
349 |
|
}, |
350 |
|
{ |
351 |
|
data => qq<http://www.example.org/r\xE9sum\xE9.html>, |
352 |
|
errors => [], |
353 |
|
}, |
354 |
|
{ |
355 |
|
data => qq<http://www.example.org/re\x{301}sume\x{301}.html>, |
356 |
|
errors => [], ## TODO: not in NFC |
357 |
|
}, |
358 |
|
{ |
359 |
|
data => q<http://www.example.org/r%E9sum%E9.xml#r%C3%A9sum%C3%A9>, |
360 |
|
errors => [], |
361 |
|
}, |
362 |
]; |
]; |
363 |
|
|
364 |
require Whatpm::URIChecker; |
require Whatpm::URIChecker; |