Debian Codegraph @

share/tests/draft7/optional/format/hostname.json

raw
1 [
2 {
3 "description": "validation of host names",
4 "schema": { "format": "hostname" },
5 "tests": [
6 {
7 "description": "all string formats ignore integers",
8 "data": 12,
9 "valid": true
10 },
11 {
12 "description": "all string formats ignore floats",
13 "data": 13.7,
14 "valid": true
15 },
16 {
17 "description": "all string formats ignore objects",
18 "data": {},
19 "valid": true
20 },
21 {
22 "description": "all string formats ignore arrays",
23 "data": [],
24 "valid": true
25 },
26 {
27 "description": "all string formats ignore booleans",
28 "data": false,
29 "valid": true
30 },
31 {
32 "description": "all string formats ignore nulls",
33 "data": null,
34 "valid": true
35 },
36 {
37 "description": "a valid host name",
38 "data": "www.example.com",
39 "valid": true
40 },
41 {
42 "description": "single label",
43 "data": "hostname",
44 "valid": true
45 },
46 {
47 "description": "single label with digits",
48 "data": "h0stn4me",
49 "valid": true
50 },
51 {
52 "description": "single label starting with digit",
53 "data": "1host",
54 "valid": true
55 },
56 {
57 "description": "single label ending with digit",
58 "data": "hostnam3",
59 "valid": true
60 },
61 {
62 "description": "empty string",
63 "data": "",
64 "valid": false
65 },
66 {
67 "description": "single dot",
68 "data": ".",
69 "valid": false
70 },
71 {
72 "description": "leading dot",
73 "data": ".example",
74 "valid": false
75 },
76 {
77 "description": "trailing dot",
78 "data": "example.",
79 "valid": false
80 },
81 {
82 "description": "IDN label separator",
83 "data": "example\uff0ecom",
84 "valid": false
85 },
86 {
87 "description": "single label with hyphen",
88 "data": "host-name",
89 "valid": true
90 },
91 {
92 "description": "starts with hyphen",
93 "data": "-hostname",
94 "valid": false
95 },
96 {
97 "description": "ends with hyphen",
98 "data": "hostname-",
99 "valid": false
100 },
101 {
102 "description": "contains underscore",
103 "data": "host_name",
104 "valid": false
105 },
106 {
107 "description": "exceeds maximum overall length (256)",
108 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
109 "valid": false
110 },
111 {
112 "description": "maximum label length (63)",
113 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
114 "valid": true
115 },
116 {
117 "description": "exceeds maximum label length (63)",
118 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
119 "valid": false
120 },
121 {
122 "description": "trailing newline is invalid",
123 "data": "example.com\n",
124 "valid": false
125 },
126 {
127 "description": "invalid non-ASCII KELVIN SIGN (U+212A)",
128 "data": "\u212Aelvin.example.com",
129 "valid": false
130 },
131 {
132 "description": "consecutive hyphens inside a label",
133 "data": "a--b.com",
134 "valid": true
135 }
136 ]
137 },
138 {
139 "description": "validation of A-label (punycode) host names",
140 "schema": { "format": "hostname" },
141 "tests": [
142 {
143 "description": "invalid Punycode",
144 "comment": "https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
145 "data": "xn--X",
146 "valid": false
147 },
148 {
149 "description": "a valid host name (example.test in Hangul)",
150 "data": "xn--9n2bp8q.xn--9t4b11yi5a",
151 "valid": true
152 },
153 {
154 "description": "contains illegal char U+302E Hangul single dot tone mark",
155 "data": "xn--07jt112bpxg.xn--9t4b11yi5a",
156 "valid": false
157 },
158 {
159 "description": "Begins with a Spacing Combining Mark",
160 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
161 "data": "xn--hello-txk",
162 "valid": false
163 },
164 {
165 "description": "Begins with a Nonspacing Mark",
166 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
167 "data": "xn--hello-zed",
168 "valid": false
169 },
170 {
171 "description": "Begins with an Enclosing Mark",
172 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
173 "data": "xn--hello-6bf",
174 "valid": false
175 },
176 {
177 "description": "Exceptions that are PVALID, left-to-right chars",
178 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
179 "data": "xn--zca29lwxobi7a",
180 "valid": true
181 },
182 {
183 "description": "Exceptions that are PVALID, right-to-left chars",
184 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
185 "data": "xn--qmbc",
186 "valid": true
187 },
188 {
189 "description": "Exceptions that are DISALLOWED, right-to-left chars",
190 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
191 "data": "xn--chb89f",
192 "valid": false
193 },
194 {
195 "description": "Exceptions that are DISALLOWED, left-to-right chars",
196 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6 Note: The two combining marks (U+302E and U+302F) are in the middle and not at the start",
197 "data": "xn--07jceefgh4c",
198 "valid": false
199 },
200 {
201 "description": "MIDDLE DOT with no preceding 'l'",
202 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
203 "data": "xn--al-0ea",
204 "valid": false
205 },
206 {
207 "description": "MIDDLE DOT with nothing preceding",
208 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
209 "data": "xn--l-fda",
210 "valid": false
211 },
212 {
213 "description": "MIDDLE DOT with no following 'l'",
214 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
215 "data": "xn--la-0ea",
216 "valid": false
217 },
218 {
219 "description": "MIDDLE DOT with nothing following",
220 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
221 "data": "xn--l-gda",
222 "valid": false
223 },
224 {
225 "description": "MIDDLE DOT with surrounding 'l's",
226 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
227 "data": "xn--ll-0ea",
228 "valid": true
229 },
230 {
231 "description": "Greek KERAIA not followed by Greek",
232 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
233 "data": "xn--S-jib3p",
234 "valid": false
235 },
236 {
237 "description": "Greek KERAIA not followed by anything",
238 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
239 "data": "xn--wva3j",
240 "valid": false
241 },
242 {
243 "description": "Greek KERAIA followed by Greek",
244 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
245 "data": "xn--wva3je",
246 "valid": true
247 },
248 {
249 "description": "Hebrew GERESH not preceded by Hebrew",
250 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
251 "data": "xn--A-2hc5h",
252 "valid": false
253 },
254 {
255 "description": "Hebrew GERESH not preceded by anything",
256 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
257 "data": "xn--5db1e",
258 "valid": false
259 },
260 {
261 "description": "Hebrew GERESH preceded by Hebrew",
262 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
263 "data": "xn--4dbc5h",
264 "valid": true
265 },
266 {
267 "description": "Hebrew GERSHAYIM not preceded by Hebrew",
268 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
269 "data": "xn--A-2hc8h",
270 "valid": false
271 },
272 {
273 "description": "Hebrew GERSHAYIM not preceded by anything",
274 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
275 "data": "xn--5db3e",
276 "valid": false
277 },
278 {
279 "description": "Hebrew GERSHAYIM preceded by Hebrew",
280 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
281 "data": "xn--4dbc8h",
282 "valid": true
283 },
284 {
285 "description": "KATAKANA MIDDLE DOT with no Hiragana, Katakana, or Han",
286 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
287 "data": "xn--defabc-k64e",
288 "valid": false
289 },
290 {
291 "description": "KATAKANA MIDDLE DOT with no other characters",
292 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
293 "data": "xn--vek",
294 "valid": false
295 },
296 {
297 "description": "KATAKANA MIDDLE DOT with Hiragana",
298 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
299 "data": "xn--k8j5u",
300 "valid": true
301 },
302 {
303 "description": "KATAKANA MIDDLE DOT with Katakana",
304 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
305 "data": "xn--bck0j",
306 "valid": true
307 },
308 {
309 "description": "KATAKANA MIDDLE DOT with Han",
310 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
311 "data": "xn--vek778f",
312 "valid": true
313 },
314 {
315 "description": "Arabic-Indic digits mixed with Extended Arabic-Indic digits",
316 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
317 "data": "xn--ngb6iyr",
318 "valid": false
319 },
320 {
321 "description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits",
322 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
323 "data": "xn--ngba1o",
324 "valid": true
325 },
326 {
327 "description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits",
328 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9",
329 "data": "xn--0-gyc",
330 "valid": true
331 },
332 {
333 "description": "ZERO WIDTH JOINER not preceded by Virama",
334 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
335 "data": "xn--11b2er09f",
336 "valid": false
337 },
338 {
339 "description": "ZERO WIDTH JOINER not preceded by anything",
340 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
341 "data": "xn--02b508i",
342 "valid": false
343 },
344 {
345 "description": "ZERO WIDTH JOINER preceded by Virama",
346 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.2 https://www.unicode.org/review/pr-37.pdf",
347 "data": "xn--11b2ezcw70k",
348 "valid": true
349 },
350 {
351 "description": "ZERO WIDTH NON-JOINER preceded by Virama",
352 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1",
353 "data": "xn--11b2ezcs70k",
354 "valid": true
355 },
356 {
357 "description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp",
358 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
359 "data": "xn--ngba5hb2804a",
360 "valid": true
361 },
362 {
363 "description": "contains \"--\" in the 3rd and 4th position",
364 "comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
365 "data": "XN--aa---o47jg78q",
366 "valid": false
367 }
368 ]
369 }
370 ]