From bbc1fe07d7675c26ca6e4ba77c36b98742855757 Mon Sep 17 00:00:00 2001 From: Mingye Chen Date: Fri, 17 Jan 2025 17:54:56 -0700 Subject: [PATCH] Add panic test --- u_parrot_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 u_parrot_test.go diff --git a/u_parrot_test.go b/u_parrot_test.go new file mode 100644 index 00000000..8e4071cc --- /dev/null +++ b/u_parrot_test.go @@ -0,0 +1,38 @@ +package quic + +import ( + "context" + "net" + "testing" + "time" + + tls "github.com/refraction-networking/utls" +) + +func testDialPanic(t *testing.T, id QUICID) { + + quicSpec, err := QUICID2Spec(id) + if err != nil { + t.Fatal(err) + } + + pktConn, err := net.ListenUDP("udp", nil) + if err != nil { + t.Fatal(err) + } + + tr := &UTransport{Transport: &Transport{Conn: pktConn}, QUICSpec: &quicSpec} + + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + tr.Dial(ctx, &net.UDPAddr{IP: net.IP{127, 0, 0, 1}, Port: 1234}, &tls.Config{}, &Config{}) + +} + +func TestDialPanic(t *testing.T) { + + for _, s := range []QUICID{QUICChrome_115, QUICFirefox_116} { + testDialPanic(t, s) + } + +}