diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:04 +0000 |
commit | 60683816be0674fc3e0a07855f5c2de68c4db771 (patch) | |
tree | e314f18ee8e59773b733edd357df6b32bf51caca /test/ruby | |
parent | 4f4de9b858a3336e065b31dd7fa338d02a8a29eb (diff) | |
download | ruby-60683816be0674fc3e0a07855f5c2de68c4db771.tar.gz |
strftime.c: fix colon modifier.
partially borrowed from ext/date.
* strftime.c (rb_strftime_with_timespec): colons are valid only for
'z' and must come just before it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_time.rb | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index c45a2cc087..a5087bcbfa 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -693,35 +693,39 @@ class TestTime < Test::Unit::TestCase def test_strftime_padding bug4458 = '[ruby-dev:43287]' t = T2000.getlocal("+09:00") + assert_equal("+0900", t.strftime("%z")) + assert_equal("+09:00", t.strftime("%:z")) assert_equal(" +900", t.strftime("%_10z"), bug4458) assert_equal("+000000900", t.strftime("%10z"), bug4458) - assert_equal(" +9:00", t.strftime("%_:10z"), bug4458) - assert_equal("+000009:00", t.strftime("%:10z"), bug4458) - assert_equal(" +9:00:00", t.strftime("%_::10z"), bug4458) - assert_equal("+009:00:00", t.strftime("%::10z"), bug4458) + assert_equal(" +9:00", t.strftime("%_10:z"), bug4458) + assert_equal("+000009:00", t.strftime("%10:z"), bug4458) + assert_equal(" +9:00:00", t.strftime("%_10::z"), bug4458) + assert_equal("+009:00:00", t.strftime("%10::z"), bug4458) t = T2000.getlocal("-05:00") + assert_equal("-0500", t.strftime("%z")) + assert_equal("-05:00", t.strftime("%:z")) assert_equal(" -500", t.strftime("%_10z"), bug4458) assert_equal("-000000500", t.strftime("%10z"), bug4458) - assert_equal(" -5:00", t.strftime("%_:10z"), bug4458) - assert_equal("-000005:00", t.strftime("%:10z"), bug4458) - assert_equal(" -5:00:00", t.strftime("%_::10z"), bug4458) - assert_equal("-005:00:00", t.strftime("%::10z"), bug4458) + assert_equal(" -5:00", t.strftime("%_10:z"), bug4458) + assert_equal("-000005:00", t.strftime("%10:z"), bug4458) + assert_equal(" -5:00:00", t.strftime("%_10::z"), bug4458) + assert_equal("-005:00:00", t.strftime("%10::z"), bug4458) bug6323 = '[ruby-core:44447]' t = T2000.getlocal("+00:36") assert_equal(" +036", t.strftime("%_10z"), bug6323) assert_equal("+000000036", t.strftime("%10z"), bug6323) - assert_equal(" +0:36", t.strftime("%_:10z"), bug6323) - assert_equal("+000000:36", t.strftime("%:10z"), bug6323) - assert_equal(" +0:36:00", t.strftime("%_::10z"), bug6323) - assert_equal("+000:36:00", t.strftime("%::10z"), bug6323) + assert_equal(" +0:36", t.strftime("%_10:z"), bug6323) + assert_equal("+000000:36", t.strftime("%10:z"), bug6323) + assert_equal(" +0:36:00", t.strftime("%_10::z"), bug6323) + assert_equal("+000:36:00", t.strftime("%10::z"), bug6323) t = T2000.getlocal("-00:55") assert_equal(" -055", t.strftime("%_10z"), bug6323) assert_equal("-000000055", t.strftime("%10z"), bug6323) - assert_equal(" -0:55", t.strftime("%_:10z"), bug6323) - assert_equal("-000000:55", t.strftime("%:10z"), bug6323) - assert_equal(" -0:55:00", t.strftime("%_::10z"), bug6323) - assert_equal("-000:55:00", t.strftime("%::10z"), bug6323) + assert_equal(" -0:55", t.strftime("%_10:z"), bug6323) + assert_equal("-000000:55", t.strftime("%10:z"), bug6323) + assert_equal(" -0:55:00", t.strftime("%_10::z"), bug6323) + assert_equal("-000:55:00", t.strftime("%10::z"), bug6323) end def test_delegate |