diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-11 18:07:29 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-11 18:07:29 +0200 |
commit | 1f64d789038594098ea2c9cf796391f101d0bea5 (patch) | |
tree | 50fb530fc2e48560e70489dc81758f54822dcf50 /formats/packfile/parser_test.go | |
parent | c1e277a7ca75ff84741d75ad45e29a2ff3e633e3 (diff) | |
download | go-git-1f64d789038594098ea2c9cf796391f101d0bea5.tar.gz |
core: new MemoryObject, move from memory.Object, packfile.Parser, base on new ObjectStorage interface
Diffstat (limited to 'formats/packfile/parser_test.go')
-rw-r--r-- | formats/packfile/parser_test.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/formats/packfile/parser_test.go b/formats/packfile/parser_test.go index ec9b19a..c2b99f1 100644 --- a/formats/packfile/parser_test.go +++ b/formats/packfile/parser_test.go @@ -8,7 +8,6 @@ import ( . "gopkg.in/check.v1" "gopkg.in/src-d/go-git.v4/core" - "gopkg.in/src-d/go-git.v4/storage/memory" ) const ( @@ -238,9 +237,10 @@ func (s *ParserSuite) TestReadNonDeltaObjectContent(c *C) { _, _, err = p.ReadObjectTypeAndLength() c.Assert(err, IsNil, com) - cont, err := p.ReadNonDeltaObjectContent() + obj := &core.MemoryObject{} + err = p.ReadNonDeltaObjectContent(obj) c.Assert(err, IsNil, com) - c.Assert(cont, DeepEquals, test.expected, com) + c.Assert(obj.Content(), DeepEquals, test.expected, com) } } @@ -293,10 +293,11 @@ func (s *ParserSuite) TestReadOFSDeltaObjectContent(c *C) { err = fix.seek(beforeJumpSize) c.Assert(err, IsNil, com) - cont, typ, err := p.ReadOFSDeltaObjectContent(test.offset) + obj := &core.MemoryObject{} + err = p.ReadOFSDeltaObjectContent(obj, test.offset) c.Assert(err, IsNil, com) - c.Assert(typ, Equals, test.expType, com) - c.Assert(cont, DeepEquals, test.expContent, com) + c.Assert(obj.Type(), Equals, test.expType, com) + c.Assert(obj.Content(), DeepEquals, test.expContent, com) } } @@ -356,17 +357,18 @@ func (s *ParserSuite) TestReadREFDeltaObjectContent(c *C) { err = fix.seek(beforeHash) c.Assert(err, IsNil, com) - cont, typ, err := p.ReadREFDeltaObjectContent() + obj := &core.MemoryObject{} + err = p.ReadREFDeltaObjectContent(obj) c.Assert(err, IsNil, com) - c.Assert(typ, Equals, test.expType, com) - c.Assert(cont, DeepEquals, test.expContent, com) + c.Assert(obj.Type(), Equals, test.expType, com) + c.Assert(obj.Content(), DeepEquals, test.expContent, com) p.ForgetAll() } } -func newObject(t core.ObjectType, c []byte) *memory.Object { - return memory.NewObject(t, int64(len(c)), c) +func newObject(t core.ObjectType, c []byte) core.Object { + return core.NewMemoryObject(t, int64(len(c)), c) } func (s *ParserSuite) TestReadHeaderBadSignatureError(c *C) { |