From: Bobby DeSimone Date: Mon, 6 May 2019 21:26:08 +0000 (+0000) Subject: net/url: add tests for URLHostname X-Git-Tag: go1.13beta1~394 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2729cd07510b38c6be4f99beebe32ccb888d1f0f;p=gostls13.git 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/+/175142 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/net/url/url_test.go b/src/net/url/url_test.go index 27e132b1cd..e6d6ef8a83 100644 --- a/src/net/url/url_test.go +++ b/src/net/url/url_test.go @@ -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}