-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix filter blocks with shared fields and derived data variables (#2087) #2088
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
spock-core/src/main/java/org/spockframework/runtime/DataIteratorFactory.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public boolean hasNext() { | ||
return delegate.hasNext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really correct? What happens if next is filtered? Shouldn't we track whether there is a next? So, moving the next calculation into a computeNext()
method that is called by hasNext()
or next()
if the computedNext
value is unset. If it is set then next()
will return it and unset it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say it is fine.
It is the same as before.
It works thanks to https://github.com/spockframework/spock/blob/master/spock-core/src/main/java/org/spockframework/runtime/extension/IDataDriver.java#L36-L39.
And we also have tests that skipping the last iteration works. (Because there was then a problem at a different place, i. e. when the data iterators are exhausted.)
c3ab9c3
to
8512640
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2088 +/- ##
============================================
+ Coverage 81.89% 81.92% +0.03%
Complexity 4687 4687
============================================
Files 452 452
Lines 14666 14678 +12
Branches 1846 1847 +1
============================================
+ Hits 12010 12025 +15
Misses 1972 1972
+ Partials 684 681 -3
|
Fixes #2087