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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user