mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enum.c (enum_find_index): Add support for find_index(obj);
[ruby-dev:34313]. * array.c (rb_ary_index): Define find_index as an alias to index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd0aaf71dc
commit
033a32b4c1
4 changed files with 56 additions and 15 deletions
|
@ -43,8 +43,10 @@ class TestEnumerable < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_find_index
|
||||
assert_equal(1, @obj.find_index(2))
|
||||
assert_equal(1, @obj.find_index {|x| x % 2 == 0 })
|
||||
assert_equal(nil, @obj.find_index {|x| false })
|
||||
assert_raise(ArgumentError) { @obj.find_index(0, 1) }
|
||||
end
|
||||
|
||||
def test_find_all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue