bufferpool_test.go 275 B

123456789101112131415
  1. package iox
  2. import (
  3. "bytes"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestBufferPool(t *testing.T) {
  8. capacity := 1024
  9. pool := NewBufferPool(capacity)
  10. pool.Put(bytes.NewBuffer(make([]byte, 0, 2*capacity)))
  11. assert.True(t, pool.Get().Cap() <= capacity)
  12. }