Skip to content
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

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

Vampire
Copy link
Member

@Vampire Vampire commented Jan 20, 2025

Fixes #2087

Copy link
Member Author

Vampire commented Jan 20, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.


@Override
public boolean hasNext() {
return delegate.hasNext();
Copy link
Member

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.

Copy link
Member Author

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.)

@Vampire Vampire force-pushed the vampire/issue-2087 branch from c3ab9c3 to 8512640 Compare January 20, 2025 18:13
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 81.92%. Comparing base (792e592) to head (d32c867).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...rg/spockframework/runtime/DataIteratorFactory.java 88.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             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     
Files with missing lines Coverage Δ
...rg/spockframework/compiler/WhereBlockRewriter.java 94.74% <ø> (ø)
...rg/spockframework/runtime/DataIteratorFactory.java 81.77% <88.00%> (+0.54%) ⬆️

... and 3 files with indirect coverage changes

@Vampire Vampire requested a review from leonard84 January 20, 2025 18:30
@leonard84 leonard84 added this to the 2.4-M6 milestone Jan 21, 2025
@leonard84 leonard84 merged commit aa59979 into master Jan 21, 2025
52 checks passed
@leonard84 leonard84 deleted the vampire/issue-2087 branch January 21, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter block doesn't support data variables or shared fields
2 participants