From: Matt Joiner Date: Sun, 2 Aug 2015 04:57:28 +0000 (+1000) Subject: tracker_test: Check for the error string instead of the type X-Git-Tag: v1.0.0~1102 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c735370f9b27c532ba42c032434b3181fe5cc312;p=btrtrc.git tracker_test: Check for the error string instead of the type The type changes from Go 1.4->1.5, and it's not worth tearing it apart. --- diff --git a/tracker/udp_test.go b/tracker/udp_test.go index 6266fa17..2f0c364a 100644 --- a/tracker/udp_test.go +++ b/tracker/udp_test.go @@ -10,9 +10,10 @@ import ( "net" "net/url" "sync" - "syscall" "testing" + "github.com/stretchr/testify/require" + "github.com/anacrolix/torrent/util" ) @@ -58,10 +59,7 @@ func TestLongWriteUDP(t *testing.T) { for msgLen := 1; ; msgLen *= 2 { n, err := c.Write(make([]byte, msgLen)) if err != nil { - err := err.(*net.OpError).Err - if err != syscall.EMSGSIZE { - t.Fatalf("write error isn't EMSGSIZE: %s", err) - } + require.Contains(t, err.Error(), "message too long") return } if n < msgLen {