go-zero/core/iox/bufferpool_test.go

16 lines
275 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package iox
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBufferPool(t *testing.T) {
capacity := 1024
pool := NewBufferPool(capacity)
pool.Put(bytes.NewBuffer(make([]byte, 0, 2*capacity)))
assert.True(t, pool.Get().Cap() <= capacity)
}