From 49a84b08672f6023a4fdf3045ef0cc03244f1255 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/trunk@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 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 -- cgit v1.2.3