package assert->expect
This commit is contained in:
parent
92f6209c5f
commit
a101ebb07e
|
@ -5,7 +5,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/anacrolix/missinggo/assert"
|
"github.com/anacrolix/missinggo/expect"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent/bencode"
|
"github.com/anacrolix/torrent/bencode"
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
|
@ -48,7 +48,7 @@ func (t *Torrent) Info(pieceLength int64) metainfo.Info {
|
||||||
err := info.GeneratePieces(func(fi metainfo.FileInfo) (io.ReadCloser, error) {
|
err := info.GeneratePieces(func(fi metainfo.FileInfo) (io.ReadCloser, error) {
|
||||||
return ioutil.NopCloser(strings.NewReader(t.GetFile(strings.Join(fi.Path, "/")).Data)), nil
|
return ioutil.NopCloser(strings.NewReader(t.GetFile(strings.Join(fi.Path, "/")).Data)), nil
|
||||||
})
|
})
|
||||||
assert.Nil(err)
|
expect.Nil(err)
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,6 @@ func (t *Torrent) Metainfo(pieceLength int64) *metainfo.MetaInfo {
|
||||||
mi := metainfo.MetaInfo{}
|
mi := metainfo.MetaInfo{}
|
||||||
var err error
|
var err error
|
||||||
mi.InfoBytes, err = bencode.Marshal(t.Info(pieceLength))
|
mi.InfoBytes, err = bencode.Marshal(t.Info(pieceLength))
|
||||||
assert.Nil(err)
|
expect.Nil(err)
|
||||||
return &mi
|
return &mi
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/anacrolix/missinggo/assert"
|
"github.com/anacrolix/missinggo/expect"
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
|
@ -30,7 +30,7 @@ func NewBoltDB(filePath string) ClientImpl {
|
||||||
db, err := bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bolt.Options{
|
db, err := bolt.Open(filepath.Join(filePath, "bolt.db"), 0600, &bolt.Options{
|
||||||
Timeout: time.Second,
|
Timeout: time.Second,
|
||||||
})
|
})
|
||||||
assert.Nil(err)
|
expect.Nil(err)
|
||||||
db.NoSync = true
|
db.NoSync = true
|
||||||
return &boltDBClient{db}
|
return &boltDBClient{db}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue