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
33d445a6
Commit
33d445a6
authored
Mar 25, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path: fix tests
parent
2b9bff75
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
45 deletions
+9
-45
tests/block.go
tests/block.go
+1
-4
tests/dag.go
tests/dag.go
+1
-4
tests/name.go
tests/name.go
+1
-5
tests/path.go
tests/path.go
+5
-28
tests/unixfs.go
tests/unixfs.go
+1
-4
No files found.
tests/block.go
View file @
33d445a6
...
@@ -110,10 +110,7 @@ func (tp *provider) TestBlockGet(t *testing.T) {
...
@@ -110,10 +110,7 @@ func (tp *provider) TestBlockGet(t *testing.T) {
t
.
Error
(
"didn't get correct data back"
)
t
.
Error
(
"didn't get correct data back"
)
}
}
p
,
err
:=
coreiface
.
ParsePath
(
"/ipfs/"
+
res
.
Path
()
.
Cid
()
.
String
())
p
:=
coreiface
.
ParsePath
(
"/ipfs/"
+
res
.
Path
()
.
Cid
()
.
String
())
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
p
)
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
tests/dag.go
View file @
33d445a6
...
@@ -113,10 +113,7 @@ func (tp *provider) TestDagPath(t *testing.T) {
...
@@ -113,10 +113,7 @@ func (tp *provider) TestDagPath(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
p
,
err
:=
coreiface
.
ParsePath
(
path
.
Join
(
nd
.
Cid
()
.
String
(),
"lnk"
))
p
:=
coreiface
.
ParsePath
(
path
.
Join
(
nd
.
Cid
()
.
String
(),
"lnk"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
p
)
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
tests/name.go
View file @
33d445a6
...
@@ -35,11 +35,7 @@ func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path,
...
@@ -35,11 +35,7 @@ func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path,
}
}
func
appendPath
(
p
coreiface
.
Path
,
sub
string
)
coreiface
.
Path
{
func
appendPath
(
p
coreiface
.
Path
,
sub
string
)
coreiface
.
Path
{
p
,
err
:=
coreiface
.
ParsePath
(
path
.
Join
(
p
.
String
(),
sub
))
return
coreiface
.
ParsePath
(
path
.
Join
(
p
.
String
(),
sub
))
if
err
!=
nil
{
panic
(
err
)
}
return
p
}
}
func
(
tp
*
provider
)
TestPublishResolve
(
t
*
testing
.
T
)
{
func
(
tp
*
provider
)
TestPublishResolve
(
t
*
testing
.
T
)
{
...
...
tests/path.go
View file @
33d445a6
...
@@ -75,12 +75,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) {
...
@@ -75,12 +75,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
p1
,
err
:=
coreiface
.
ParsePath
(
nd
.
String
()
+
"/foo/bar"
)
rp1
,
err
:=
api
.
ResolvePath
(
ctx
,
coreiface
.
ParsePath
(
nd
.
String
()
+
"/foo/bar"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rp1
,
err
:=
api
.
ResolvePath
(
ctx
,
p1
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -111,12 +106,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
...
@@ -111,12 +106,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
p1
,
err
:=
coreiface
.
ParsePath
(
nd
.
Cid
()
.
String
())
rp1
,
err
:=
api
.
ResolvePath
(
ctx
,
coreiface
.
ParsePath
(
nd
.
Cid
()
.
String
()))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rp1
,
err
:=
api
.
ResolvePath
(
ctx
,
p1
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -147,12 +137,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
...
@@ -147,12 +137,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
p1
,
err
:=
coreiface
.
ParsePath
(
"/ipld/"
+
nd
.
Cid
()
.
String
()
+
"/bar/baz"
)
_
,
err
=
api
.
ResolvePath
(
ctx
,
coreiface
.
ParsePath
(
"/ipld/"
+
nd
.
Cid
()
.
String
()
+
"/bar/baz"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
_
,
err
=
api
.
ResolvePath
(
ctx
,
p1
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"no such link found"
)
{
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"no such link found"
)
{
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
}
}
...
@@ -188,12 +173,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
...
@@ -188,12 +173,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
p1
,
err
:=
coreiface
.
ParsePath
(
"/ipld/"
+
nd
.
Cid
()
.
String
()
+
"/foo"
)
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
coreiface
.
ParsePath
(
"/ipld/"
+
nd
.
Cid
()
.
String
()
+
"/foo"
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
rp
,
err
:=
api
.
ResolvePath
(
ctx
,
p1
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -208,10 +188,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
...
@@ -208,10 +188,7 @@ func (tp *provider) TestPathRoot(t *testing.T) {
}
}
func
(
tp
*
provider
)
TestPathJoin
(
t
*
testing
.
T
)
{
func
(
tp
*
provider
)
TestPathJoin
(
t
*
testing
.
T
)
{
p1
,
err
:=
coreiface
.
ParsePath
(
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz"
)
p1
:=
coreiface
.
ParsePath
(
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
coreiface
.
Join
(
p1
,
"foo"
)
.
String
()
!=
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo"
{
if
coreiface
.
Join
(
p1
,
"foo"
)
.
String
()
!=
"/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo"
{
t
.
Error
(
"unexpected path"
)
t
.
Error
(
"unexpected path"
)
...
...
tests/unixfs.go
View file @
33d445a6
...
@@ -592,10 +592,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) {
...
@@ -592,10 +592,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
emptyFilePath
,
err
:=
coreiface
.
ParsePath
(
emptyFile
)
emptyFilePath
:=
coreiface
.
ParsePath
(
emptyFile
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
r
,
err
:=
api
.
Unixfs
()
.
Get
(
ctx
,
emptyFilePath
)
r
,
err
:=
api
.
Unixfs
()
.
Get
(
ctx
,
emptyFilePath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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