Преглед на файлове

Simplify and fix spelling errors in test files

Simplify using gofmt -s.
Gary Burd преди 8 години
родител
ревизия
3da6ca0cb6
променени са 3 файла, в които са добавени 20 реда и са изтрити 20 реда
  1. 5 5
      client_server_test.go
  2. 1 1
      conn_test.go
  3. 14 14
      util_test.go

+ 5 - 5
client_server_test.go

@@ -160,8 +160,8 @@ func TestProxyDial(t *testing.T) {
 			}
 
 			if !connect {
-				t.Log("connect not recieved")
-				http.Error(w, "connect not recieved", 405)
+				t.Log("connect not received")
+				http.Error(w, "connect not received", 405)
 				return
 			}
 			origHandler.ServeHTTP(w, r)
@@ -200,8 +200,8 @@ func TestProxyAuthorizationDial(t *testing.T) {
 			}
 
 			if !connect {
-				t.Log("connect with proxy authorization not recieved")
-				http.Error(w, "connect with proxy authorization not recieved", 405)
+				t.Log("connect with proxy authorization not received")
+				http.Error(w, "connect with proxy authorization not received", 405)
 				return
 			}
 			origHandler.ServeHTTP(w, r)
@@ -246,7 +246,7 @@ func TestDialCookieJar(t *testing.T) {
 		u.Scheme = "https"
 	}
 
-	cookies := []*http.Cookie{&http.Cookie{Name: "gorilla", Value: "ws", Path: "/"}}
+	cookies := []*http.Cookie{{Name: "gorilla", Value: "ws", Path: "/"}}
 	d.Jar.SetCookies(u, cookies)
 
 	ws, _, err := d.Dial(s.URL, nil)

+ 1 - 1
conn_test.go

@@ -366,7 +366,7 @@ func TestBufioReadBytes(t *testing.T) {
 		t.Fatalf("ReadBytes() returned %v", err)
 	}
 	if len(p) != len(m) {
-		t.Fatalf("read returnd %d bytes, want %d bytes", len(p), len(m))
+		t.Fatalf("read returned %d bytes, want %d bytes", len(p), len(m))
 	}
 }
 

+ 14 - 14
util_test.go

@@ -38,29 +38,29 @@ var parseExtensionTests = []struct {
 	value      string
 	extensions []map[string]string
 }{
-	{`foo`, []map[string]string{map[string]string{"": "foo"}}},
+	{`foo`, []map[string]string{{"": "foo"}}},
 	{`foo, bar; baz=2`, []map[string]string{
-		map[string]string{"": "foo"},
-		map[string]string{"": "bar", "baz": "2"}}},
+		{"": "foo"},
+		{"": "bar", "baz": "2"}}},
 	{`foo; bar="b,a;z"`, []map[string]string{
-		map[string]string{"": "foo", "bar": "b,a;z"}}},
+		{"": "foo", "bar": "b,a;z"}}},
 	{`foo , bar; baz = 2`, []map[string]string{
-		map[string]string{"": "foo"},
-		map[string]string{"": "bar", "baz": "2"}}},
+		{"": "foo"},
+		{"": "bar", "baz": "2"}}},
 	{`foo, bar; baz=2 junk`, []map[string]string{
-		map[string]string{"": "foo"}}},
+		{"": "foo"}}},
 	{`foo junk, bar; baz=2 junk`, nil},
 	{`mux; max-channels=4; flow-control, deflate-stream`, []map[string]string{
-		map[string]string{"": "mux", "max-channels": "4", "flow-control": ""},
-		map[string]string{"": "deflate-stream"}}},
+		{"": "mux", "max-channels": "4", "flow-control": ""},
+		{"": "deflate-stream"}}},
 	{`permessage-foo; x="10"`, []map[string]string{
-		map[string]string{"": "permessage-foo", "x": "10"}}},
+		{"": "permessage-foo", "x": "10"}}},
 	{`permessage-foo; use_y, permessage-foo`, []map[string]string{
-		map[string]string{"": "permessage-foo", "use_y": ""},
-		map[string]string{"": "permessage-foo"}}},
+		{"": "permessage-foo", "use_y": ""},
+		{"": "permessage-foo"}}},
 	{`permessage-deflate; client_max_window_bits; server_max_window_bits=10 , permessage-deflate; client_max_window_bits`, []map[string]string{
-		map[string]string{"": "permessage-deflate", "client_max_window_bits": "", "server_max_window_bits": "10"},
-		map[string]string{"": "permessage-deflate", "client_max_window_bits": ""}}},
+		{"": "permessage-deflate", "client_max_window_bits": "", "server_max_window_bits": "10"},
+		{"": "permessage-deflate", "client_max_window_bits": ""}}},
 }
 
 func TestParseExtensions(t *testing.T) {