-
Notifications
You must be signed in to change notification settings - Fork 185
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
Implement beginless range #2155
Closed
Closed
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3975ef9
allow beginless Range creation and untag
9f6d450
Array#[] and #slice shared specs for beginless and endless ranges
0129ab8
Implement Array#[] and #slice for beginless ranges
b6f8373
Spec for beginless range to_a
9e9a9b0
Implement beginless range to_a
8233345
Specs for Array#[]= for beginless ranges
6787205
Specs for Array#slice! for beginless ranges
d43b09b
Specs for Array #fill and #values_at with beginless ranges
7cb1ea2
Fix Range#bsearch specs with infinity bounds
72cde59
Specs for Range#bsearch on beginless ranges
2273173
Implement Range#bsearch for beginless ranges
1315964
Implement Range#inspect for beginless ranges
6b54a2f
Array specs: replace Range.new with eval dot notation
1200be8
Specs for Range#{count, each, equal_value, first, inspect, max, min, …
3ab063a
Implement Range#{count, size, first, max, min} for beginless ranges
473bc1a
Use Primitive.nil? instead of beginless? and endless?
b145349
Range#count spec fix: Range#count runs infinitely on endless ranges i…
3483fb7
Array specs: remove extraneous nil during range creation
b07bcf0
Range#max spec version 2.7.2 -> 3.0
80ff0a2
Remove Primitive.infect from Range#inspect
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require_relative '../../spec_helper' | ||
|
||
describe "Range#count" do | ||
ruby_version_is "2.7" do | ||
it "returns Infinity for beginless ranges without arguments or blocks" do | ||
inf = Float::INFINITY | ||
eval("('a'...)").count.should == inf | ||
eval("(7..)").count.should == inf | ||
eval("(...'a')").count.should == inf | ||
eval("(...nil)").count.should == inf | ||
eval("(..10.0)").count.should == inf | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you remove the extra
nil
s here? Also happens in other specs.