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 | 8d773f686e7d33dd19f820a0dd31cf11e3368476 (patch) | |
tree | bc5c36143c8ce9a18b97093aa193324f64ce79f1 | |
parent | 60d5e3b196af91b84776c7c9f96aa9fc316175ef (diff) |
* 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
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | test/ruby/test_array.rb | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -2,6 +2,8 @@ Fri May 13 12:28:43 2005 Daniel Berger <djberge@qwest.com> * 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 <usa@ruby-lang.org> * 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 |