[PATCH] Enumerable min with nils
Reported by mainej | January 26th, 2008 @ 10:08 AM | in 1.0 preview
Enumerable doesn't always correctly find min if the enumerable object contains nils.
> bin/mspec spec/ruby/1.8/core/enumerable/min_spec.rb
Started
....F
1)
Enumerable#min returns the minimum for enumerables that contain nils FAILED
Expected true to equal nil
This patch fixes that.
> bin/mspec spec/ruby/1.8/core/enumerable/min_spec.rb
Started
.....
Finished in 0.070289 seconds
5 examples, 31 expectations, 0 failures, 0 errors
Comments and changes to this ticket
-

mainej January 26th, 2008 @ 10:09 AM
- no changes were found...
-

mainej May 2nd, 2008 @ 01:42 PM
NOTE! This is also a problem with Enumerable#min_by. I don't know how to create a spec for that, because min_by isn't defined by MRI.
-
Eero Saynatkari January 26th, 2008 @ 08:07 PM
- → State changed from new to resolved
Thanks for catching this! I have committed the spec patch as 313ee6. Please reference this commit hash when you talk to evan about commit access (well, in your case any of the commit hashes.)
For the fix I actually switched to the
Undefinedidiom. TheUndefinedobject is specifically intended to be used internally as an unambiguous placeholder/marker in cases wherenilmay be a legitimate value.I also committed specs and a fix for
#min_byand#max_byseparately. -
Eero Saynatkari May 3rd, 2008 @ 04:32 AM
- → Assigned user changed from to Eero Saynatkari
Old one, reclosing.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
