Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ld-format
Commits
7b1fa213
Commit
7b1fa213
authored
Sep 05, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add daghelpers test and format code
parent
80c1eb3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
daghelpers_test.go
daghelpers_test.go
+28
-0
No files found.
daghelpers_test.go
0 → 100644
View file @
7b1fa213
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
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment