Skip to content

Commit 9b8ef53

Browse files
committed
Cleanup hostname tests (remove dups, fix descriptions, reorder)
1 parent 4cf5599 commit 9b8ef53

File tree

4 files changed

+156
-227
lines changed

4 files changed

+156
-227
lines changed

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

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -42,108 +42,89 @@
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
53-
},
54-
{
55-
"description": "a host name containing illegal characters",
56-
"data": "not_a_valid_host_name",
57-
"valid": false
50+
"description": "single label with digits",
51+
"data": "h0stn4me",
52+
"valid": true
5853
},
5954
{
60-
"description": "a host name with a component too long",
61-
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
62-
"valid": false
55+
"description": "single label starting with digit",
56+
"data": "1host",
57+
"valid": true
6358
},
6459
{
65-
"description": "starts with hyphen",
66-
"data": "-hostname",
67-
"valid": false
60+
"description": "single label ending with digit",
61+
"data": "hostnam3",
62+
"valid": true
6863
},
6964
{
70-
"description": "ends with hyphen",
71-
"data": "hostname-",
65+
"description": "empty string",
66+
"data": "",
7267
"valid": false
7368
},
7469
{
75-
"description": "starts with underscore",
76-
"data": "_hostname",
70+
"description": "single dot",
71+
"data": ".",
7772
"valid": false
7873
},
7974
{
80-
"description": "ends with underscore",
81-
"data": "hostname_",
75+
"description": "leading dot",
76+
"data": ".example",
8277
"valid": false
8378
},
8479
{
85-
"description": "contains underscore",
86-
"data": "host_name",
80+
"description": "trailing dot",
81+
"data": "example.",
8782
"valid": false
8883
},
8984
{
90-
"description": "maximum label length",
91-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
92-
"valid": true
93-
},
94-
{
95-
"description": "exceeds maximum label length",
96-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
85+
"description": "IDN label separator",
86+
"data": "example\uff0ecom",
9787
"valid": false
9888
},
99-
{
100-
"description": "single label",
101-
"data": "hostname",
102-
"valid": true
103-
},
10489
{
10590
"description": "single label with hyphen",
10691
"data": "host-name",
10792
"valid": true
10893
},
10994
{
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
95+
"description": "starts with hyphen",
96+
"data": "-hostname",
97+
"valid": false
11898
},
11999
{
120-
"description": "single label ending with digit",
121-
"data": "hostnam3",
122-
"valid": true
100+
"description": "ends with hyphen",
101+
"data": "hostname-",
102+
"valid": false
123103
},
124104
{
125-
"description": "empty string",
126-
"data": "",
105+
"description": "contains \"--\" in the 3rd and 4th position",
106+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
107+
"data": "XN--aa---o47jg78q",
127108
"valid": false
128109
},
129110
{
130-
"description": "single dot",
131-
"data": ".",
111+
"description": "contains underscore",
112+
"data": "host_name",
132113
"valid": false
133114
},
134115
{
135-
"description": "leading dot",
136-
"data": ".example",
116+
"description": "exceeds maximum overall length (256)",
117+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
137118
"valid": false
138119
},
139120
{
140-
"description": "trailing dot",
141-
"data": "example.",
142-
"valid": false
121+
"description": "maximum label length (63)",
122+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
123+
"valid": true
143124
},
144125
{
145-
"description": "IDN label separator",
146-
"data": "example\uff0ecom",
126+
"description": "exceeds maximum label length (63)",
127+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
147128
"valid": false
148129
}
149130
]

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

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -42,108 +42,89 @@
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
53-
},
54-
{
55-
"description": "a host name containing illegal characters",
56-
"data": "not_a_valid_host_name",
57-
"valid": false
50+
"description": "single label with digits",
51+
"data": "h0stn4me",
52+
"valid": true
5853
},
5954
{
60-
"description": "a host name with a component too long",
61-
"data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
62-
"valid": false
55+
"description": "single label starting with digit",
56+
"data": "1host",
57+
"valid": true
6358
},
6459
{
65-
"description": "starts with hyphen",
66-
"data": "-hostname",
67-
"valid": false
60+
"description": "single label ending with digit",
61+
"data": "hostnam3",
62+
"valid": true
6863
},
6964
{
70-
"description": "ends with hyphen",
71-
"data": "hostname-",
65+
"description": "empty string",
66+
"data": "",
7267
"valid": false
7368
},
7469
{
75-
"description": "starts with underscore",
76-
"data": "_hostname",
70+
"description": "single dot",
71+
"data": ".",
7772
"valid": false
7873
},
7974
{
80-
"description": "ends with underscore",
81-
"data": "hostname_",
75+
"description": "leading dot",
76+
"data": ".example",
8277
"valid": false
8378
},
8479
{
85-
"description": "contains underscore",
86-
"data": "host_name",
80+
"description": "trailing dot",
81+
"data": "example.",
8782
"valid": false
8883
},
8984
{
90-
"description": "maximum label length",
91-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
92-
"valid": true
93-
},
94-
{
95-
"description": "exceeds maximum label length",
96-
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
85+
"description": "IDN label separator",
86+
"data": "example\uff0ecom",
9787
"valid": false
9888
},
99-
{
100-
"description": "single label",
101-
"data": "hostname",
102-
"valid": true
103-
},
10489
{
10590
"description": "single label with hyphen",
10691
"data": "host-name",
10792
"valid": true
10893
},
10994
{
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
95+
"description": "starts with hyphen",
96+
"data": "-hostname",
97+
"valid": false
11898
},
11999
{
120-
"description": "single label ending with digit",
121-
"data": "hostnam3",
122-
"valid": true
100+
"description": "ends with hyphen",
101+
"data": "hostname-",
102+
"valid": false
123103
},
124104
{
125-
"description": "empty string",
126-
"data": "",
105+
"description": "contains \"--\" in the 3rd and 4th position",
106+
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.1 https://tools.ietf.org/html/rfc5890#section-2.3.2.1",
107+
"data": "XN--aa---o47jg78q",
127108
"valid": false
128109
},
129110
{
130-
"description": "single dot",
131-
"data": ".",
111+
"description": "contains underscore",
112+
"data": "host_name",
132113
"valid": false
133114
},
134115
{
135-
"description": "leading dot",
136-
"data": ".example",
116+
"description": "exceeds maximum overall length (256)",
117+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
137118
"valid": false
138119
},
139120
{
140-
"description": "trailing dot",
141-
"data": "example.",
142-
"valid": false
121+
"description": "maximum label length (63)",
122+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
123+
"valid": true
143124
},
144125
{
145-
"description": "IDN label separator",
146-
"data": "example\uff0ecom",
126+
"description": "exceeds maximum label length (63)",
127+
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
147128
"valid": false
148129
}
149130
]

0 commit comments

Comments
 (0)