aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/protocol/packp/common_test.go')
-rw-r--r--plumbing/protocol/packp/common_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/plumbing/protocol/packp/common_test.go b/plumbing/protocol/packp/common_test.go
new file mode 100644
index 0000000..c055fee
--- /dev/null
+++ b/plumbing/protocol/packp/common_test.go
@@ -0,0 +1,33 @@
+package packp
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
+
+ . "gopkg.in/check.v1"
+)
+
+func Test(t *testing.T) { TestingT(t) }
+
+// returns a byte slice with the pkt-lines for the given payloads.
+func pktlines(c *C, payloads ...string) []byte {
+ var buf bytes.Buffer
+ e := pktline.NewEncoder(&buf)
+
+ err := e.EncodeString(payloads...)
+ c.Assert(err, IsNil, Commentf("building pktlines for %v\n", payloads))
+
+ return buf.Bytes()
+}
+
+func toPktLines(c *C, payloads []string) io.Reader {
+ var buf bytes.Buffer
+ e := pktline.NewEncoder(&buf)
+ err := e.EncodeString(payloads...)
+ c.Assert(err, IsNil)
+
+ return &buf
+}