forked from quic-go/quic-go
implement a buffer pool for STREAM frames
This commit is contained in:
24
internal/wire/pool_test.go
Normal file
24
internal/wire/pool_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package wire
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Pool", func() {
|
||||
It("gets and puts STREAM frames", func() {
|
||||
f := getStreamFrame()
|
||||
putStreamFrame(f)
|
||||
})
|
||||
|
||||
It("panics when putting a STREAM frame with a wrong capacity", func() {
|
||||
f := getStreamFrame()
|
||||
f.Data = []byte("foobar")
|
||||
Expect(func() { putStreamFrame(f) }).To(Panic())
|
||||
})
|
||||
|
||||
It("accepts STREAM frames not from the buffer, but ignores them", func() {
|
||||
f := &StreamFrame{Data: []byte("foobar")}
|
||||
putStreamFrame(f)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user