[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [goptlib/master] Resolve some "go vet" problems.
commit 356518d1bf136dd8e41f4863606e8c414e551136
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sun Jan 12 21:40:28 2014 -0800
Resolve some "go vet" problems.
---
args_test.go | 20 ++++++++++++--------
pt_test.go | 2 +-
socks_test.go | 6 +++---
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/args_test.go b/args_test.go
index d62968c..daf967e 100644
--- a/args_test.go
+++ b/args_test.go
@@ -67,20 +67,24 @@ func TestArgsGet(t *testing.T) {
func TestArgsAdd(t *testing.T) {
args := make(Args)
- if !argsEqual(args, Args{}) {
- t.Error()
+ expected := Args{}
+ if !argsEqual(args, expected) {
+ t.Fatalf("%q != %q", args, expected)
}
args.Add("k1", "v1")
- if !argsEqual(args, Args{"k1": []string{"v1"}}) {
- t.Error()
+ expected = Args{"k1": []string{"v1"}}
+ if !argsEqual(args, expected) {
+ t.Fatalf("%q != %q", args, expected)
}
args.Add("k2", "v2")
- if !argsEqual(args, Args{"k1": []string{"v1"}, "k2": []string{"v2"}}) {
- t.Error()
+ expected = Args{"k1": []string{"v1"}, "k2": []string{"v2"}}
+ if !argsEqual(args, expected) {
+ t.Fatalf("%q != %q", args, expected)
}
args.Add("k1", "v3")
- if !argsEqual(args, Args{"k1": []string{"v1", "v3"}, "k2": []string{"v2"}}) {
- t.Error()
+ expected = Args{"k1": []string{"v1", "v3"}, "k2": []string{"v2"}}
+ if !argsEqual(args, expected) {
+ t.Fatalf("%q != %q", args, expected)
}
}
diff --git a/pt_test.go b/pt_test.go
index a6b7a02..f7e9156 100644
--- a/pt_test.go
+++ b/pt_test.go
@@ -643,7 +643,7 @@ func testExtOrPortSetupIndividual(t *testing.T, addr, methodName string) {
// fake an OKAY response.
err = extOrPortSendCommand(&buf.ReadBuf, extOrCmdOkay, []byte{})
if err != nil {
- t.Fatal()
+ t.Fatal(err)
}
err = extOrPortSetup(&buf, addr, methodName)
if err != nil {
diff --git a/socks_test.go b/socks_test.go
index 6cfa967..7f97e9a 100644
--- a/socks_test.go
+++ b/socks_test.go
@@ -85,7 +85,7 @@ func TestReadSocks4aConnect(t *testing.T) {
}
addr, err := net.ResolveTCPAddr("tcp", req.Target)
if err != nil {
- t.Error("%q â?? target %q: cannot resolve: %s", test.input,
+ t.Errorf("%q â?? target %q: cannot resolve: %s", test.input,
req.Target, err)
}
if !tcpAddrsEqual(addr, &test.addr) {
@@ -144,7 +144,7 @@ func TestSendSocks4aResponse(t *testing.T) {
var buf bytes.Buffer
err := sendSocks4aResponse(&buf, test.code, &test.addr)
if err != nil {
- t.Errorf("0x%02x %s unexpectedly returned an error: %s", test.code, test.addr, err)
+ t.Errorf("0x%02x %s unexpectedly returned an error: %s", test.code, &test.addr, err)
}
p := make([]byte, 1024)
n, err := buf.Read(p)
@@ -154,7 +154,7 @@ func TestSendSocks4aResponse(t *testing.T) {
output := p[:n]
if !bytes.Equal(output, test.expected) {
t.Errorf("0x%02x %s â?? %v (expected %v)",
- test.code, test.addr, output, test.expected)
+ test.code, &test.addr, output, test.expected)
}
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits