Debian Codegraph @

plumbing/protocol/packp/common_test.go

raw
1 package packp
2
3 import (
4 "bytes"
5 "io"
6 "testing"
7
8 "github.com/go-git/go-git/v5/plumbing/format/pktline"
9
10 . "gopkg.in/check.v1"
11 )
12
13 func Test(t *testing.T) { TestingT(t) }
14
15 // returns a byte slice with the pkt-lines for the given payloads.
16 func pktlines(c *C, payloads ...string) []byte {
17 var buf bytes.Buffer
18 e := pktline.NewEncoder(&buf)
19
20 err := e.EncodeString(payloads...)
21 c.Assert(err, IsNil, Commentf("building pktlines for %v\n", payloads))
22
23 return buf.Bytes()
24 }
25
26 func toPktLines(c *C, payloads []string) io.Reader {
27 var buf bytes.Buffer
28 e := pktline.NewEncoder(&buf)
29 err := e.EncodeString(payloads...)
30 c.Assert(err, IsNil)
31
32 return &buf
33 }