]> Cypherpunks repositories - gostls13.git/commitdiff
net/url: add tests for URLHostname
authorBobby DeSimone <bobbydesimone@gmail.com>
Mon, 6 May 2019 21:26:08 +0000 (21:26 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 6 May 2019 23:07:15 +0000 (23:07 +0000)
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/net/url/url_test.go

index 27e132b1cd16f495935baacad11970df3f030368..e6d6ef8a838afcb55b6a42b688cceabd74b6b1e7 100644 (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}