From c735370f9b27c532ba42c032434b3181fe5cc312 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 2 Aug 2015 14:57:28 +1000 Subject: [PATCH] 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. --- tracker/udp_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 { -- 2.48.1