diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-30 05:11:03 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-01-30 05:11:03 +0000 |
commit | 39048aca7592a4096380f45f421bad578b61efb8 (patch) | |
tree | 43d9ac2aed6a5abd87a5cf28c40257e4dca016b2 /test/ruby/test_array.rb | |
parent | ddea0c823239d2eb9b699dc00adf6b0963913d27 (diff) | |
download | ruby-39048aca7592a4096380f45f421bad578b61efb8.tar.gz |
* array.c (rb_ary_bsearch): Return enumerator if no block [#7725]
* range.c (range_bsearch): ditto
* test/ruby/test_array.rb: Test for above
* test/ruby/test_range.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 6c7f920d79..ae0f76c970 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2249,6 +2249,12 @@ class TestArray < Test::Unit::TestCase assert_raise(ArgumentError) { a.rotate!(1, 1) } end + def test_bsearch_with_no_block + enum = [1, 2, 42, 100, 666].bsearch + assert_nil enum.size + assert_equal 42, enum.each{|x| x >= 33 } + end + def test_bsearch_in_find_minimum_mode a = [0, 4, 7, 10, 12] assert_equal(4, a.bsearch {|x| x >= 4 }) |