Navigation Menu

Skip to content

Commit

Permalink
Added failing Range#bsearch specs
Browse files Browse the repository at this point in the history
These are taken from the ones mentioned by @heftig in #3458.
  • Loading branch information
Yorick Peterse committed Jul 24, 2015
1 parent ce1791f commit 9aa7833
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/ruby/core/range/bsearch_spec.rb
Expand Up @@ -45,6 +45,11 @@
(0..4).bsearch { |x| x >= 2 }.should == 2
(-1..4).bsearch { |x| x >= 1 }.should == 1
end

it "returns the last element if the block returns true for the last element" do
(0..4).bsearch { |x| x >= 4 }.should == 4
(0...4).bsearch { |x| x >= 3 }.should == 3
end
end

context "with a block returning negative, zero, positive numbers" do
Expand Down
1 change: 1 addition & 0 deletions spec/tags/ruby/core/range/bsearch_tags.txt
@@ -0,0 +1 @@
fails:Range#bsearch with Integer values with a block returning true or false returns the last element if the block returns true for the last element

0 comments on commit 9aa7833

Please sign in to comment.