Skip to content

Commit 9aa7833

Browse files
author
Yorick Peterse
committedJul 24, 2015
Added failing Range#bsearch specs
These are taken from the ones mentioned by @heftig in #3458.
1 parent ce1791f commit 9aa7833

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎spec/ruby/core/range/bsearch_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
(0..4).bsearch { |x| x >= 2 }.should == 2
4646
(-1..4).bsearch { |x| x >= 1 }.should == 1
4747
end
48+
49+
it "returns the last element if the block returns true for the last element" do
50+
(0..4).bsearch { |x| x >= 4 }.should == 4
51+
(0...4).bsearch { |x| x >= 3 }.should == 3
52+
end
4853
end
4954

5055
context "with a block returning negative, zero, positive numbers" do
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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 commit comments

Comments
 (0)
Please sign in to comment.