From 8d773f686e7d33dd19f820a0dd31cf11e3368476 Mon Sep 17 00:00:00 2001 From: ocean Date: Fri, 13 May 2005 05:24:19 +0000 Subject: * 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 --- test/ruby/test_array.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') 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 -- cgit v1.2.3