forked from quic-go/quic-go
ackhandler: migrate ack-elicitng and send mode tests away from Ginkgo (#4862)
This commit is contained in:
@@ -1,35 +1,28 @@
|
||||
package ackhandler
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/quic-go/quic-go/internal/wire"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var _ = Describe("ack-eliciting frames", func() {
|
||||
for fl, el := range map[wire.Frame]bool{
|
||||
func TestAckElicitingFrames(t *testing.T) {
|
||||
testCases := map[wire.Frame]bool{
|
||||
&wire.AckFrame{}: false,
|
||||
&wire.ConnectionCloseFrame{}: false,
|
||||
&wire.DataBlockedFrame{}: true,
|
||||
&wire.PingFrame{}: true,
|
||||
&wire.ResetStreamFrame{}: true,
|
||||
&wire.StreamFrame{}: true,
|
||||
&wire.DatagramFrame{}: true,
|
||||
&wire.MaxDataFrame{}: true,
|
||||
&wire.MaxStreamDataFrame{}: true,
|
||||
} {
|
||||
f := fl
|
||||
e := el
|
||||
fName := reflect.ValueOf(f).Elem().Type().Name()
|
||||
|
||||
It("works for "+fName, func() {
|
||||
Expect(IsFrameAckEliciting(f)).To(Equal(e))
|
||||
})
|
||||
|
||||
It("HasAckElicitingFrames works for "+fName, func() {
|
||||
Expect(HasAckElicitingFrames([]Frame{{Frame: f}})).To(Equal(e))
|
||||
})
|
||||
&wire.StopSendingFrame{}: true,
|
||||
}
|
||||
})
|
||||
|
||||
for f, expected := range testCases {
|
||||
require.Equal(t, expected, IsFrameAckEliciting(f))
|
||||
require.Equal(t, expected, HasAckElicitingFrames([]Frame{{Frame: f}}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user