fix buffer reset
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -6,8 +6,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ interface {
|
var _ interface {
|
||||||
io.ReadCloser
|
io.Reader
|
||||||
io.ReadSeeker
|
io.Seeker
|
||||||
|
io.Writer
|
||||||
|
io.Closer
|
||||||
} = (*SeekerBuffer)(nil)
|
} = (*SeekerBuffer)(nil)
|
||||||
|
|
||||||
// SeekerBuffer is a ReadWriteCloser that supports seeking. It's intended to
|
// SeekerBuffer is a ReadWriteCloser that supports seeking. It's intended to
|
||||||
@@ -95,7 +97,7 @@ func (b *SeekerBuffer) Close() error {
|
|||||||
|
|
||||||
// Reset clears all the data out of the buffer and sets the read position to 0.
|
// Reset clears all the data out of the buffer and sets the read position to 0.
|
||||||
func (b *SeekerBuffer) Reset() {
|
func (b *SeekerBuffer) Reset() {
|
||||||
b.data = nil
|
b.data = b.data[:0]
|
||||||
b.pos = 0
|
b.pos = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ func TestSeekerBuffer_Reset(t *testing.T) {
|
|||||||
buf.pos = 2
|
buf.pos = 2
|
||||||
|
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
require.Nil(t, buf.data)
|
require.Equal(t, []byte{}, buf.data)
|
||||||
require.Equal(t, int64(0), buf.pos)
|
require.Equal(t, int64(0), buf.pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user