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

Method TestCorrectPackHeader

plumbing/format/packfile/encoder_test.go:32–45  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

30}
31
32func (s *EncoderSuite) TestCorrectPackHeader(c *C) {
33 h, err := s.enc.Encode([]plumbing.Hash{}, 10)
34 c.Assert(err, IsNil)
35
36 hb := [hash.Size]byte(h)
37
38 // PACK + VERSION + OBJECTS + HASH
39 expectedResult := []byte{'P', 'A', 'C', 'K', 0, 0, 0, 2, 0, 0, 0, 0}
40 expectedResult = append(expectedResult, hb[:]...)
41
42 result := s.buf.Bytes()
43
44 c.Assert(result, DeepEquals, expectedResult)
45}
46
47func (s *EncoderSuite) TestCorrectPackWithOneEmptyObject(c *C) {
48 o := &plumbing.MemoryObject{}

Callers

nothing calls this directly

Calls 2

EncodeMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected