2
0
mirror of synced 2025-02-24 14:48:27 +00:00
torrent/issue97_test.go
2016-07-12 16:42:54 +10:00

27 lines
561 B
Go

package torrent
import (
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/anacrolix/torrent/internal/testutil"
"github.com/anacrolix/torrent/storage"
)
func TestHashPieceAfterStorageClosed(t *testing.T) {
td, err := ioutil.TempDir("", "")
require.NoError(t, err)
defer os.RemoveAll(td)
cs := storage.NewFile(td)
tt := &Torrent{}
tt.info = &testutil.GreetingMetaInfo().Info
tt.makePieces()
tt.storage, err = cs.OpenTorrent(tt.info)
require.NoError(t, err)
require.NoError(t, tt.storage.Close())
tt.hashPiece(0)
}