diff options
Diffstat (limited to 'test')
-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 |