mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_array.rb: add test for find_all. (based on Daniel Berger's patch)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3d240686f3
commit
49a84b0867
1 changed files with 10 additions and 0 deletions
|
@ -126,4 +126,14 @@ class TestArray < Test::Unit::TestCase
|
|||
assert_equal([1, 2, 3, 4, 5], x.push(5))
|
||||
assert_equal([1, 2, 3, 4, 5], x)
|
||||
end
|
||||
|
||||
def test_find_all
|
||||
assert_respond_to([], :find_all)
|
||||
assert_respond_to([], :select) # Alias
|
||||
assert_equal([], [].find_all{ |obj| obj == "foo"})
|
||||
|
||||
x = ["foo", "bar", "baz", "baz", 1, 2, 3, 3, 4]
|
||||
assert_equal(["baz","baz"], x.find_all{ |obj| obj == "baz" })
|
||||
assert_equal([3,3], x.find_all{ |obj| obj == 3 })
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue