diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-09 17:19:40 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-09 17:19:40 +0200 |
commit | a951c2b1708c8b32d92aa627bc2ed7f50dd6a91a (patch) | |
tree | 35f65766bae251223786576df3b04ea7bafe3d2b /core/object_test.go | |
parent | f09fb50cb092c241df4c0bd25c6755e6132e473e (diff) | |
download | go-git-a951c2b1708c8b32d92aa627bc2ed7f50dd6a91a.tar.gz |
core: MultiObjectIter
Diffstat (limited to 'core/object_test.go')
-rw-r--r-- | core/object_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/object_test.go b/core/object_test.go new file mode 100644 index 0000000..c9f4f2c --- /dev/null +++ b/core/object_test.go @@ -0,0 +1,31 @@ +package core + +import . "gopkg.in/check.v1" + +type ObjectSuite struct{} + +var _ = Suite(&ObjectSuite{}) + +func (s *ObjectSuite) TestMultiObjectIterNext(c *C) { + expected := []Object{ + &MemoryObject{}, + &MemoryObject{}, + &MemoryObject{}, + &MemoryObject{}, + &MemoryObject{}, + &MemoryObject{}, + } + + iter := NewMultiObjectIter([]ObjectIter{ + NewObjectSliceIter(expected[0:2]), + NewObjectSliceIter(expected[2:4]), + NewObjectSliceIter(expected[4:5]), + }) + + var i int + iter.ForEach(func(o Object) error { + c.Assert(o, Equals, expected[i]) + i++ + return nil + }) +} |