aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/http/proxy_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-06-25 16:20:03 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-06-25 16:20:03 +0000
commit08a680a8879ce9da16d808644730f7cfacaf667f (patch)
tree5dfe28c3f573ae57b971ed4d9a1c99a76f0a70c4 /libgo/go/net/http/proxy_test.go
parent72de8622ae2d5aaeb58173f454aed87640a989b5 (diff)
downloadgcc-08a680a8879ce9da16d808644730f7cfacaf667f.zip
gcc-08a680a8879ce9da16d808644730f7cfacaf667f.tar.gz
gcc-08a680a8879ce9da16d808644730f7cfacaf667f.tar.bz2
libgo: Update to Go 1.0.2 release.
From-SVN: r188943
Diffstat (limited to 'libgo/go/net/http/proxy_test.go')
-rw-r--r--libgo/go/net/http/proxy_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/libgo/go/net/http/proxy_test.go b/libgo/go/net/http/proxy_test.go
index 9b320b3a..5ecffaf 100644
--- a/libgo/go/net/http/proxy_test.go
+++ b/libgo/go/net/http/proxy_test.go
@@ -5,6 +5,7 @@
package http
import (
+ "net/url"
"os"
"testing"
)
@@ -46,3 +47,32 @@ func TestUseProxy(t *testing.T) {
}
}
}
+
+var cacheKeysTests = []struct {
+ proxy string
+ scheme string
+ addr string
+ key string
+}{
+ {"", "http", "foo.com", "|http|foo.com"},
+ {"", "https", "foo.com", "|https|foo.com"},
+ {"http://foo.com", "http", "foo.com", "http://foo.com|http|"},
+ {"http://foo.com", "https", "foo.com", "http://foo.com|https|foo.com"},
+}
+
+func TestCacheKeys(t *testing.T) {
+ for _, tt := range cacheKeysTests {
+ var proxy *url.URL
+ if tt.proxy != "" {
+ u, err := url.Parse(tt.proxy)
+ if err != nil {
+ t.Fatal(err)
+ }
+ proxy = u
+ }
+ cm := connectMethod{proxy, tt.scheme, tt.addr}
+ if cm.String() != tt.key {
+ t.Fatalf("{%q, %q, %q} cache key %q; want %q", tt.proxy, tt.scheme, tt.addr, cm.String(), tt.key)
+ }
+ }
+}