1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

Add testutil package and function to generate a dagservice

This commit is contained in:
Jeromy
2014-10-31 06:02:47 +00:00
parent e9779b1c7f
commit b02dbc4a6b

18
util/testutil/gen.go Normal file
View File

@ -0,0 +1,18 @@
package testutil
import (
"testing"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
bsrv "github.com/jbenet/go-ipfs/blockservice"
dag "github.com/jbenet/go-ipfs/merkledag"
)
func GetDAGServ(t testing.TB) dag.DAGService {
dstore := ds.NewMapDatastore()
bserv, err := bsrv.NewBlockService(dstore, nil)
if err != nil {
t.Fatal(err)
}
return dag.NewDAGService(bserv)
}