mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 01:30:25 +08:00
16 lines
275 B
Go
16 lines
275 B
Go
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)
|
|
}
|