Commit 2729cd07 authored by Bobby DeSimone's avatar Bobby DeSimone Committed by Brad Fitzpatrick

net/url: add tests for URLHostname

These changes add tests for URLHostname.

Change-Id: Ie474516401a2236a9be65fb5c4e478322b1a199c
GitHub-Last-Rev: 18f2d597be960c4d13cde12fef5d115926bff7bd
GitHub-Pull-Request: golang/go#31832
Reviewed-on: https://go-review.googlesource.com/c/go/+/175142Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 6b1ac829
...@@ -1634,6 +1634,12 @@ func TestURLHostname(t *testing.T) { ...@@ -1634,6 +1634,12 @@ func TestURLHostname(t *testing.T) {
{"[1:2:3:4]", "1:2:3:4"}, {"[1:2:3:4]", "1:2:3:4"},
{"[1:2:3:4]:80", "1:2:3:4"}, {"[1:2:3:4]:80", "1:2:3:4"},
{"[::1]:80", "::1"}, {"[::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 { for _, tt := range tests {
u := &URL{Host: tt.host} u := &URL{Host: tt.host}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment