diff options
Diffstat (limited to 'storage/filesystem/object_test.go')
-rw-r--r-- | storage/filesystem/object_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go index 5752f79..78ec20c 100644 --- a/storage/filesystem/object_test.go +++ b/storage/filesystem/object_test.go @@ -2,6 +2,7 @@ package filesystem import ( "fmt" + "io" "io/ioutil" "os" "reflect" @@ -62,6 +63,22 @@ func (s *FsSuite) TearDownSuite(c *C) { } } +func (s *FsSuite) TestWriter(c *C) { + r, err := os.Open("../../formats/packfile/fixtures/git-fixture.ofs-delta") + c.Assert(err, IsNil) + + o := &ObjectStorage{} + w, err := o.Writer() + c.Assert(err, IsNil) + + n, err := io.Copy(w, r) + c.Assert(err, IsNil) + c.Check(n, Equals, int64(85300)) + + c.Assert(o.index, HasLen, 28) + c.Assert(w.Close(), IsNil) +} + func (s *FsSuite) TestHashNotFound(c *C) { sto := s.newObjectStorage(c, "binary-relations") types := []core.ObjectType{core.AnyObject, core.TagObject, core.CommitObject, core.BlobObject, core.TreeObject} |