From b3a3f0ab953608fb283392d4431a963622643b4c Mon Sep 17 00:00:00 2001 From: Jeremy Stribling Date: Fri, 12 Oct 2018 13:00:37 -0700 Subject: filesystem: add a new test for EncodedObjectSize Suggested by taruti. Signed-off-by: Jeremy Stribling --- storage/filesystem/object_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'storage/filesystem/object_test.go') diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go index 3a0cc4f..4e6bbfb 100644 --- a/storage/filesystem/object_test.go +++ b/storage/filesystem/object_test.go @@ -107,6 +107,20 @@ func (s *FsSuite) TestGetSizeFromPackfile(c *C) { }) } +func (s *FsSuite) TestGetSizeOfAllObjectFiles(c *C) { + fs := fixtures.ByTag(".git").One().DotGit() + o := NewObjectStorage(dotgit.New(fs), cache.NewObjectLRUDefault()) + + // Get the size of `tree_walker.go`. + err := o.ForEachObjectHash(func(h plumbing.Hash) error { + size, err := o.EncodedObjectSize(h) + c.Assert(err, IsNil) + c.Assert(size, Not(Equals), int64(0)) + return nil + }) + c.Assert(err, IsNil) +} + func (s *FsSuite) TestGetFromPackfileMultiplePackfiles(c *C) { fs := fixtures.ByTag(".git").ByTag("multi-packfile").One().DotGit() o := NewObjectStorage(dotgit.New(fs), cache.NewObjectLRUDefault()) -- cgit