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 | 49a84b08672f6023a4fdf3045ef0cc03244f1255 (patch) | |
tree | 29b53c271f479d268d50cf7f4020dba70f530588 | |
parent | 3d240686f3c80d97ee3e8d1bd6c0e2f345180717 (diff) | |
download | ruby-49a84b08672f6023a4fdf3045ef0cc03244f1255.tar.gz |
* 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
-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 79e658fa85..aebf360260 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -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 |