summaryrefslogtreecommitdiff
path: root/json/tests/draft7/optional/format/hostname.json
blob: 476541a83cf3e324fd5b3467209f164abdf945e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
[
    {
        "description": "validation of host names",
        "schema": {"format": "hostname"},
        "tests": [
            {
                "description": "a valid host name",
                "data": "www.example.com",
                "valid": true
            },
            {
                "description": "a valid punycoded IDN hostname",
                "data": "xn--4gbwdl.xn--wgbh1c",
                "valid": true
            },
            {
                "description": "a host name starting with an illegal character",
                "data": "-a-host-name-that-starts-with--",
                "valid": false
            },
            {
                "description": "a host name containing illegal characters",
                "data": "not_a_valid_host_name",
                "valid": false
            },
            {
                "description": "a host name with a component too long",
                "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
                "valid": false
            },
            {
                "description": "starts with hyphen",
                "data": "-hostname",
                "valid": false
            },
            {
                "description": "ends with hyphen",
                "data": "hostname-",
                "valid": false
            },
            {
                "description": "starts with underscore",
                "data": "_hostname",
                "valid": false
            },
            {
                "description": "ends with underscore",
                "data": "hostname_",
                "valid": false
            },
            {
                "description": "contains underscore",
                "data": "host_name",
                "valid": false
            },
            {
                "description": "maximum label length",
                "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
                "valid": true
            },
            {
                "description": "exceeds maximum label length",
                "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
                "valid": false
            }
        ]
    }
]