MCPcopy
hub / github.com/go-git/go-git / TestDecodeCacheTree

Method TestDecodeCacheTree

plumbing/format/index/decoder_test.go:80–99  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

78}
79
80func (s *IndexSuite) TestDecodeCacheTree(c *C) {
81 f, err := fixtures.Basic().One().DotGit().Open("index")
82 c.Assert(err, IsNil)
83 defer func() { c.Assert(f.Close(), IsNil) }()
84
85 idx := &Index{}
86 d := NewDecoder(f)
87 err = d.Decode(idx)
88 c.Assert(err, IsNil)
89
90 c.Assert(idx.Entries, HasLen, 9)
91 c.Assert(idx.Cache.Entries, HasLen, 5)
92
93 for i, expected := range expectedEntries {
94 c.Assert(idx.Cache.Entries[i].Path, Equals, expected.Path)
95 c.Assert(idx.Cache.Entries[i].Entries, Equals, expected.Entries)
96 c.Assert(idx.Cache.Entries[i].Trees, Equals, expected.Trees)
97 c.Assert(idx.Cache.Entries[i].Hash.String(), Equals, expected.Hash.String())
98 }
99}
100
101var expectedEntries = []TreeEntry{
102 {Path: "", Entries: 9, Trees: 4, Hash: plumbing.NewHash("a8d315b2b1c615d43042c3a62402b8a54288cf5c")},

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
NewDecoderFunction · 0.70
CloseMethod · 0.65
StringMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected