]> Sergey Matveev's repositories - btrtrc.git/blobdiff - issue211_test.go
Drop support for go 1.20
[btrtrc.git] / issue211_test.go
index dedbaa5647a80a1337f94e10a7ef3aa38a2852b1..a76be07a8a2da0a6c6682e28038eb610a9d8f140 100644 (file)
@@ -1,8 +1,10 @@
+//go:build !wasm
+// +build !wasm
+
 package torrent
 
 import (
        "io"
-       "io/ioutil"
        "testing"
 
        "github.com/stretchr/testify/assert"
@@ -14,7 +16,7 @@ import (
 )
 
 func TestDropTorrentWithMmapStorageWhileHashing(t *testing.T) {
-       cfg := TestingConfig()
+       cfg := TestingConfig(t)
        // Ensure the data is present when the torrent is added, and not obtained
        // over the network as the test runs.
        cfg.DownloadRateLimiter = rate.NewLimiter(0, 0)
@@ -23,8 +25,10 @@ func TestDropTorrentWithMmapStorageWhileHashing(t *testing.T) {
        defer cl.Close()
 
        td, mi := testutil.GreetingTestTorrent()
+       mms := storage.NewMMap(td)
+       defer mms.Close()
        tt, new, err := cl.AddTorrentSpec(&TorrentSpec{
-               Storage:   storage.NewMMap(td),
+               Storage:   mms,
                InfoHash:  mi.HashInfoBytes(),
                InfoBytes: mi.InfoBytes,
        })
@@ -33,5 +37,5 @@ func TestDropTorrentWithMmapStorageWhileHashing(t *testing.T) {
 
        r := tt.NewReader()
        go tt.Drop()
-       io.Copy(ioutil.Discard, r)
+       io.Copy(io.Discard, r)
 }