MCPcopy Index your code
hub / github.com/go-git/go-git / TestStats_RootCommit

Method TestStats_RootCommit

plumbing/object/commit_stats_test.go:40–54  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

38}
39
40func (s *CommitStatsSuite) TestStats_RootCommit(c *C) {
41 r, hash := s.writeHistory(c, []byte("foo\n"))
42
43 aCommit, err := r.CommitObject(hash)
44 c.Assert(err, IsNil)
45
46 fileStats, err := aCommit.Stats()
47 c.Assert(err, IsNil)
48
49 c.Assert(fileStats, HasLen, 1)
50 c.Assert(fileStats[0].Name, Equals, "foo")
51 c.Assert(fileStats[0].Addition, Equals, 1)
52 c.Assert(fileStats[0].Deletion, Equals, 0)
53 c.Assert(fileStats[0].String(), Equals, " foo | 1 +\n")
54}
55
56func (s *CommitStatsSuite) TestStats_WithoutNewLine(c *C) {
57 r, hash := s.writeHistory(c, []byte("foo\nbar"), []byte("foo\nbar\n"))

Callers

nothing calls this directly

Calls 4

writeHistoryMethod · 0.95
CommitObjectMethod · 0.80
StringMethod · 0.65
StatsMethod · 0.45

Tested by

no test coverage detected