diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-23 16:18:54 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-23 16:18:54 +0200 |
commit | 11a24261b21f5f0e9e8304bcbb4a0b27ff5cbbb5 (patch) | |
tree | a9980da45676fd307cfc9ad5fd222d049909b34d /core | |
parent | a8c0b15da2f628efb304bc1d9aa79b49144f98a1 (diff) | |
download | go-git-11a24261b21f5f0e9e8304bcbb4a0b27ff5cbbb5.tar.gz |
fix tag iter test
Diffstat (limited to 'core')
-rw-r--r-- | core/object.go | 2 | ||||
-rw-r--r-- | core/object_test.go | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/core/object.go b/core/object.go index 06137d2..30beff8 100644 --- a/core/object.go +++ b/core/object.go @@ -274,7 +274,7 @@ func ForEachIterator(iter bareIterator, cb func(Object) error) error { return nil } - return nil + return err } } } diff --git a/core/object_test.go b/core/object_test.go index 08c5dd2..d087aae 100644 --- a/core/object_test.go +++ b/core/object_test.go @@ -1,6 +1,10 @@ package core -import . "gopkg.in/check.v1" +import ( + "fmt" + + . "gopkg.in/check.v1" +) type ObjectSuite struct{} @@ -137,6 +141,18 @@ func (s *ObjectSuite) TestObjectSliceIterStop(c *C) { c.Assert(err, IsNil) } +func (s *ObjectSuite) TestObjectSliceIterError(c *C) { + i := NewObjectSliceIter([]Object{ + &MemoryObject{h: NewHash("4921e391f1128010a2d957f8db15c5e729ccf94a")}, + }) + + err := i.ForEach(func(Object) error { + return fmt.Errorf("a random error") + }) + + c.Assert(err, NotNil) +} + type MockObjectStorage struct{} func (o *MockObjectStorage) NewObject() Object { |