1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:54:46 -07:00

net/url: add tests for URLHostname

These changes add tests for URLHostname.

Change-Id: Ie474516401a2236a9be65fb5c4e478322b1a199c
GitHub-Last-Rev: 18f2d597be
GitHub-Pull-Request: golang/go#31832
Reviewed-on: https://go-review.googlesource.com/c/go/+/175142
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Bobby DeSimone 2019-05-06 21:26:08 +00:00 committed by Brad Fitzpatrick
parent 6b1ac8290f
commit 2729cd0751

View File

@ -1634,6 +1634,12 @@ func TestURLHostname(t *testing.T) {
{"[1:2:3:4]", "1:2:3:4"},
{"[1:2:3:4]:80", "1:2:3:4"},
{"[::1]:80", "::1"},
{"[::1]", "::1"},
{"localhost", "localhost"},
{"localhost:443", "localhost"},
{"some.super.long.domain.example.org:8080", "some.super.long.domain.example.org"},
{"[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:17000", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"},
{"[2001:0db8:85a3:0000:0000:8a2e:0370:7334]", "2001:0db8:85a3:0000:0000:8a2e:0370:7334"},
}
for _, tt := range tests {
u := &URL{Host: tt.host}