This commit is contained in:
xtaci
2019-08-28 11:25:59 +08:00
parent 67e00e88db
commit b71f58ec76
+2 -8
View File
@@ -61,16 +61,10 @@ func TestAllocPut(t *testing.T) {
func TestAllocPutThenGet(t *testing.T) {
alloc := NewAllocator()
data := alloc.Get(4)
for k := range data {
data[k] = 99
}
alloc.Put(data)
newData := alloc.Get(4)
for k := range newData {
if newData[k] != 99 {
t.Fatal("cannot fetch written []bytes from pool")
}
if cap(data) != cap(newData) {
t.Fatal("different cap while alloc.Get()")
}
}