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
ld
go-ld-prime
Commits
717b235c
Commit
717b235c
authored
Mar 31, 2019
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track LastBlock correctly in traversal.Focus.
And test. Signed-off-by:
Eric Myhre
<
hash@exultant.us
>
parent
fa670628
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
traversal/focus.go
traversal/focus.go
+2
-0
traversal/focus_test.go
traversal/focus_test.go
+2
-0
No files found.
traversal/focus.go
View file @
717b235c
...
...
@@ -78,6 +78,8 @@ func (tp TraversalProgress) Focus(n ipld.Node, p ipld.Path, fn VisitFn) error {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error traversing node at %q: could not load link %q: %s"
,
p
.
Truncate
(
i
+
1
),
lnk
,
err
)
}
tp
.
LastBlock
.
Path
=
p
.
Truncate
(
i
+
1
)
tp
.
LastBlock
.
Link
=
lnk
prev
,
n
=
n
,
next
}
}
...
...
traversal/focus_test.go
View file @
717b235c
...
...
@@ -150,6 +150,8 @@ func TestFocusWithLinkLoading(t *testing.T) {
}
.
Focus
(
rootNode
,
ipld
.
ParsePath
(
"linkedMap/nested/nonlink"
),
func
(
tp
traversal
.
TraversalProgress
,
n
ipld
.
Node
)
error
{
Wish
(
t
,
n
,
ShouldEqual
,
fnb
.
CreateString
(
"zoo"
))
Wish
(
t
,
tp
.
Path
,
ShouldEqual
,
ipld
.
ParsePath
(
"linkedMap/nested/nonlink"
))
Wish
(
t
,
tp
.
LastBlock
.
Link
,
ShouldEqual
,
middleMapNodeLnk
)
Wish
(
t
,
tp
.
LastBlock
.
Path
,
ShouldEqual
,
ipld
.
ParsePath
(
"linkedMap"
))
return
nil
})
Wish
(
t
,
err
,
ShouldEqual
,
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