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

Added SeqTest.verifyIteratorValidity() method #310

Merged
merged 4 commits into from Jul 28, 2017

Conversation

@tlinkowski
Copy link
Contributor

commented Apr 30, 2017

I propose a new private method in SeqTest:

void verifyIteratorValidity(int expectedCount, Seq<T> source, Function<Seq<T>, Seq<?>> operation)

This method verifies whether our non-terminal Seq operations (e.g. limitWhile, partition, splitAt) behave as expected, i.e.:

  • whether every call to Spliterator.tryAdvance that returns true actually calls given action
  • whether the number of elements fetched from the source sequence is equal to expectedCount
  • whether calling redundantly Iterator.hasNext does not fetch any extra element from the source sequence (such calls are valid and should be "safe")

Using this method I detected two defects: #308 and #309.

@lukaseder

This comment has been minimized.

Copy link
Member

commented Jul 28, 2017

A late thank you very much for this suggestion. I agree with these tests, very useful.

@lukaseder lukaseder merged commit 6068ab3 into jOOQ:master Jul 28, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lukaseder

This comment has been minimized.

Copy link
Member

commented Jul 28, 2017

Again, I really like this utility. It will help us validate the laziness of a lot of future features... Thanks again!

@tlinkowski tlinkowski deleted the tlinkowski:verifyIteratorValidity branch Jul 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.