1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-03 22:24:14 +02:00

Changed logic of iterator termination (#330)

This commit is contained in:
Tim Voronov
2019-07-13 13:39:01 -04:00
committed by GitHub
parent b1e9505dd1
commit 9756f0dc5a
21 changed files with 87 additions and 86 deletions

View File

@@ -59,7 +59,7 @@ func (i *testCollectionIterator) Next(ctx context.Context) (core.Value, core.Val
i.position++
if i.position > i.values.Length() {
return values.None, values.None, nil
return values.None, values.None, core.ErrNoMoreData
}
return i.values.Get(i.position), i.position, nil
@@ -104,15 +104,18 @@ func TestDataSource(t *testing.T) {
nextScope := scope
for {
pos++
nextScope, err = out.Next(ctx, nextScope.Fork())
So(err, ShouldBeNil)
if err != nil {
if core.IsNoMoreData(err) {
break
}
if nextScope == nil {
break
So(err, ShouldBeNil)
}
pos++
actualV, _ := nextScope.GetVariable(collections.DefaultValueVar)
actualK, _ := nextScope.GetVariable(collections.DefaultKeyVar)