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
p2p
go-buffer-pool
Commits
1a02bce0
Unverified
Commit
1a02bce0
authored
May 05, 2021
by
Marten Seemann
Committed by
GitHub
May 05, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from libp2p/fix-staticcheck
fix staticcheck
parents
4016316b
83441051
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
18 deletions
+4
-18
buffer_test.go
buffer_test.go
+4
-18
No files found.
buffer_test.go
View file @
1a02bce0
...
...
@@ -8,7 +8,6 @@ package pool
import
(
"bytes"
"io"
"math/rand"
"runtime"
"testing"
...
...
@@ -140,6 +139,9 @@ func TestBasicOperations(t *testing.T) {
check
(
t
,
"TestBasicOperations (5)"
,
&
buf
,
"ab"
)
n
,
err
=
buf
.
Write
([]
byte
(
data
[
2
:
26
]))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
n
!=
24
{
t
.
Errorf
(
"wrote 25 bytes, but n == %d"
,
n
)
}
...
...
@@ -162,8 +164,7 @@ func TestBasicOperations(t *testing.T) {
if
c
!=
data
[
1
]
{
t
.
Errorf
(
"ReadByte wrong value c=%v"
,
c
)
}
c
,
err
=
buf
.
ReadByte
()
if
err
==
nil
{
if
_
,
err
=
buf
.
ReadByte
();
err
==
nil
{
t
.
Error
(
"ReadByte unexpected not eof"
)
}
}
...
...
@@ -292,21 +293,6 @@ func TestNext(t *testing.T) {
}
}
var
readBytesTests
=
[]
struct
{
buffer
string
delim
byte
expected
[]
string
err
error
}{
{
""
,
0
,
[]
string
{
""
},
io
.
EOF
},
{
"a
\x00
"
,
0
,
[]
string
{
"a
\x00
"
},
nil
},
{
"abbbaaaba"
,
'b'
,
[]
string
{
"ab"
,
"b"
,
"b"
,
"aaab"
},
nil
},
{
"hello
\x01
world"
,
1
,
[]
string
{
"hello
\x01
"
},
nil
},
{
"foo
\n
bar"
,
0
,
[]
string
{
"foo
\n
bar"
},
io
.
EOF
},
{
"alpha
\n
beta
\n
gamma
\n
"
,
'\n'
,
[]
string
{
"alpha
\n
"
,
"beta
\n
"
,
"gamma
\n
"
},
nil
},
{
"alpha
\n
beta
\n
gamma"
,
'\n'
,
[]
string
{
"alpha
\n
"
,
"beta
\n
"
,
"gamma"
},
io
.
EOF
},
}
func
TestGrow
(
t
*
testing
.
T
)
{
x
:=
[]
byte
{
'x'
}
y
:=
[]
byte
{
'y'
}
...
...
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