Debian Codegraph @

share/tests/draft4/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": "a valid punycoded IDN hostname",
43 "data": "xn--4gbwdl.xn--wgbh1c",
44 "valid": true
45 },
46 {
47 "description": "hostname with consecutive hyphens (RFC1123)",
48 "data": "ab--cd.example",
49 "valid": true
50 },
51 {
52 "description": "a host name starting with an illegal character",
53 "data": "-a-host-name-that-starts-with--",
54 "valid": false
55 },
56 {
57 "description": "a host name containing illegal characters",
58 "data": "not_a_valid_host_name",
59 "valid": false
60 },
61 {
62 "description": "a host name with a component too long",
63 "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
64 "valid": false
65 },
66 {
67 "description": "starts with hyphen",
68 "data": "-hostname",
69 "valid": false
70 },
71 {
72 "description": "ends with hyphen",
73 "data": "hostname-",
74 "valid": false
75 },
76 {
77 "description": "starts with underscore",
78 "data": "_hostname",
79 "valid": false
80 },
81 {
82 "description": "ends with underscore",
83 "data": "hostname_",
84 "valid": false
85 },
86 {
87 "description": "contains underscore",
88 "data": "host_name",
89 "valid": false
90 },
91 {
92 "description": "exceeds maximum overall length (256)",
93 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
94 "valid": false
95 },
96 {
97 "description": "maximum label length",
98 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
99 "valid": true
100 },
101 {
102 "description": "exceeds maximum label length",
103 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
104 "valid": false
105 },
106 {
107 "description": "single label",
108 "data": "hostname",
109 "valid": true
110 },
111 {
112 "description": "single label with hyphen",
113 "data": "host-name",
114 "valid": true
115 },
116 {
117 "description": "single label with digits",
118 "data": "h0stn4me",
119 "valid": true
120 },
121 {
122 "description": "single label ending with digit",
123 "data": "hostnam3",
124 "valid": true
125 },
126 {
127 "description": "empty string",
128 "data": "",
129 "valid": false
130 },
131 {
132 "description": "single dot",
133 "data": ".",
134 "valid": false
135 },
136 {
137 "description": "leading dot",
138 "data": ".example",
139 "valid": false
140 },
141 {
142 "description": "trailing dot",
143 "data": "example.",
144 "valid": false
145 },
146 {
147 "description": "IDN label separator",
148 "data": "example\uff0ecom",
149 "valid": false
150 },
151 {
152 "description": "trailing newline is invalid",
153 "data": "example.com\n",
154 "valid": false
155 },
156 {
157 "description": "invalid non-ASCII KELVIN SIGN (U+212A)",
158 "data": "\u212Aelvin.example.com",
159 "valid": false
160 }
161 ]
162 }
163 ]