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
interface-go-dms3-core
Commits
e49c3d22
Commit
e49c3d22
authored
Jan 14, 2019
by
Łukasz Magiera
Committed by
Steven Allen
Jan 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unixfs.Add nocopy test
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
f40d44dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
tests/unixfs.go
tests/unixfs.go
+42
-0
No files found.
tests/unixfs.go
View file @
e49c3d22
...
...
@@ -101,6 +101,34 @@ func (tp *provider) TestAdd(t *testing.T) {
return
coreiface
.
IpfsPath
(
c
)
}
rf
,
err
:=
ioutil
.
TempFile
(
os
.
TempDir
(),
"unixfs-add-real"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rfp
:=
rf
.
Name
()
if
_
,
err
:=
rf
.
Write
([]
byte
(
helloStr
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
stat
,
err
:=
rf
.
Stat
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
err
:=
rf
.
Close
();
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
os
.
Remove
(
rfp
)
realFile
:=
func
()
files
.
Node
{
n
,
err
:=
files
.
NewReaderPathFile
(
rfp
,
ioutil
.
NopCloser
(
strings
.
NewReader
(
helloStr
)),
stat
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
return
n
}
cases
:=
[]
struct
{
name
string
data
func
()
files
.
Node
...
...
@@ -323,6 +351,20 @@ func (tp *provider) TestAdd(t *testing.T) {
path
:
"/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp"
,
opts
:
[]
options
.
UnixfsAddOption
{
options
.
Unixfs
.
Hidden
(
false
)},
},
// NoCopy
{
name
:
"simpleNoCopy"
,
data
:
realFile
,
path
:
"/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd"
,
opts
:
[]
options
.
UnixfsAddOption
{
options
.
Unixfs
.
Nocopy
(
true
)},
},
{
name
:
"noCopyNoRaw"
,
data
:
realFile
,
path
:
"/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd"
,
opts
:
[]
options
.
UnixfsAddOption
{
options
.
Unixfs
.
Nocopy
(
true
),
options
.
Unixfs
.
RawLeaves
(
false
)},
err
:
"nocopy option requires '--raw-leaves' to be enabled as well"
,
},
// Events / Progress
{
name
:
"simpleAddEvent"
,
...
...
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