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

Method TestStats

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

Source from the content-addressed store, hash-verified

23var _ = Suite(&CommitStatsSuite{})
24
25func (s *CommitStatsSuite) TestStats(c *C) {
26 r, hash := s.writeHistory(c, []byte("foo\n"), []byte("foo\nbar\n"))
27
28 aCommit, err := r.CommitObject(hash)
29 c.Assert(err, IsNil)
30
31 fileStats, err := aCommit.StatsContext(context.Background())
32 c.Assert(err, IsNil)
33
34 c.Assert(fileStats[0].Name, Equals, "foo")
35 c.Assert(fileStats[0].Addition, Equals, 1)
36 c.Assert(fileStats[0].Deletion, Equals, 0)
37 c.Assert(fileStats[0].String(), Equals, " foo | 1 +\n")
38}
39
40func (s *CommitStatsSuite) TestStats_RootCommit(c *C) {
41 r, hash := s.writeHistory(c, []byte("foo\n"))

Callers

nothing calls this directly

Calls 4

writeHistoryMethod · 0.95
CommitObjectMethod · 0.80
StatsContextMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected