mirror of
https://github.com/xtaci/smux.git
synced 2024-04-21 10:51:48 +00:00
adjust test function relates to https://github.com/xtaci/smux/issues/55
This commit is contained in:
+2
-8
@@ -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()")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user