diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-05-13 05:24:19 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-05-13 05:24:19 +0000 |
commit | 8d773f686e7d33dd19f820a0dd31cf11e3368476 (patch) | |
tree | bc5c36143c8ce9a18b97093aa193324f64ce79f1 /test/ruby | |
parent | 60d5e3b196af91b84776c7c9f96aa9fc316175ef (diff) |
* 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/branches/ruby_1_8@8447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_array.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 3e63dd2f54..95cc5a5a58 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -98,4 +98,14 @@ class TestArray < Test::Unit::TestCase x.concat(x) assert_equal([1,2,3,1,2,3], 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 |