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

ruby-changes:8811

From: tadf <ko1@a...>
Date: Tue, 25 Nov 2008 01:26:17 +0900 (JST)
Subject: [ruby-changes:8811] Ruby:r20347 (trunk): * lib/date/format.rb (strftime): ignores '_' flag for %[LN].

tadf	2008-11-25 01:26:00 +0900 (Tue, 25 Nov 2008)

  New Revision: 20347

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

  Log:
    * lib/date/format.rb (strftime): ignores '_' flag for %[LN].

  Modified files:
    trunk/ChangeLog
    trunk/lib/date/format.rb
    trunk/test/date/test_date_strftime.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20346)
+++ ChangeLog	(revision 20347)
@@ -1,3 +1,7 @@
+Tue Nov 25 01:23:25 2008  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/date/format.rb (strftime): ignores '_' flag for %[LN].
+
 Tue Nov 25 00:08:22 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* process.c (rb_fork): stops the timer thread during fork.
Index: lib/date/format.rb
===================================================================
--- lib/date/format.rb	(revision 20346)
+++ lib/date/format.rb	(revision 20347)
@@ -255,6 +255,7 @@
       when 'j'; emit_n(yday, 3, f)
       when 'k'; emit_a(hour, 2, f)
       when 'L'
+	f[:p] = nil
 	w = f[:w] || 3
 	u = 10**w
 	emit_n((sec_fraction * u).floor, w, f)
@@ -262,6 +263,7 @@
       when 'M', 'OM'; emit_n(min, 2, f)
       when 'm', 'Om'; emit_n(mon, 2, f)
       when 'N'
+	f[:p] = nil
 	w = f[:w] || 9
 	u = 10**w
 	emit_n((sec_fraction * u).floor, w, f)
Index: test/date/test_date_strftime.rb
===================================================================
--- test/date/test_date_strftime.rb	(revision 20346)
+++ test/date/test_date_strftime.rb	(revision 20347)
@@ -299,6 +299,24 @@
     assert_equal('-2000', d.strftime('%05Y'))
   end
 
+  def test_strftime__gnuext_LN # coreutils
+    d = DateTime.parse('2008-11-25T00:11:22.0123456789')
+    assert_equal('012', d.strftime('%L'))
+    assert_equal('012', d.strftime('%0L'))
+    assert_equal('0', d.strftime('%1L'))
+    assert_equal('01', d.strftime('%2L'))
+    assert_equal('01234567890', d.strftime('%11L'))
+    assert_equal('01234567890', d.strftime('%011L'))
+    assert_equal('01234567890', d.strftime('%_11L'))
+    assert_equal('012345678', d.strftime('%N'))
+    assert_equal('012345678', d.strftime('%0N'))
+    assert_equal('0', d.strftime('%1N'))
+    assert_equal('01', d.strftime('%2N'))
+    assert_equal('01234567890', d.strftime('%11N'))
+    assert_equal('01234567890', d.strftime('%011N'))
+    assert_equal('01234567890', d.strftime('%_11N'))
+  end
+
   def test_strftime__gnuext_z # coreutils
     d = DateTime.parse('2006-08-08T23:15:33+09:08:07')
     assert_equal('+0908', d.strftime('%z'))

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

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