Fix Err fallout for graph/iterator.And iterator
This commit is contained in:
parent
c156fd6b1b
commit
742277e72e
2 changed files with 25 additions and 1 deletions
|
|
@ -15,6 +15,7 @@
|
|||
package iterator
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/google/cayley/graph"
|
||||
|
|
@ -138,5 +139,20 @@ func TestAllIterators(t *testing.T) {
|
|||
if and.Next() {
|
||||
t.Error("Too many values")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAndIteratorErr(t *testing.T) {
|
||||
retErr := errors.New("unique")
|
||||
allErr := newTestIterator(false, retErr)
|
||||
|
||||
and := NewAnd()
|
||||
and.AddSubIterator(allErr)
|
||||
and.AddSubIterator(NewInt64(1, 5))
|
||||
|
||||
if and.Next() != false {
|
||||
t.Errorf("And iterator did not pass through initial 'false'")
|
||||
}
|
||||
if and.Err() != retErr {
|
||||
t.Errorf("And iterator did not pass through underlying Err")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue