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

ruby-changes:41368

From: hsbt <ko1@a...>
Date: Tue, 5 Jan 2016 21:32:36 +0900 (JST)
Subject: [ruby-changes:41368] hsbt:r53440 (trunk): * test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?

hsbt	2016-01-05 21:32:43 +0900 (Tue, 05 Jan 2016)

  New Revision: 53440

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53440

  Log:
    * test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?
      [fix GH-1187]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_numeric.rb
Index: test/ruby/test_numeric.rb
===================================================================
--- test/ruby/test_numeric.rb	(revision 53439)
+++ test/ruby/test_numeric.rb	(revision 53440)
@@ -147,6 +147,18 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L147
     assert_predicate(a, :zero?)
   end
 
+  def test_nonzero_p
+    a = Class.new(Numeric) do
+      def zero?; true; end
+    end.new
+    assert_nil(a.nonzero?)
+
+    a = Class.new(Numeric) do
+      def zero?; false; end
+    end.new
+    assert_equal(a, a.nonzero?)
+  end
+
   def test_positive_p
     a = Class.new(Numeric) do
       def >(x); true; end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53439)
+++ ChangeLog	(revision 53440)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jan  5 21:32:26 2016  Kuniaki IGARASHI  <igaiga@g...>
+
+	* test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?
+	  [fix GH-1187]
+
 Tue Jan  5 11:47:23 2016  Damir Gaynetdinov  <damir.gaynetdinov@g...>
 
 	* doc/marshal.rdoc: Clarify object references example, that the

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

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