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-dms3
Commits
3f28663f
Commit
3f28663f
authored
9 years ago
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1414 from ipfs/fix-verify-file
ipns_test: fix slice bounds out of range
parents
3a1c8d7a
d1829604
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
fuse/ipns/ipns_test.go
fuse/ipns/ipns_test.go
+7
-21
No files found.
fuse/ipns/ipns_test.go
View file @
3f28663f
...
...
@@ -68,30 +68,16 @@ func writeFileData(t *testing.T, data []byte, path string) []byte {
return
data
}
func
verifyFile
(
t
*
testing
.
T
,
path
string
,
d
ata
[]
byte
)
{
f
i
,
err
:=
os
.
Open
(
path
)
func
verifyFile
(
t
*
testing
.
T
,
path
string
,
wantD
ata
[]
byte
)
{
i
sData
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
defer
fi
.
Close
()
buf
:=
make
([]
byte
,
1024
)
offset
:=
0
for
{
n
,
err
:=
fi
.
Read
(
buf
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
!
bytes
.
Equal
(
buf
[
:
n
],
data
[
offset
:
offset
+
n
])
{
t
.
Fatal
(
"Data not equal"
)
}
if
n
<
len
(
buf
)
{
break
}
offset
+=
n
if
len
(
isData
)
!=
len
(
wantData
)
{
t
.
Fatal
(
"Data not equal - length check failed"
)
}
if
!
bytes
.
Equal
(
isData
,
wantData
)
{
t
.
Fatal
(
"Data not equal"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
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