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

ruby-changes:33441

From: tadf <ko1@a...>
Date: Sat, 5 Apr 2014 19:53:25 +0900 (JST)
Subject: [ruby-changes:33441] tadf:r45520 (trunk): * ext/date/date_core.c (d_lite_cmp): should compare with #<.

tadf	2014-04-05 19:53:16 +0900 (Sat, 05 Apr 2014)

  New Revision: 45520

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

  Log:
    * ext/date/date_core.c (d_lite_cmp): should compare with #<.

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_core.c
    trunk/test/date/test_switch_hitter.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45519)
+++ ChangeLog	(revision 45520)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Apr  5 19:36:33 2014  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_core.c (d_lite_cmp): should compare with #<.
+
 Sat Apr  5 00:31:21 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/readline/extconf.rb (rl_hook_func_t): check pointer type.
Index: ext/date/date_core.c
===================================================================
--- ext/date/date_core.c	(revision 45519)
+++ ext/date/date_core.c	(revision 45520)
@@ -6283,7 +6283,7 @@ d_lite_cmp(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L6283
 		    return INT2FIX(1);
 		}
 	    }
-	    else if (a_nth < b_nth) {
+	    else if (f_lt_p(a_nth, b_nth)) {
 		return INT2FIX(-1);
 	    }
 	    else {
Index: test/date/test_switch_hitter.rb
===================================================================
--- test/date/test_switch_hitter.rb	(revision 45519)
+++ test/date/test_switch_hitter.rb	(revision 45520)
@@ -312,6 +312,8 @@ class TestSH < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/date/test_switch_hitter.rb#L312
     assert_equal(-1, Date.new(2001,2,3) <=> Rational('4903888/2'))
     assert_equal(0, Date.new(2001,2,3) <=> Rational('4903887/2'))
     assert_equal(1, Date.new(2001,2,3) <=> Rational('4903886/2'))
+
+    assert_equal(-1, Date.new(-4713,11,1,Date::GREGORIAN) <=> Date.new(-4713,12,1,Date::GREGORIAN))
   end
 
   def test_eqeqeq

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

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