]> Sergey Matveev's repositories - btrtrc.git/commitdiff
fs: Improve test logging
authorMatt Joiner <anacrolix@gmail.com>
Tue, 7 Apr 2015 15:43:50 +0000 (01:43 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 7 Apr 2015 15:43:50 +0000 (01:43 +1000)
fs/torrentfs_test.go

index f45b7d8173052e84e0659237a2484cd1bbd89c7a..ad8ac3757dd5287da061b515d9bcaf8dfcd6437e 100644 (file)
@@ -4,6 +4,7 @@ import (
        "bytes"
        "fmt"
        "io/ioutil"
+       "log"
        "net"
        "net/http"
        _ "net/http/pprof"
@@ -26,6 +27,10 @@ import (
        "github.com/anacrolix/torrent/util"
 )
 
+func init() {
+       log.SetFlags(log.Flags() | log.Lshortfile)
+}
+
 func TestTCPAddrString(t *testing.T) {
        l, err := net.Listen("tcp4", "localhost:0")
        if err != nil {
@@ -238,6 +243,6 @@ func TestDownloadOnDemand(t *testing.T) {
        }, resp)
        content := resp.Data
        if string(content) != testutil.GreetingFileContents {
-               t.FailNow()
+               t.Fatalf("%q != %q", string(content), testutil.GreetingFileContents)
        }
 }