aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-05 19:55:01 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-05 19:55:01 +0200
commit19da30a8ff233285a79df9f1da8b0d88d99eb626 (patch)
treebdb2313cc29381afbad9af75bd273c5ec6d9f24b /storage/filesystem/object_test.go
parent65427f64599e9383ab926aed75fc02f2db32022d (diff)
downloadgo-git-19da30a8ff233285a79df9f1da8b0d88d99eb626.tar.gz
core: ObjectStorage.Writer
Diffstat (limited to 'storage/filesystem/object_test.go')
-rw-r--r--storage/filesystem/object_test.go17
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}