Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jsonrpc2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestClientServer(t *testing.T) {
if err != nil {
t.Fatal("Listen:", err)
}
defer func() {
t.Cleanup(func() {
if lis == nil {
return // already closed
}
Expand All @@ -130,7 +130,7 @@ func TestClientServer(t *testing.T) {
t.Fatal(err)
}
}
}()
})

ha := testHandlerA{t: t}
go func() {
Expand Down Expand Up @@ -184,11 +184,11 @@ func TestClientServer(t *testing.T) {
func testClientServer(ctx context.Context, t *testing.T, stream jsonrpc2.ObjectStream) {
hb := testHandlerB{t: t}
cc := jsonrpc2.NewConn(ctx, stream, &hb)
defer func() {
t.Cleanup(func() {
if err := cc.Close(); err != nil {
t.Fatal(err)
}
}()
})

// Simple
const n = 100
Expand Down