commit a4481a80ccb31a69869f2380f6f561897fd25025 Author: David Fifield david@bamsoftware.com Date: Mon Oct 3 18:58:01 2016 -0700
Store *url.URL in test tables, not url.URL.
Fixes "go vet" warnings: helper_test.go:50: arg input for printf verb %q of wrong type: net/url.URL helper_test.go:57: arg test.input for printf verb %q of wrong type: net/url.URL helper_test.go:60: arg test.input for printf verb %q of wrong type: net/url.URL --- meek-client/helper_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/meek-client/helper_test.go b/meek-client/helper_test.go index 4899f84..5838966 100644 --- a/meek-client/helper_test.go +++ b/meek-client/helper_test.go @@ -6,7 +6,7 @@ import ( )
func TestMakeProxySpec(t *testing.T) { - badTests := [...]url.URL{ + badTests := [...]*url.URL{ {Scheme: "http"}, {Scheme: "http", Host: ":"}, {Scheme: "http", Host: "localhost"}, @@ -27,32 +27,32 @@ func TestMakeProxySpec(t *testing.T) { {Scheme: "unknown", Host: "localhost:9999"}, } goodTests := [...]struct { - input url.URL + input *url.URL expected ProxySpec }{ { - url.URL{Scheme: "http", Host: "localhost:8080"}, + &url.URL{Scheme: "http", Host: "localhost:8080"}, ProxySpec{"http", "localhost", 8080}, }, { - url.URL{Scheme: "socks5", Host: "localhost:1080"}, + &url.URL{Scheme: "socks5", Host: "localhost:1080"}, ProxySpec{"socks5", "localhost", 1080}, }, { - url.URL{Scheme: "socks4a", Host: "localhost:1080"}, + &url.URL{Scheme: "socks4a", Host: "localhost:1080"}, ProxySpec{"socks4a", "localhost", 1080}, }, }
for _, input := range badTests { - _, err := makeProxySpec(&input) + _, err := makeProxySpec(input) if err == nil { t.Errorf("%q unexpectedly succeeded", input) } }
for _, test := range goodTests { - spec, err := makeProxySpec(&test.input) + spec, err := makeProxySpec(test.input) if err != nil { t.Fatalf("%q unexpectedly returned an error: %s", test.input, err) }