Skip to content

Commit 7ed7e34

Browse files
author
Aaron Schlesinger
committed
fix(pkg/sshd/server_test.go): enhance test for gitPktLine
1 parent 1a3670a commit 7ed7e34

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/sshd/server_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package sshd
22

33
import (
44
"bytes"
5+
"fmt"
56
"net"
67
"testing"
78
"time"
@@ -26,7 +27,10 @@ func TestGitPktLine(t *testing.T) {
2627
str := "hello world"
2728
err := gitPktLine(b, str)
2829
assert.NoErr(t, err)
29-
t.Logf(string(b.Bytes()))
30+
outStr := string(b.Bytes())
31+
assert.True(t, len(outStr) > 4, "output string <= 4 chars")
32+
assert.Equal(t, outStr[:4], fmt.Sprintf("%04x", len(str)+4), "hex prefix")
33+
assert.Equal(t, outStr[4:], str, "remainder of string")
3034
}
3135

3236
// TestServer tests the SSH server.

0 commit comments

Comments
 (0)