[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [goptlib/master] Factor out a tcpAddrsEqual function.
commit 639435bcb76bd026143dcd019d9af878b338bac2
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Wed Nov 13 22:34:42 2013 -0800
Factor out a tcpAddrsEqual function.
---
pt_test.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pt_test.go b/pt_test.go
index 86a38dc..ff3373d 100644
--- a/pt_test.go
+++ b/pt_test.go
@@ -105,6 +105,10 @@ func stringSetsEqual(a, b []string) bool {
return true
}
+func tcpAddrsEqual(a, b *net.TCPAddr) bool {
+ return a.IP.Equal(b.IP) && a.Port == b.Port
+}
+
func TestGetClientTransports(t *testing.T) {
tests := [...]struct {
ptServerClientTransports string
@@ -211,7 +215,7 @@ func TestResolveAddr(t *testing.T) {
if err != nil {
t.Errorf("%q unexpectedly returned an error: %s", test.input, err)
}
- if !output.IP.Equal(test.expected.IP) || output.Port != test.expected.Port {
+ if !tcpAddrsEqual(output, &test.expected) {
t.Errorf("%q â?? %q (expected %q)", test.input, output, test.expected)
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits