MCPcopy Create free account
hub / github.com/go-git/go-git / test

Method test

plumbing/protocol/packp/advrefs_test.go:162–196  ·  view source on GitHub ↗
(c *C, in []string, exp []string, isEmpty bool)

Source from the content-addressed store, hash-verified

160var _ = Suite(&AdvRefsDecodeEncodeSuite{})
161
162func (s *AdvRefsDecodeEncodeSuite) test(c *C, in []string, exp []string, isEmpty bool) {
163 var err error
164 var input io.Reader
165 {
166 var buf bytes.Buffer
167 p := pktline.NewEncoder(&buf)
168 err = p.EncodeString(in...)
169 c.Assert(err, IsNil)
170 input = &buf
171 }
172
173 var expected []byte
174 {
175 var buf bytes.Buffer
176 p := pktline.NewEncoder(&buf)
177 err = p.EncodeString(exp...)
178 c.Assert(err, IsNil)
179
180 expected = buf.Bytes()
181 }
182
183 var obtained []byte
184 {
185 ar := NewAdvRefs()
186 c.Assert(ar.Decode(input), IsNil)
187 c.Assert(ar.IsEmpty(), Equals, isEmpty)
188
189 var buf bytes.Buffer
190 c.Assert(ar.Encode(&buf), IsNil)
191
192 obtained = buf.Bytes()
193 }
194
195 c.Assert(string(obtained), DeepEquals, string(expected))
196}
197
198func (s *AdvRefsDecodeEncodeSuite) TestNoHead(c *C) {
199 input := []string{

Callers 8

TestNoHeadMethod · 0.95
TestNoHeadSmartMethod · 0.95
TestNoHeadSmartBugMethod · 0.95
TestRefsMethod · 0.95
TestPeeledMethod · 0.95
TestAllMethod · 0.95
TestAllSmartMethod · 0.95
TestAllSmartBugMethod · 0.95

Calls 7

EncodeStringMethod · 0.95
DecodeMethod · 0.95
IsEmptyMethod · 0.95
EncodeMethod · 0.95
NewEncoderFunction · 0.92
NewAdvRefsFunction · 0.85
BytesMethod · 0.45

Tested by

no test coverage detected