Skip to content

Commit

Permalink
add daghelpers test and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
kjzz committed Sep 5, 2018
1 parent 80c1eb3 commit 5bc4a5b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion daghelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package format
import (
"context"

cid "github.com/ipfs/go-cid"
"github.com/ipfs/go-cid"
)

// GetLinks returns the CIDs of the children of the given node. Prefer this
Expand Down
28 changes: 28 additions & 0 deletions daghelpers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package format

import (
"context"
"github.com/ipfs/go-cid"
mh "github.com/multiformats/go-multihash"
"testing"
)

func TestCopy(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
from := newTestDag()
if err := from.Add(ctx, new(EmptyNode)); err != nil {
t.Fatal(err)
}
to := newTestDag()
id, err := cid.Prefix{
Version: 1,
Codec: cid.Raw,
MhType: mh.ID,
MhLength: 0,
}.Sum(nil)
err = Copy(ctx, from, to, id)
if err != nil {
t.Error(err)
}
}

0 comments on commit 5bc4a5b

Please sign in to comment.