-
Notifications
You must be signed in to change notification settings - Fork 605
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
Spec size method calls on Enumerator instances returned by Enumerable methods. #3318
Conversation
… Enumerable methods that return an Enumerator.
The tests check if the size method on the resulting Enumerator instance returns the correct value.
The tests check if the size method on the resulting Enumerator instance returns the correct value.
@fmfdias Take a look at |
Hi @jemc I've tagged them as failing. Cheers |
Travis seems to fail due to a race condition unrelated to these changes (https://travis-ci.org/rubinius/rubinius/jobs/50984264), otherwise looks good to me 👍 |
@@ -44,4 +44,9 @@ | |||
multi = EnumerableSpecs::YieldsMulti.new | |||
multi.drop_while {|e| e != [6, 7, 8, 9] }.should == [[6, 7, 8, 9]] | |||
end | |||
|
|||
it "returns the nil as size when no block is given" do |
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 think this should just be "returns nil as size...", unless nil
is suddenly a person/object 😄
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.
Got caught, hehehe. I think it could also give a nice a movie title... 'The Nil' 😄
Spec size method calls on Enumerator instances returned by Enumerable methods.
Hi,
A few days ago I've opened this issue regarding calling size on the Enumerator instance that results on calling the Enumerable#each_slice without a block.
At the time I only checked that method. A few days after I thought on checking other similar Enumerable methods that return an Enumerator, on MRI 2.1.5, Rubinius 2.5.2 and JRuby 9.0.0.0 pre1.
Rubinius returns nil on all the calls which is not the behavior of MRI. JRuby was only failing on each_slide.
Unfortunately I wasn't able to finish it and inform you guys of it before the issue was handled and closed.
I took a look at the tests that were added for the each_slice fix pull request and, based on it, decided to transform the checks I made in specs that could be useful.
I tried to cover all the Enumerable methods that I could find. I also checked the Array class and added similar tests to the methods implemented/overridden by the Array class that are on the same situation.
I hope it helps.
Thank you!