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

ruby-changes:30048

From: nobu <ko1@a...>
Date: Mon, 22 Jul 2013 03:16:13 +0900 (JST)
Subject: [ruby-changes:30048] nobu:r42100 (trunk): date_parse.c: missing wday

nobu	2013-07-22 03:16:00 +0900 (Mon, 22 Jul 2013)

  New Revision: 42100

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

  Log:
    date_parse.c: missing wday
    
    * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
      can be omitted.

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_parse.c
    trunk/test/date/test_date_parse.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42099)
+++ ChangeLog	(revision 42100)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul 22 03:15:54 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
+	  can be omitted.
+
 Mon Jul 22 00:15:20 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bary_sq_fast): Refine expressions.
Index: ext/date/date_parse.c
===================================================================
--- ext/date/date_parse.c	(revision 42099)
+++ ext/date/date_parse.c	(revision 42100)
@@ -2848,7 +2848,9 @@ rfc2822_cb(VALUE m, VALUE hash) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L2848
 	    s[i] = rb_reg_nth_match(i, m);
     }
 
-    set_hash("wday", INT2FIX(day_num(s[1])));
+    if (!NIL_P(s[1])) {
+	set_hash("wday", INT2FIX(day_num(s[1])));
+    }
     set_hash("mday", str2num(s[2]));
     set_hash("mon", INT2FIX(mon_num(s[3])));
     y = str2num(s[4]);
Index: test/date/test_date_parse.rb
===================================================================
--- test/date/test_date_parse.rb	(revision 42099)
+++ test/date/test_date_parse.rb	(revision 42100)
@@ -1062,10 +1062,16 @@ class TestDateParse < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/date/test_date_parse.rb#L1062
     d = Date.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
     assert_equal(Date.new(2001,2,3), d)
     assert_equal(Date::ITALY + 10, d.start)
+    d = Date.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+    assert_equal(Date.new(2001,2,3), d)
+    assert_equal(Date::ITALY + 10, d.start)
 
     d = DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
     assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
     assert_equal(Date::ITALY + 10, d.start)
+    d = DateTime.rfc2822('3 Feb 2001 04:05:06 +0700', Date::ITALY + 10)
+    assert_equal(DateTime.new(2001,2,3,4,5,6,'+07:00'), d)
+    assert_equal(Date::ITALY + 10, d.start)
   end
 
   def test_httpdate

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

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