vendor: update all dependencies to latest versions
This commit is contained in:
parent
8e83fb6fb9
commit
7d3a17725d
4878 changed files with 1974229 additions and 201215 deletions
36
vendor/github.com/pengsrc/go-shared/buffer/bytes_pool_test.go
generated
vendored
Normal file
36
vendor/github.com/pengsrc/go-shared/buffer/bytes_pool_test.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
package buffer
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuffers(t *testing.T) {
|
||||
const dummyData = "dummy data"
|
||||
p := NewBytesPool()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for g := 0; g < 10; g++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
for i := 0; i < 100; i++ {
|
||||
buf := p.Get()
|
||||
assert.Zero(t, buf.Len(), "Expected truncated buffer")
|
||||
assert.NotZero(t, buf.Cap(), "Expected non-zero capacity")
|
||||
|
||||
buf.AppendString(dummyData)
|
||||
assert.Equal(t, buf.Len(), len(dummyData), "Expected buffer to contain dummy data")
|
||||
|
||||
buf.Free()
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestGlobalBytesPool(t *testing.T) {
|
||||
assert.NotNil(t, GlobalBytesPool())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue