From 7c37b56927ef4a6a4768c064efaff3627bbb6e6f Mon Sep 17 00:00:00 2001 From: aoright <102943475+aoright@users.noreply.github.com> Date: Wed, 19 Aug 2026 13:32:16 +0800 Subject: [PATCH] test: add unit test for JoinMessages with empty connection Signed-off-by: aoright <102943475+aoright@users.noreply.github.com> --- join_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/join_test.go b/join_test.go index 37bb30ff..479eaf1f 100644 --- a/join_test.go +++ b/join_test.go @@ -34,3 +34,16 @@ func TestJoinMessages(t *testing.T) { } } } + +func TestJoinMessagesEmpty(t *testing.T) { + var connBuf bytes.Buffer + rc := newTestConn(&connBuf, nil, false) + var result bytes.Buffer + _, err := io.Copy(&result, JoinMessages(rc, ",")) + if IsUnexpectedCloseError(err, CloseAbnormalClosure) { + t.Errorf("unexpected error %v", err) + } + if result.Len() != 0 { + t.Errorf("got %q, want empty", result.String()) + } +}