diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-29 19:35:04 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-29 19:35:04 +0000 |
commit | 14dd72b35a76e31a3f0519d63e39eb8bcdbd23f8 (patch) | |
tree | 9ae1f2b43781f222e1db4cbd9d0ec6e5801ae42e /test/ruby | |
parent | 019864bfc1d9945a07b75ea8cd752bb810396b81 (diff) |
* enum.c (count_i, count_iter_i): Sync with trunk.
enum.c (enum_count, count_all_i, Init_Enumerable),
array.c (rb_ary_count): Sync with trunk. If no argument or
block is given, count the number of all elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_array.rb | 1 | ||||
-rw-r--r-- | test/ruby/test_enum.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 58ffe52675..4c7c3dfb6d 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -530,6 +530,7 @@ class TestArray < Test::Unit::TestCase def test_count a = @cls[1, 2, 3, 1, 2] + assert_equal(5, a.count) assert_equal(2, a.count(1)) assert_equal(3, a.count {|x| x % 2 == 1 }) assert_equal(2, a.count(1) {|x| x % 2 == 1 }) diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 6171c9a234..e541d566c0 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -29,6 +29,7 @@ class TestEnumerable < Test::Unit::TestCase end def test_count + assert_equal(5, @obj.count) assert_equal(2, @obj.count(1)) assert_equal(3, @obj.count {|x| x % 2 == 1 }) assert_equal(2, @obj.count(1) {|x| x % 2 == 1 }) |