Skip to content

Commit ea29ae0

Browse files
committed
Cleanup hostname tests (remove dups, fix descriptions, reorder)
1 parent 677a939 commit ea29ae0

File tree

4 files changed

+132
-203
lines changed

4 files changed

+132
-203
lines changed

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

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,40 @@
4242
"valid": true
4343
},
4444
{
45-
"description": "a valid punycoded IDN hostname",
46-
"data": "xn--4gbwdl.xn--wgbh1c",
45+
"description": "single label",
46+
"data": "hostname",
4747
"valid": true
4848
},
4949
{
50-
"description": "a host name starting with an illegal character",
51-
"data": "-a-host-name-that-starts-with--",
52-
"valid": false
50+
"description": "single label with digits",
51+
"data": "h0stn4me",
52+
"valid": true
5353
},
5454
{
55-
"description": "a host name containing illegal characters",
56-
"data": "not_a_valid_host_name",
55+
"description": "single label starting with digit",
56+
"data": "1host",
57+
"valid": true
58+
},
59+
{
60+
"description": "single label ending with digit",
61+
"data": "hostnam3",
62+
"valid": true
63+
},
64+
{
65+
"description": "empty string",
66+
"data": "",
5767
"valid": false
5868
},
5969
{
60-
"description": "a host name with a component too long",
61-
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
70+
"description": "single dot",
71+
"data": ".",
6272
"valid": false
6373
},
74+
{
75+
"description": "single label with hyphen",
76+
"data": "host-name",
77+
"valid": true
78+
},
6479
{
6580
"description": "starts with hyphen",
6681
"data": "-hostname",
@@ -72,13 +87,9 @@
7287
"valid": false
7388
},
7489
{
75-
"description": "starts with underscore",
76-
"data": "_hostname",
77-
"valid": false
78-
},
79-
{
80-
"description": "ends with underscore",
81-
"data": "hostname_",
90+
"description": "contains \"--\" in the 3rd and 4th position",
91+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
92+
"data": "XN--aa---o47jg78q",
8293
"valid": false
8394
},
8495
{
@@ -87,48 +98,18 @@
8798
"valid": false
8899
},
89100
{
90-
"description": "maximum label length",
91-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
92-
"valid": true
93-
},
94-
{
95-
"description": "exceeds maximum label length",
96-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
101+
"description": "exceeds maximum overall length (256)",
102+
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
97103
"valid": false
98104
},
99105
{
100-
"description": "single label",
101-
"data": "hostname",
102-
"valid": true
103-
},
104-
{
105-
"description": "single label with hyphen",
106-
"data": "host-name",
107-
"valid": true
108-
},
109-
{
110-
"description": "single label with digits",
111-
"data": "h0stn4me",
112-
"valid": true
113-
},
114-
{
115-
"description": "single label starting with digit",
116-
"data": "1host",
117-
"valid": true
118-
},
119-
{
120-
"description": "single label ending with digit",
121-
"data": "hostnam3",
106+
"description": "maximum label length (63)",
107+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
122108
"valid": true
123109
},
124110
{
125-
"description": "empty string",
126-
"data": "",
127-
"valid": false
128-
},
129-
{
130-
"description": "single dot",
131-
"data": ".",
111+
"description": "exceeds maximum label length (63)",
112+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
132113
"valid": false
133114
}
134115
]

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

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,40 @@
4242
"valid": true
4343
},
4444
{
45-
"description": "a valid punycoded IDN hostname",
46-
"data": "xn--4gbwdl.xn--wgbh1c",
45+
"description": "single label",
46+
"data": "hostname",
4747
"valid": true
4848
},
4949
{
50-
"description": "a host name starting with an illegal character",
51-
"data": "-a-host-name-that-starts-with--",
52-
"valid": false
50+
"description": "single label with digits",
51+
"data": "h0stn4me",
52+
"valid": true
5353
},
5454
{
55-
"description": "a host name containing illegal characters",
56-
"data": "not_a_valid_host_name",
55+
"description": "single label starting with digit",
56+
"data": "1host",
57+
"valid": true
58+
},
59+
{
60+
"description": "single label ending with digit",
61+
"data": "hostnam3",
62+
"valid": true
63+
},
64+
{
65+
"description": "empty string",
66+
"data": "",
5767
"valid": false
5868
},
5969
{
60-
"description": "a host name with a component too long",
61-
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
70+
"description": "single dot",
71+
"data": ".",
6272
"valid": false
6373
},
74+
{
75+
"description": "single label with hyphen",
76+
"data": "host-name",
77+
"valid": true
78+
},
6479
{
6580
"description": "starts with hyphen",
6681
"data": "-hostname",
@@ -72,13 +87,9 @@
7287
"valid": false
7388
},
7489
{
75-
"description": "starts with underscore",
76-
"data": "_hostname",
77-
"valid": false
78-
},
79-
{
80-
"description": "ends with underscore",
81-
"data": "hostname_",
90+
"description": "contains \"--\" in the 3rd and 4th position",
91+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
92+
"data": "XN--aa---o47jg78q",
8293
"valid": false
8394
},
8495
{
@@ -87,48 +98,18 @@
8798
"valid": false
8899
},
89100
{
90-
"description": "maximum label length",
91-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
92-
"valid": true
93-
},
94-
{
95-
"description": "exceeds maximum label length",
96-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
101+
"description": "exceeds maximum overall length (256)",
102+
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
97103
"valid": false
98104
},
99105
{
100-
"description": "single label",
101-
"data": "hostname",
102-
"valid": true
103-
},
104-
{
105-
"description": "single label with hyphen",
106-
"data": "host-name",
107-
"valid": true
108-
},
109-
{
110-
"description": "single label with digits",
111-
"data": "h0stn4me",
112-
"valid": true
113-
},
114-
{
115-
"description": "single label starting with digit",
116-
"data": "1host",
117-
"valid": true
118-
},
119-
{
120-
"description": "single label ending with digit",
121-
"data": "hostnam3",
106+
"description": "maximum label length (63)",
107+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
122108
"valid": true
123109
},
124110
{
125-
"description": "empty string",
126-
"data": "",
127-
"valid": false
128-
},
129-
{
130-
"description": "single dot",
131-
"data": ".",
111+
"description": "exceeds maximum label length (63)",
112+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
132113
"valid": false
133114
}
134115
]

tests/draft2020-12/optional/format/hostname.json

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,40 @@
4242
"valid": true
4343
},
4444
{
45-
"description": "a valid punycoded IDN hostname",
46-
"data": "xn--4gbwdl.xn--wgbh1c",
45+
"description": "single label",
46+
"data": "hostname",
4747
"valid": true
4848
},
4949
{
50-
"description": "a host name starting with an illegal character",
51-
"data": "-a-host-name-that-starts-with--",
52-
"valid": false
50+
"description": "single label with digits",
51+
"data": "h0stn4me",
52+
"valid": true
5353
},
5454
{
55-
"description": "a host name containing illegal characters",
56-
"data": "not_a_valid_host_name",
55+
"description": "single label starting with digit",
56+
"data": "1host",
57+
"valid": true
58+
},
59+
{
60+
"description": "single label ending with digit",
61+
"data": "hostnam3",
62+
"valid": true
63+
},
64+
{
65+
"description": "empty string",
66+
"data": "",
5767
"valid": false
5868
},
5969
{
60-
"description": "a host name with a component too long",
61-
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
70+
"description": "single dot",
71+
"data": ".",
6272
"valid": false
6373
},
74+
{
75+
"description": "single label with hyphen",
76+
"data": "host-name",
77+
"valid": true
78+
},
6479
{
6580
"description": "starts with hyphen",
6681
"data": "-hostname",
@@ -72,13 +87,9 @@
7287
"valid": false
7388
},
7489
{
75-
"description": "starts with underscore",
76-
"data": "_hostname",
77-
"valid": false
78-
},
79-
{
80-
"description": "ends with underscore",
81-
"data": "hostname_",
90+
"description": "contains \"--\" in the 3rd and 4th position",
91+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
92+
"data": "XN--aa---o47jg78q",
8293
"valid": false
8394
},
8495
{
@@ -87,48 +98,18 @@
8798
"valid": false
8899
},
89100
{
90-
"description": "maximum label length",
91-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
92-
"valid": true
93-
},
94-
{
95-
"description": "exceeds maximum label length",
96-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
101+
"description": "exceeds maximum overall length (256)",
102+
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
97103
"valid": false
98104
},
99105
{
100-
"description": "single label",
101-
"data": "hostname",
102-
"valid": true
103-
},
104-
{
105-
"description": "single label with hyphen",
106-
"data": "host-name",
107-
"valid": true
108-
},
109-
{
110-
"description": "single label with digits",
111-
"data": "h0stn4me",
112-
"valid": true
113-
},
114-
{
115-
"description": "single label starting with digit",
116-
"data": "1host",
117-
"valid": true
118-
},
119-
{
120-
"description": "single label ending with digit",
121-
"data": "hostnam3",
106+
"description": "maximum label length (63)",
107+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
122108
"valid": true
123109
},
124110
{
125-
"description": "empty string",
126-
"data": "",
127-
"valid": false
128-
},
129-
{
130-
"description": "single dot",
131-
"data": ".",
111+
"description": "exceeds maximum label length (63)",
112+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
132113
"valid": false
133114
}
134115
]

0 commit comments

Comments
 (0)