diff --git a/ChangeLog b/ChangeLog index b6c779c960..9766858418 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Fri May 13 12:28:43 2005 Daniel Berger * array.c (rb_ary_select): can remove argc check. [ruby-core:4911] + * test/ruby/test_array.rb: add test for find_all. + Fri May 13 11:29:00 2005 NAKAMURA Usaku * eval.c (unknown_node): add volatile directive to prototype. 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