github.com/anacrolix/torrent@v1.61.0/storage/mmap_test.go (about)

     1  package storage
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/go-quicktest/qt"
     8  
     9  	"github.com/anacrolix/torrent/internal/testutil"
    10  )
    11  
    12  func TestMmapWindows(t *testing.T) {
    13  	dir, mi := testutil.GreetingTestTorrent()
    14  	cs := NewMMap(dir)
    15  	defer func() {
    16  		qt.Check(t, qt.IsNil(cs.Close()))
    17  	}()
    18  	info, err := mi.UnmarshalInfo()
    19  	qt.Assert(t, qt.IsNil(err))
    20  	ts, err := cs.OpenTorrent(context.Background(), &info, mi.HashInfoBytes())
    21  	qt.Assert(t, qt.IsNil(err))
    22  	defer func() {
    23  		qt.Check(t, qt.IsNil(ts.Close()))
    24  	}()
    25  }