TestNormalizeHost tests host normalization including IDN support
(t *testing.T)
| 116 | |
| 117 | // TestNormalizeHost tests host normalization including IDN support |
| 118 | func TestNormalizeHost(t *testing.T) { |
| 119 | t.Parallel() |
| 120 | |
| 121 | testCases := []struct { |
| 122 | name string |
| 123 | input string |
| 124 | expected string |
| 125 | }{ |
| 126 | { |
| 127 | name: "EmptyString", |
| 128 | input: "", |
| 129 | expected: "", |
| 130 | }, |
| 131 | { |
| 132 | name: "SimpleHost", |
| 133 | input: "example.com", |
| 134 | expected: "example.com", |
| 135 | }, |
| 136 | { |
| 137 | name: "HostWithPort", |
| 138 | input: "example.com:8080", |
| 139 | expected: "example.com:8080", |
| 140 | }, |
| 141 | { |
| 142 | name: "CaseNormalization", |
| 143 | input: "EXAMPLE.COM", |
| 144 | expected: "example.com", |
| 145 | }, |
| 146 | { |
| 147 | name: "IPv4Address", |
| 148 | input: "192.168.1.1", |
| 149 | expected: "192.168.1.1", |
| 150 | }, |
| 151 | { |
| 152 | name: "IPv6Address", |
| 153 | input: "[::1]:8080", |
| 154 | expected: "[::1]:8080", |
| 155 | }, |
| 156 | } |
| 157 | |
| 158 | for _, tc := range testCases { |
| 159 | t.Run(tc.name, func(t *testing.T) { |
| 160 | t.Parallel() |
| 161 | result := normalizeHost(tc.input) |
| 162 | assert.Equal(t, tc.expected, result) |
| 163 | }) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | // TestNormalizePathSegments tests path normalization including dot-segment removal |
| 168 | func TestNormalizePathSegments(t *testing.T) { |
nothing calls this directly
no test coverage detected