diff options
author | Jeremy Stribling <strib@alum.mit.edu> | 2018-10-12 13:00:37 -0700 |
---|---|---|
committer | Jeremy Stribling <strib@alum.mit.edu> | 2018-10-12 13:03:19 -0700 |
commit | b3a3f0ab953608fb283392d4431a963622643b4c (patch) | |
tree | 90e71cb643748562b93c0b93c5d2088b48b52010 /storage/filesystem/object_test.go | |
parent | 5c471c34813577a420c1a5af61dd855f70badce1 (diff) | |
download | go-git-b3a3f0ab953608fb283392d4431a963622643b4c.tar.gz |
filesystem: add a new test for EncodedObjectSize
Suggested by taruti.
Signed-off-by: Jeremy Stribling <strib@alum.mit.edu>
Diffstat (limited to 'storage/filesystem/object_test.go')
-rw-r--r-- | storage/filesystem/object_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
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()) |