/[suikacvs]/markup/html/whatpm/t/URIChecker.t
Suika

Diff of /markup/html/whatpm/t/URIChecker.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by wakaba, Sat Jun 30 13:12:33 2007 UTC revision 1.4 by wakaba, Sat Aug 30 04:31:57 2008 UTC
# Line 22  my $Cases = [ Line 22  my $Cases = [
22    },    },
23    {    {
24      data => q<%7Fabc:efg>,      data => q<%7Fabc:efg>,
25      errors => ['m::syntax error'],      errors => ['m::syntax error:iriref3987'],
26    },    },
27    {    {
28      data => q<http://test/[53::0]>,      data => q<http://test/[53::0]>,
29      errors => ['m::syntax error'],      errors => ['m::syntax error:iriref3987'],
30    },    },
31    {    {
32      data => q<100%!>,      data => q<100%!>,
33      errors => ['m::syntax error'],      errors => ['m::syntax error:iriref3987'],
34    },    },
35    {    {
36      data => q<%a2>,      data => q<%a2>,
37      errors => ['s:1:lowercase hexadecimal digit'],      errors => ['w:1:URL:lowercase hexadecimal digit'],
38    },    },
39    {    {
40      data => q<%a2?>,      data => q<%a2?>,
41      errors => ['s:1:lowercase hexadecimal digit'],      errors => ['w:1:URL:lowercase hexadecimal digit'],
42    },    },
43    {    {
44      data => q<?%a2>,      data => q<?%a2>,
45      errors => ['s:2:lowercase hexadecimal digit'],      errors => ['w:2:URL:lowercase hexadecimal digit'],
46    },    },
47    {    {
48      data => q<%a2%1b>,      data => q<%a2%1b>,
49      errors => ['s:1:lowercase hexadecimal digit',      errors => ['w:1:URL:lowercase hexadecimal digit',
50                 's:4:lowercase hexadecimal digit'],                 'w:4:URL:lowercase hexadecimal digit'],
51    },    },
52    {    {
53      data => q<http://%5b/>,      data => q<http://%5b/>,
54      errors => ['s:8:lowercase hexadecimal digit',      errors => ['w:8:URL:lowercase hexadecimal digit',
55                 's::non-DNS host'],                 'w::URL:non-DNS host'],
56    },    },
57    {    {
58      data => q<http://%5b/%25a/bv/%cc>,      data => q<http://%5b/%25a/bv/%cc>,
59      errors => ['s:8:lowercase hexadecimal digit',      errors => ['w:8:URL:lowercase hexadecimal digit',
60                 's:20:lowercase hexadecimal digit',                 'w:20:URL:lowercase hexadecimal digit',
61                 's::non-DNS host'],                 'w::URL:non-DNS host'],
62    },    },
63    {    {
64      data => q<%41>,      data => q<%41>,
65      errors => ['s:1:percent-encoded unreserved'],      errors => ['w:1:URL:percent-encoded unreserved'],
66    },    },
67    {    {
68      data => q<%41%7E>,      data => q<%41%7E>,
69      errors => ['s:1:percent-encoded unreserved',      errors => ['w:1:URL:percent-encoded unreserved',
70                 's:4:percent-encoded unreserved'],                 'w:4:URL:percent-encoded unreserved'],
71    },    },
72    {    {
73      data => q</%41>,      data => q</%41>,
74      errors => ['s:2:percent-encoded unreserved'],      errors => ['w:2:URL:percent-encoded unreserved'],
75    },    },
76    {    {
77      data => q<http://%5a/>,      data => q<http://%5a/>,
78      errors => ['s:8:lowercase hexadecimal digit',      errors => ['w:8:URL:lowercase hexadecimal digit',
79                 's:8:percent-encoded unreserved'],                 'w:8:URL:percent-encoded unreserved'],
80    },    },
81    {    {
82      data => q<./%2E%2E>,      data => q<./%2E%2E>,
83      errors => ['s:3:percent-encoded unreserved',      errors => ['w:3:URL:percent-encoded unreserved',
84                 's:6:percent-encoded unreserved'],                 'w:6:URL:percent-encoded unreserved'],
85    },    },
86    {    {
87      data => q<http://www.example.com/%7Euser/>,      data => q<http://www.example.com/%7Euser/>,
88      errors => ['s:24:percent-encoded unreserved'],      errors => ['w:24:URL:percent-encoded unreserved'],
89    },    },
90    {    {
91      data => q<HTTP://example/>,      data => q<HTTP://example/>,
92      errors => ['s::uppercase scheme name'],      errors => ['w::URL:uppercase scheme name'],
93    },    },
94    {    {
95      data => q<Http://example/>,      data => q<Http://example/>,
96      errors => ['s::uppercase scheme name'],      errors => ['w::URL:uppercase scheme name'],
97    },    },
98    {    {
99      data => q<datA:,>,      data => q<datA:,>,
100      errors => ['s::uppercase scheme name'],      errors => ['w::URL:uppercase scheme name'],
101    },    },
102    {    {
103      data => q<dat%41:,>,      data => q<dat%41:,>,
104      errors => ['m::syntax error',      errors => ['m::syntax error:iriref3987',
105                 's::uppercase scheme name',                 'w::URL:uppercase scheme name',
106                 's:4:percent-encoded unreserved'],                 'w:4:URL:percent-encoded unreserved'],
107    },    },
108    {    {
109      data => q<g%5A:,>,      data => q<g%5A:,>,
110      errors => ['m::syntax error',      errors => ['m::syntax error:iriref3987',
111                 's::uppercase scheme name',                 'w::URL:uppercase scheme name',
112                 's:2:percent-encoded unreserved'],                 'w:2:URL:percent-encoded unreserved'],
113    },    },
114    {    {
115      data => q<g%7A:,>,      data => q<g%7A:,>,
116      errors => ['m::syntax error',      errors => ['m::syntax error:iriref3987',
117                 's:2:percent-encoded unreserved'],                 'w:2:URL:percent-encoded unreserved'],
118    },    },
119    {    {
120      data => q<http://www.test:2222/>,      data => q<http://www.test:2222/>,
# Line 126  my $Cases = [ Line 126  my $Cases = [
126    },    },
127    {    {
128      data => q<http://www@example:/>,      data => q<http://www@example:/>,
129      errors => ['s::empty port'],      errors => ['w::URL:empty port'],
130    },    },
131    {    {
132      data => q<http://www.test:/>,      data => q<http://www.test:/>,
133      errors => ['s::empty port'],      errors => ['w::URL:empty port'],
134    },    },
135    {    {
136      data => q<http://user:password@example/>,      data => q<http://user:password@example/>,
137      errors => ['s::password'],      errors => ['w::URL:password'],
138    },    },
139    {    {
140      data => q<http://EXAMPLE/>,      data => q<http://EXAMPLE/>,
141      errors => ['s::uppercase host'],      errors => ['w::URL:uppercase host:EXAMPLE'],
142    },    },
143    {    {
144      data => q<http://USER@example/>,      data => q<http://USER@example/>,
# Line 146  my $Cases = [ Line 146  my $Cases = [
146    },    },
147    {    {
148      data => q<http://[v0.aaa]/>,      data => q<http://[v0.aaa]/>,
149      errors => ['unsupported::address format not supported:v0'],      errors => ['u::URL:address format:v0'],
150    },    },
151    {    {
152      data => q<http://user@[v0.aaa]/>,      data => q<http://user@[v0.aaa]/>,
153      errors => ['unsupported::address format not supported:v0'],      errors => ['u::URL:address format:v0'],
154    },    },
155    {    {
156      data => q<http://user@[V0A.aaa]/>,      data => q<http://user@[V0A.aaa]/>,
157      errors => ['unsupported::address format not supported:V0A',      errors => ['u::URL:address format:V0A',
158                 's::uppercase host'],                 'w::URL:uppercase host:[V0A.aaa]'],
159    },    },
160    {    {
161      data => q<http://127.0.0.1/>,      data => q<http://127.0.0.1/>,
# Line 167  my $Cases = [ Line 167  my $Cases = [
167    },    },
168    {    {
169      data => q<http://1234567890123456789012345678901234567890123456789012345678901234.test/>,      data => q<http://1234567890123456789012345678901234567890123456789012345678901234.test/>,
170      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
171    },    },
172    {    {
173      data => q<http://123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123/>,      data => q<http://123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123/>,
# Line 175  my $Cases = [ Line 175  my $Cases = [
175    },    },
176    {    {
177      data => q<http://123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123./>,      data => q<http://123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123.123456789012345678901234567890123456789012345678901234567890123./>,
178      errors => ['s::long host'],      errors => ['w::URL:long host'],
179    },    },
180    {    {
181      data => q<http://a_b.test/>,      data => q<http://a_b.test/>,
182      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
183    },    },
184    {    {
185      data => q<http://%61.test/>,      data => q<http://%61.test/>,
186      errors => ['s:8:percent-encoded unreserved'],      errors => ['w:8:URL:percent-encoded unreserved'],
187    },    },
188    {    {
189      data => q<http://a.test/>,      data => q<http://a.test/>,
# Line 203  my $Cases = [ Line 203  my $Cases = [
203    },    },
204    {    {
205      data => q<http://a-.test/>,      data => q<http://a-.test/>,
206      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
207    },    },
208    {    {
209      data => q<http://-a.test/>,      data => q<http://-a.test/>,
210      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
211    },    },
212    {    {
213      data => q<http://a.b.test/>,      data => q<http://a.b.test/>,
# Line 223  my $Cases = [ Line 223  my $Cases = [
223    },    },
224    {    {
225      data => qq<http://\x{123}\x{456}.test/>,      data => qq<http://\x{123}\x{456}.test/>,
226      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
227    },    },
228    {    {
229      data => qq<http://\x{4E00}%80.test/>,      data => qq<http://\x{4E00}%80.test/>,
230      errors => ['s::non-DNS host',      errors => ['w::URL:non-DNS host',
231                 'm::non UTF-8 host'],                 'm::URL:non UTF-8 host'],
232    },    },
233    {    {
234      data => q<http://a.%E3%81%82%E3%81%84.test/>,      data => q<http://a.%E3%81%82%E3%81%84.test/>,
235      errors => ['s::non-DNS host'],      errors => ['w::URL:non-DNS host'],
236    },    },
237    {    {
238      data => q<example://a/b/c/%7Bfoo%7D>,      data => q<example://a/b/c/%7Bfoo%7D>,
# Line 240  my $Cases = [ Line 240  my $Cases = [
240    },    },
241    {    {
242      data => q<eXAMPLE://a/./b/../b/%63/%7bfoo%7d>,      data => q<eXAMPLE://a/./b/../b/%63/%7bfoo%7d>,
243      errors => ['s::uppercase scheme name',      errors => ['w::URL:uppercase scheme name',
244                 's:22:percent-encoded unreserved',                 'w:22:URL:percent-encoded unreserved',
245                 's:26:lowercase hexadecimal digit',                 'w:26:URL:lowercase hexadecimal digit',
246                 's:32:lowercase hexadecimal digit',                 'w:32:URL:lowercase hexadecimal digit',
247                 's::dot-segment'],                 'w::URL:dot-segment'],
248    },    },
249    {    {
250      data => q<example://a/.htaccess>,      data => q<example://a/.htaccess>,
# Line 252  my $Cases = [ Line 252  my $Cases = [
252    },    },
253    {    {
254      data => q<example://a/.>,      data => q<example://a/.>,
255      errors => ['s::dot-segment'],      errors => ['w::URL:dot-segment'],
256    },    },
257    {    {
258      data => q<http://example.com>,      data => q<http://example.com>,
259      errors => ['s::empty path'],      errors => ['w::URL:empty path'],
260    },    },
261    {    {
262      data => q<http://example.com/>,      data => q<http://example.com/>,
# Line 264  my $Cases = [ Line 264  my $Cases = [
264    },    },
265    {    {
266      data => q<http://example.com:/>,      data => q<http://example.com:/>,
267      errors => ['s::empty port'],      errors => ['w::URL:empty port'],
268    },    },
269    {    {
270      data => q<http://example.com:80/>,      data => q<http://example.com:80/>,
271      errors => ['s::default port'],      errors => ['w::URL:default port'],
272    },    },
273    {    {
274      data => q<hTTP://example.com:80/>,      data => q<hTTP://example.com:80/>,
275      errors => ['s::uppercase scheme name',      errors => ['w::URL:uppercase scheme name',
276                 's::default port'],                 'w::URL:default port'],
277    },    },
278    {    {
279      data => q<%68ttp://example.com:80/>,      data => q<%68ttp://example.com:80/>,
280      errors => ['m::syntax error',      errors => ['m::syntax error:iriref3987',
281                 's:1:percent-encoded unreserved',                 'w:1:URL:percent-encoded unreserved',
282                 's::default port'],                 'w::URL:default port'],
283    },    },
284    {    {
285      data => q<file://user@/>,      data => q<file://user@/>,
286      errors => ['s::empty host'],      errors => ['w::URL:empty host'],
287    },    },
288    {    {
289      data => q<http://example.com/?>,      data => q<http://example.com/?>,
# Line 307  my $Cases = [ Line 307  my $Cases = [
307    },    },
308    {    {
309      data => qq<http://r\xE9sum\xE9.example.org>,      data => qq<http://r\xE9sum\xE9.example.org>,
310      errors => ['s::non-DNS host',      errors => ['w::URL:non-DNS host',
311                 's::empty path'],                 'w::URL:empty path'],
312    },    },
313    {    {
314      data => qq<http://validator.w3.org/check?uri=http%3A%2F%2Fr\xE9;sum\xE9.example.com>,      data => qq<http://validator.w3.org/check?uri=http%3A%2F%2Fr\xE9;sum\xE9.example.com>,
# Line 332  my $Cases = [ Line 332  my $Cases = [
332    },    },
333    {    {
334      data => q<http://xn--99zt52a.example.org/%e2%80%ae>,      data => q<http://xn--99zt52a.example.org/%e2%80%ae>,
335      errors => ['s:32:lowercase hexadecimal digit',      errors => ['w:32:URL:lowercase hexadecimal digit',
336                 's:38:lowercase hexadecimal digit'],                 'w:38:URL:lowercase hexadecimal digit'],
337    },    },
338    {    {
339      data => qq<example://a/b/c/%7Bfoo%7D/ros\xE9>,      data => qq<example://a/b/c/%7Bfoo%7D/ros\xE9>,
# Line 341  my $Cases = [ Line 341  my $Cases = [
341    },    },
342    {    {
343      data => qq<eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9>,      data => qq<eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9>,
344      errors => ['s::uppercase scheme name',      errors => ['w::URL:uppercase scheme name',
345                 's:22:percent-encoded unreserved',                 'w:22:URL:percent-encoded unreserved',
346                 's:26:lowercase hexadecimal digit',                 'w:26:URL:lowercase hexadecimal digit',
347                 's:32:lowercase hexadecimal digit',                 'w:32:URL:lowercase hexadecimal digit',
348                 's::dot-segment'],                 'w::URL:dot-segment'],
349    },    },
350    {    {
351      data => qq<http://www.example.org/r\xE9sum\xE9.html>,      data => qq<http://www.example.org/r\xE9sum\xE9.html>,
# Line 370  for my $test (@$Cases) { Line 370  for my $test (@$Cases) {
370      my %opt = @_;      my %opt = @_;
371      push @errors, $opt{level} . ':' .      push @errors, $opt{level} . ':' .
372          (defined $opt{position} ? $opt{position} : '') . ':' .          (defined $opt{position} ? $opt{position} : '') . ':' .
373          $opt{type};          $opt{type} .
374            (defined $opt{value} ? ':' . $opt{value} : '');
375    });    });
376    @errors = sort {$a cmp $b} @errors;    @errors = sort {$a cmp $b} @errors;
377    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24