Skip to content

Commit e17a314

Browse files
committed
Add more comprehensive tessts for A-labels in the "hostname" format
1 parent ea29ae0 commit e17a314

File tree

4 files changed

+913
-0
lines changed

4 files changed

+913
-0
lines changed

tests/draft-next/optional/format/hostname.json

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,234 @@
113113
"valid": false
114114
}
115115
]
116+
},
117+
{
118+
"description": "validation of A-label (punycode) host names",
119+
"schema": {
120+
"$schema": "https://json-schema.org/draft/next/schema",
121+
"format": "hostname"
122+
},
123+
"tests": [
124+
{
125+
"description": "invalid Punycode",
126+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.4 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
127+
"data": "xn--X",
128+
"valid": false
129+
},
130+
{
131+
"description": "a valid host name (example.test in Hangul)",
132+
"data": "xn--9n2bp8q.xn--9t4b11yi5a",
133+
"valid": true
134+
},
135+
{
136+
"description": "contains illegal char U+302E Hangul single dot tone mark",
137+
"data": "xn--07jt112bpxg.xn--9t4b11yi5a",
138+
"valid": false
139+
},
140+
{
141+
"description": "Begins with a Spacing Combining Mark",
142+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
143+
"data": "xn--hello-txk",
144+
"valid": false
145+
},
146+
{
147+
"description": "Begins with a Nonspacing Mark",
148+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
149+
"data": "xn--hello-zed",
150+
"valid": false
151+
},
152+
{
153+
"description": "Begins with an Enclosing Mark",
154+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.2",
155+
"data": "xn--hello-6bf",
156+
"valid": false
157+
},
158+
{
159+
"description": "Exceptions that are PVALID, left-to-right chars",
160+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
161+
"data": "xn--zca29lwxobi7a",
162+
"valid": true
163+
},
164+
{
165+
"description": "Exceptions that are PVALID, right-to-left chars",
166+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
167+
"data": "xn--qmbc",
168+
"valid": true
169+
},
170+
{
171+
"description": "Exceptions that are DISALLOWED, right-to-left chars",
172+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.2 https://tools.ietf.org/html/rfc5892#section-2.6",
173+
"data": "xn--chb89f",
174+
"valid": false
175+
},
176+
{
177+
"description": "Exceptions that are DISALLOWED, 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 Note: The two combining marks (U+302E and U+302F) are in the middle and not at the start",
179+
"data": "xn--07jceefgh4c",
180+
"valid": false
181+
},
182+
{
183+
"description": "MIDDLE DOT with no preceding 'l'",
184+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
185+
"data": "xn--al-0ea",
186+
"valid": false
187+
},
188+
{
189+
"description": "MIDDLE DOT with nothing preceding",
190+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
191+
"data": "xn--l-fda",
192+
"valid": false
193+
},
194+
{
195+
"description": "MIDDLE DOT with no following 'l'",
196+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.3",
197+
"data": "xn--la-0ea",
198+
"valid": false
199+
},
200+
{
201+
"description": "MIDDLE DOT with nothing following",
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--l-gda",
204+
"valid": false
205+
},
206+
{
207+
"description": "MIDDLE DOT with surrounding 'l's",
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--ll-0ea",
210+
"valid": true
211+
},
212+
{
213+
"description": "Greek KERAIA not followed by Greek",
214+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
215+
"data": "xn--S-jib3p",
216+
"valid": false
217+
},
218+
{
219+
"description": "Greek KERAIA not followed by anything",
220+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
221+
"data": "xn--wva3j",
222+
"valid": false
223+
},
224+
{
225+
"description": "Greek KERAIA followed by Greek",
226+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.4",
227+
"data": "xn--wva3je",
228+
"valid": true
229+
},
230+
{
231+
"description": "Hebrew GERESH not preceded by Hebrew",
232+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
233+
"data": "xn--A-2hc5h",
234+
"valid": false
235+
},
236+
{
237+
"description": "Hebrew GERESH not preceded by anything",
238+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
239+
"data": "xn--5db1e",
240+
"valid": false
241+
},
242+
{
243+
"description": "Hebrew GERESH preceded by Hebrew",
244+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.5",
245+
"data": "xn--4dbc5h",
246+
"valid": true
247+
},
248+
{
249+
"description": "Hebrew GERSHAYIM 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.6",
251+
"data": "xn--A-2hc8h",
252+
"valid": false
253+
},
254+
{
255+
"description": "Hebrew GERSHAYIM 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.6",
257+
"data": "xn--5db3e",
258+
"valid": false
259+
},
260+
{
261+
"description": "Hebrew GERSHAYIM preceded by Hebrew",
262+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.6",
263+
"data": "xn--4dbc8h",
264+
"valid": true
265+
},
266+
{
267+
"description": "KATAKANA MIDDLE DOT with no Hiragana, Katakana, or Han",
268+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
269+
"data": "xn--defabc-k64e",
270+
"valid": false
271+
},
272+
{
273+
"description": "KATAKANA MIDDLE DOT with no other characters",
274+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
275+
"data": "xn--vek",
276+
"valid": false
277+
},
278+
{
279+
"description": "KATAKANA MIDDLE DOT with Hiragana",
280+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.7",
281+
"data": "xn--k8j5u",
282+
"valid": true
283+
},
284+
{
285+
"description": "KATAKANA MIDDLE DOT with Katakana",
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--bck0j",
288+
"valid": true
289+
},
290+
{
291+
"description": "KATAKANA MIDDLE DOT with Han",
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--vek778f",
294+
"valid": true
295+
},
296+
{
297+
"description": "Arabic-Indic digits mixed with Extended Arabic-Indic digits",
298+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
299+
"data": "xn--ngb6iyr",
300+
"valid": false
301+
},
302+
{
303+
"description": "Arabic-Indic digits not mixed with Extended Arabic-Indic digits",
304+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.8",
305+
"data": "xn--ngba1o",
306+
"valid": true
307+
},
308+
{
309+
"description": "Extended Arabic-Indic digits not mixed with Arabic-Indic digits",
310+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.9",
311+
"data": "xn--0-gyc",
312+
"valid": true
313+
},
314+
{
315+
"description": "ZERO WIDTH JOINER not preceded by Virama",
316+
"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",
317+
"data": "xn--11b2er09f",
318+
"valid": false
319+
},
320+
{
321+
"description": "ZERO WIDTH JOINER not preceded by anything",
322+
"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",
323+
"data": "xn--02b508i",
324+
"valid": false
325+
},
326+
{
327+
"description": "ZERO WIDTH JOINER preceded by Virama",
328+
"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",
329+
"data": "xn--11b2ezcw70k",
330+
"valid": true
331+
},
332+
{
333+
"description": "ZERO WIDTH NON-JOINER preceded by Virama",
334+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1",
335+
"data": "xn--11b2ezcs70k",
336+
"valid": true
337+
},
338+
{
339+
"description": "ZERO WIDTH NON-JOINER not preceded by Virama but matches regexp",
340+
"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",
341+
"data": "xn--ngba5hb2804a",
342+
"valid": true
343+
}
344+
]
116345
}
117346
]

0 commit comments

Comments
 (0)