diff options
-rw-r--r-- | test/ruby/test_enum.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 077be1767f..a805ee6e55 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -35,6 +35,15 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(3, @obj.count {|x| x % 2 == 1 }) assert_equal(2, @obj.count(1) {|x| x % 2 == 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 def test_find |