You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/core/iox/bufferpool_test.go

16 lines
275 B
Go

4 years ago
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)
}