mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Add gosimple linter
Update gometalinter Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
@@ -6,6 +6,9 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestBufioReaderPoolGetWithNoReaderShouldCreateOne(t *testing.T) {
|
||||
@@ -92,22 +95,16 @@ func TestBufioWriterPoolPutAndGet(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
bw := bufio.NewWriter(buf)
|
||||
writer := BufioWriter32KPool.Get(bw)
|
||||
if writer == nil {
|
||||
t.Fatalf("BufioReaderPool should not return a nil writer.")
|
||||
}
|
||||
require.NotNil(t, writer)
|
||||
|
||||
written, err := writer.Write([]byte("foobar"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if written != 6 {
|
||||
t.Fatalf("Should have written 6 bytes, but wrote %v bytes", written)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 6, written)
|
||||
|
||||
// Make sure we Flush all the way ?
|
||||
writer.Flush()
|
||||
bw.Flush()
|
||||
if len(buf.Bytes()) != 6 {
|
||||
t.Fatalf("The buffer should contain 6 bytes ('foobar') but contains %v ('%v')", buf.Bytes(), string(buf.Bytes()))
|
||||
}
|
||||
assert.Len(t, buf.Bytes(), 6)
|
||||
// Reset the buffer
|
||||
buf.Reset()
|
||||
BufioWriter32KPool.Put(writer)
|
||||
|
||||
Reference in New Issue
Block a user