diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-28 15:54:44 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-28 15:54:44 +0000 |
commit | f4ad6eec46a6ec0520db3433f67e04c48843c632 (patch) | |
tree | 40678a446786335bcdc9df96f99b7f1406254671 /test | |
parent | 3e1c092a48894039d38967d7a84d21532dcd3a02 (diff) | |
download | ruby-f4ad6eec46a6ec0520db3433f67e04c48843c632.tar.gz ruby-f4ad6eec46a6ec0520db3433f67e04c48843c632.tar.xz ruby-f4ad6eec46a6ec0520db3433f67e04c48843c632.zip |
* strftime.c (rb_strftime): fixed a bug of padding.
* test/ruby/test_time.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_time.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 237721c4d..a2c2b1b14 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -401,5 +401,38 @@ class TestTime < Test::Unit::TestCase t = Time.mktime(2001, 10, 1) assert_equal("2001-10-01", t.strftime("%F")) + + t = Time.mktime(2001, 10, 1, 2, 0, 0) + assert_equal("01", t.strftime("%d")) + assert_equal("01", t.strftime("%0d")) + assert_equal(" 1", t.strftime("%_d")) + assert_equal(" 1", t.strftime("%e")) + assert_equal("01", t.strftime("%0e")) + assert_equal(" 1", t.strftime("%_e")) + assert_equal("02", t.strftime("%H")) + assert_equal("02", t.strftime("%0H")) + assert_equal(" 2", t.strftime("%_H")) + assert_equal("02", t.strftime("%I")) + assert_equal("02", t.strftime("%0I")) + assert_equal(" 2", t.strftime("%_I")) + assert_equal(" 2", t.strftime("%k")) + assert_equal("02", t.strftime("%0k")) + assert_equal(" 2", t.strftime("%_k")) + assert_equal(" 2", t.strftime("%l")) + assert_equal("02", t.strftime("%0l")) + assert_equal(" 2", t.strftime("%_l")) + t = Time.mktime(2001, 10, 1, 14, 0, 0) + assert_equal("14", t.strftime("%H")) + assert_equal("14", t.strftime("%0H")) + assert_equal("14", t.strftime("%_H")) + assert_equal("02", t.strftime("%I")) + assert_equal("02", t.strftime("%0I")) + assert_equal(" 2", t.strftime("%_I")) + assert_equal("14", t.strftime("%k")) + assert_equal("14", t.strftime("%0k")) + assert_equal("14", t.strftime("%_k")) + assert_equal(" 2", t.strftime("%l")) + assert_equal("02", t.strftime("%0l")) + assert_equal(" 2", t.strftime("%_l")) end end |