]> Sergey Matveev's repositories - btrtrc.git/commitdiff
tracker_test: Check for the error string instead of the type
authorMatt Joiner <anacrolix@gmail.com>
Sun, 2 Aug 2015 04:57:28 +0000 (14:57 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 2 Aug 2015 04:57:28 +0000 (14:57 +1000)
The type changes from Go 1.4->1.5, and it's not worth tearing it apart.

tracker/udp_test.go

index 6266fa1718d5eb4f68002b52648dd1a924290003..2f0c364a421e2df5d0a6287c21e4294aa902a942 100644 (file)
@@ -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 {