From 8f7126c77a2e93f1c801cec22efeb9284da5c2db Mon Sep 17 00:00:00 2001 From: outdead Date: Wed, 6 Jan 2021 01:44:15 +0300 Subject: [PATCH] Fix tests --- packet.go | 4 ++-- rcon_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packet.go b/packet.go index a145af6..2b63fa4 100644 --- a/packet.go +++ b/packet.go @@ -92,7 +92,7 @@ func (packet *Packet) WriteTo(w io.Writer) (n int64, err error) { // ReadFrom implements io.ReaderFrom for read a packet from r. func (packet *Packet) ReadFrom(r io.Reader) (n int64, err error) { if err := binary.Read(r, binary.LittleEndian, &packet.Size); err != nil { - return n, fmt.Errorf("rcon: read packet size %w", err) + return n, fmt.Errorf("rcon: read packet size: %w", err) } n += 4 @@ -102,7 +102,7 @@ func (packet *Packet) ReadFrom(r io.Reader) (n int64, err error) { } if err := binary.Read(r, binary.LittleEndian, &packet.ID); err != nil { - return n, fmt.Errorf("rcon: read packet id %w", err) + return n, fmt.Errorf("rcon: read packet id: %w", err) } n += 4 diff --git a/rcon_test.go b/rcon_test.go index 084ffc4..b49b493 100644 --- a/rcon_test.go +++ b/rcon_test.go @@ -190,7 +190,7 @@ func TestConn_Execute(t *testing.T) { conn.Close() result, err := conn.Execute("help") - wantErrMsg := fmt.Sprintf("set tcp %s: use of closed network connection", conn.LocalAddr()) + wantErrMsg := fmt.Sprintf("rcon: set tcp %s: use of closed network connection", conn.LocalAddr()) if err == nil || err.Error() != wantErrMsg { t.Errorf("got err %q, want to contain %q", err, wantErrMsg) } @@ -211,7 +211,7 @@ func TestConn_Execute(t *testing.T) { defer conn.Close() result, err := conn.Execute("deadline") - wantErrMsg := fmt.Sprintf("read tcp %s->%s: i/o timeout", conn.LocalAddr(), conn.RemoteAddr()) + wantErrMsg := fmt.Sprintf("rcon: read packet size: read tcp %s->%s: i/o timeout", conn.LocalAddr(), conn.RemoteAddr()) if err == nil || err.Error() != wantErrMsg { t.Errorf("got err %q, want to contain %q", err, wantErrMsg) }