mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merges r20347 from trunk into ruby_1_9_1.
* lib/date/format.rb (strftime): ignores '_' flag for %[LN]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2015069a20
commit
029392bc87
3 changed files with 24 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Nov 25 01:23:25 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* lib/date/format.rb (strftime): ignores '_' flag for %[LN].
|
||||||
|
|
||||||
Sat Nov 29 00:27:33 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
Sat Nov 29 00:27:33 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
* thread.c, thread_pthread.c, thread_win32.c: merges nobu's commits -
|
* thread.c, thread_pthread.c, thread_win32.c: merges nobu's commits -
|
||||||
|
|
|
@ -255,6 +255,7 @@ class Date
|
||||||
when 'j'; emit_n(yday, 3, f)
|
when 'j'; emit_n(yday, 3, f)
|
||||||
when 'k'; emit_a(hour, 2, f)
|
when 'k'; emit_a(hour, 2, f)
|
||||||
when 'L'
|
when 'L'
|
||||||
|
f[:p] = nil
|
||||||
w = f[:w] || 3
|
w = f[:w] || 3
|
||||||
u = 10**w
|
u = 10**w
|
||||||
emit_n((sec_fraction * u).floor, w, f)
|
emit_n((sec_fraction * u).floor, w, f)
|
||||||
|
@ -262,6 +263,7 @@ class Date
|
||||||
when 'M', 'OM'; emit_n(min, 2, f)
|
when 'M', 'OM'; emit_n(min, 2, f)
|
||||||
when 'm', 'Om'; emit_n(mon, 2, f)
|
when 'm', 'Om'; emit_n(mon, 2, f)
|
||||||
when 'N'
|
when 'N'
|
||||||
|
f[:p] = nil
|
||||||
w = f[:w] || 9
|
w = f[:w] || 9
|
||||||
u = 10**w
|
u = 10**w
|
||||||
emit_n((sec_fraction * u).floor, w, f)
|
emit_n((sec_fraction * u).floor, w, f)
|
||||||
|
|
|
@ -299,6 +299,24 @@ class TestDateStrftime < Test::Unit::TestCase
|
||||||
assert_equal('-2000', d.strftime('%05Y'))
|
assert_equal('-2000', d.strftime('%05Y'))
|
||||||
end
|
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
|
def test_strftime__gnuext_z # coreutils
|
||||||
d = DateTime.parse('2006-08-08T23:15:33+09:08:07')
|
d = DateTime.parse('2006-08-08T23:15:33+09:08:07')
|
||||||
assert_equal('+0908', d.strftime('%z'))
|
assert_equal('+0908', d.strftime('%z'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue