Skip to content

Commit 6d91158

Browse files
committed
[325] Add some more hostname tests
Adds a few length and begins-with/ends-with/contains rudimentary tests. All drafts are affected.
1 parent e593057 commit 6d91158

File tree

5 files changed

+176
-1
lines changed

5 files changed

+176
-1
lines changed

tests/draft2019-09/optional/format/hostname.json

+35
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,41 @@
2727
"description": "a host name with a component too long",
2828
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
2929
"valid": false
30+
},
31+
{
32+
"description": "starts with hyphen",
33+
"data": "-hostname",
34+
"valid": false
35+
},
36+
{
37+
"description": "ends with hyphen",
38+
"data": "hostname-",
39+
"valid": false
40+
},
41+
{
42+
"description": "starts with underscore",
43+
"data": "_hostname",
44+
"valid": false
45+
},
46+
{
47+
"description": "ends with underscore",
48+
"data": "hostname_",
49+
"valid": false
50+
},
51+
{
52+
"description": "contains underscore",
53+
"data": "host_name",
54+
"valid": false
55+
},
56+
{
57+
"description": "maximum label length",
58+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
59+
"valid": true
60+
},
61+
{
62+
"description": "exceeds maximum label length",
63+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
64+
"valid": false
3065
}
3166
]
3267
}

tests/draft3/optional/format.json

+35
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,41 @@
185185
"description": "a host name with a component too long",
186186
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
187187
"valid": false
188+
},
189+
{
190+
"description": "starts with hyphen",
191+
"data": "-hostname",
192+
"valid": false
193+
},
194+
{
195+
"description": "ends with hyphen",
196+
"data": "hostname-",
197+
"valid": false
198+
},
199+
{
200+
"description": "starts with underscore",
201+
"data": "_hostname",
202+
"valid": false
203+
},
204+
{
205+
"description": "ends with underscore",
206+
"data": "hostname_",
207+
"valid": false
208+
},
209+
{
210+
"description": "contains underscore",
211+
"data": "host_name",
212+
"valid": false
213+
},
214+
{
215+
"description": "maximum label length",
216+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
217+
"valid": true
218+
},
219+
{
220+
"description": "exceeds maximum label length",
221+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
222+
"valid": false
188223
}
189224
]
190225
},

tests/draft4/optional/format.json

+35
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,41 @@
247247
"description": "a host name with a component too long",
248248
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
249249
"valid": false
250+
},
251+
{
252+
"description": "starts with hyphen",
253+
"data": "-hostname",
254+
"valid": false
255+
},
256+
{
257+
"description": "ends with hyphen",
258+
"data": "hostname-",
259+
"valid": false
260+
},
261+
{
262+
"description": "starts with underscore",
263+
"data": "_hostname",
264+
"valid": false
265+
},
266+
{
267+
"description": "ends with underscore",
268+
"data": "hostname_",
269+
"valid": false
270+
},
271+
{
272+
"description": "contains underscore",
273+
"data": "host_name",
274+
"valid": false
275+
},
276+
{
277+
"description": "maximum label length",
278+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
279+
"valid": true
280+
},
281+
{
282+
"description": "exceeds maximum label length",
283+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
284+
"valid": false
250285
}
251286
]
252287
}

tests/draft6/optional/format.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"description": "an invalid closing Z after time-zone offset",
3838
"data": "1963-06-19T08:30:06.28123+01:00Z",
3939
"valid": false
40-
},
40+
},
4141
{
4242
"description": "an invalid date-time string",
4343
"data": "06/19/1963 08:30:06 PST",
@@ -319,6 +319,41 @@
319319
"description": "a host name with a component too long",
320320
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
321321
"valid": false
322+
},
323+
{
324+
"description": "starts with hyphen",
325+
"data": "-hostname",
326+
"valid": false
327+
},
328+
{
329+
"description": "ends with hyphen",
330+
"data": "hostname-",
331+
"valid": false
332+
},
333+
{
334+
"description": "starts with underscore",
335+
"data": "_hostname",
336+
"valid": false
337+
},
338+
{
339+
"description": "ends with underscore",
340+
"data": "hostname_",
341+
"valid": false
342+
},
343+
{
344+
"description": "contains underscore",
345+
"data": "host_name",
346+
"valid": false
347+
},
348+
{
349+
"description": "maximum label length",
350+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
351+
"valid": true
352+
},
353+
{
354+
"description": "exceeds maximum label length",
355+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
356+
"valid": false
322357
}
323358
]
324359
},

tests/draft7/optional/format/hostname.json

+35
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,41 @@
2727
"description": "a host name with a component too long",
2828
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
2929
"valid": false
30+
},
31+
{
32+
"description": "starts with hyphen",
33+
"data": "-hostname",
34+
"valid": false
35+
},
36+
{
37+
"description": "ends with hyphen",
38+
"data": "hostname-",
39+
"valid": false
40+
},
41+
{
42+
"description": "starts with underscore",
43+
"data": "_hostname",
44+
"valid": false
45+
},
46+
{
47+
"description": "ends with underscore",
48+
"data": "hostname_",
49+
"valid": false
50+
},
51+
{
52+
"description": "contains underscore",
53+
"data": "host_name",
54+
"valid": false
55+
},
56+
{
57+
"description": "maximum label length",
58+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
59+
"valid": true
60+
},
61+
{
62+
"description": "exceeds maximum label length",
63+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
64+
"valid": false
3065
}
3166
]
3267
}

0 commit comments

Comments
 (0)