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 | 9d2ffe5752c594adda19815aa65a8fd69d9177da (patch) | |
tree | 29b53c271f479d268d50cf7f4020dba70f530588 /test/ruby | |
parent | 303aff92142a8ffbe869465d11b140ebcf95d243 (diff) | |
download | ruby-9d2ffe5752c594adda19815aa65a8fd69d9177da.tar.gz ruby-9d2ffe5752c594adda19815aa65a8fd69d9177da.tar.xz ruby-9d2ffe5752c594adda19815aa65a8fd69d9177da.zip |
* test/ruby/test_array.rb: add test for find_all. (based on Daniel Berger's patch)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 79e658fa8..aebf36026 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 |