diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-31 11:21:22 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2018-10-31 11:21:22 +0100 |
commit | 3052df3d6cc39257d1c9d938ddfb5b862b913999 (patch) | |
tree | 43ceb86ff8c4766cd872e535f01f9a3c7db3583a /plumbing/storer/reference_test.go | |
parent | ff04a1db6fcec4ab06c65f65fff1cfbc8925ae8c (diff) | |
download | go-git-3052df3d6cc39257d1c9d938ddfb5b862b913999.tar.gz |
plumbing: storer, new NewMultiReferenceIter
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'plumbing/storer/reference_test.go')
-rw-r--r-- | plumbing/storer/reference_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plumbing/storer/reference_test.go b/plumbing/storer/reference_test.go index 490ec95..1d02c22 100644 --- a/plumbing/storer/reference_test.go +++ b/plumbing/storer/reference_test.go @@ -172,3 +172,26 @@ func (s *ReferenceSuite) TestReferenceFilteredIterForEachStop(c *C) { c.Assert(count, Equals, 1) } + +func (s *ReferenceSuite) TestMultiReferenceIterForEach(c *C) { + i := NewMultiReferenceIter( + []ReferenceIter{ + NewReferenceSliceIter([]*plumbing.Reference{ + plumbing.NewReferenceFromStrings("foo", "foo"), + }), + NewReferenceSliceIter([]*plumbing.Reference{ + plumbing.NewReferenceFromStrings("bar", "bar"), + }), + }, + ) + + var result []string + err := i.ForEach(func(r *plumbing.Reference) error { + result = append(result, r.Name().String()) + return nil + }) + + c.Assert(err, IsNil) + c.Assert(result, HasLen, 2) + c.Assert(result, DeepEquals, []string{"foo", "bar"}) +} |