[前][次][番号順一覧][スレッド一覧]

ruby-changes:13774

From: nobu <ko1@a...>
Date: Fri, 30 Oct 2009 16:28:12 +0900 (JST)
Subject: [ruby-changes:13774] Ruby:r25571 (trunk): * test/ruby/test_enum.rb (test_count): test for .

nobu	2009-10-30 16:28:03 +0900 (Fri, 30 Oct 2009)

  New Revision: 25571

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25571

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

  Modified files:
    trunk/test/ruby/test_enum.rb

Index: test/ruby/test_enum.rb
===================================================================
--- test/ruby/test_enum.rb	(revision 25570)
+++ test/ruby/test_enum.rb	(revision 25571)
@@ -35,6 +35,15 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]