8000 Array#index more logical and add a rdoc extension to the README files by robin850 · Pull Request #128 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Array#index more logical and add a rdoc extension to the README files #128

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

Closed
wants to merge 9 commits into from
Prev Previous commit
Add some tests for the Array#indexes method
  • Loading branch information
robin850 committed Jun 14, 2012
commit 69a6728df0ada1f69edb0c49448bd4405befe201
7 changes: 7 additions & 0 deletions test/ruby/test_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,13 @@ def test_index
assert_equal(1, a.index(99) {|x| x == 'cat' })
end

def test_indexes
a = @cls[ 'cat', 99, /a/, 99, @cls[ 1, 2, 3] ]
assert_equal(@cls[1, 3], a.indexes(99))
assert_equal(@cls[], a.indexes('car'))
assert_equal(@cls[4], a.indexes([1,2,3]))
end

def test_values_at
a = @cls[*('a'..'j').to_a]
assert_equal(@cls['a', 'c', 'e'], a.values_at(0, 2, 4))
Expand Down
0