1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_enum.rb (test_count): test for [ruby-core:24794].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-30 07:28:03 +00:00
parent 6116f52f61
commit bb385e2386

View file

@ -35,6 +35,15 @@ class TestEnumerable < Test::Unit::TestCase
assert_equal(3, @obj.count {|x| x % 2 == 1 }) assert_equal(3, @obj.count {|x| x % 2 == 1 })
assert_equal(2, @obj.count(1) {|x| x % 2 == 1 }) assert_equal(2, @obj.count(1) {|x| x % 2 == 1 })
assert_raise(ArgumentError) { @obj.count(0, 1) } assert_raise(ArgumentError) { @obj.count(0, 1) }
en = Class.new {
include Enumerable
alias :size :count
def each
yield 1
end
}
assert_equal(1, en.new.count, '[ruby-core:24794]')
end end
def test_find def test_find