aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-23 16:18:54 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-23 16:18:54 +0200
commit11a24261b21f5f0e9e8304bcbb4a0b27ff5cbbb5 (patch)
treea9980da45676fd307cfc9ad5fd222d049909b34d /core
parenta8c0b15da2f628efb304bc1d9aa79b49144f98a1 (diff)
downloadgo-git-11a24261b21f5f0e9e8304bcbb4a0b27ff5cbbb5.tar.gz
fix tag iter test
Diffstat (limited to 'core')
-rw-r--r--core/object.go2
-rw-r--r--core/object_test.go18
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 {