diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:13 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-29 08:28:13 +0000 |
commit | 39a3d1793b67df8ef1aa48e2f813dcac13814544 (patch) | |
tree | 00cd78519b251ca3995f7e1c31e7de5aa60ba90e /test/ruby | |
parent | 241902e7091a0ad514683488020011e827ad7750 (diff) | |
download | ruby-39a3d1793b67df8ef1aa48e2f813dcac13814544.tar.gz |
strftime.c: triple colons modifier
partially borrowed from ext/date.
* strftime.c (rb_strftime_with_timespec): support GNU extension triple
colons modifier. [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_time.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index ae1221202b..2648440f65 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -695,6 +695,20 @@ class TestTime < Test::Unit::TestCase assert_raise(Errno::ERANGE, bug4457) {Time.now.strftime('%8192z')} end + def test_strfimte_zoneoffset + t = T2000.getlocal("+09:00:00") + assert_equal("+0900", t.strftime("%z")) + assert_equal("+09:00", t.strftime("%:z")) + assert_equal("+09:00:01", t.strftime("%::z")) + assert_equal("+09", t.strftime("%:::z")) + + t = T2000.getlocal("+09:00:01") + assert_equal("+0900", t.strftime("%z")) + assert_equal("+09:00", t.strftime("%:z")) + assert_equal("+09:00:01", t.strftime("%::z")) + assert_equal("+09:00:01", t.strftime("%:::z")) + end + def test_strftime_padding bug4458 = '[ruby-dev:43287]' t = T2000.getlocal("+09:00") @@ -706,6 +720,7 @@ class TestTime < Test::Unit::TestCase 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) + assert_equal("+000000009", t.strftime("%10:::z")) t = T2000.getlocal("-05:00") assert_equal("-0500", t.strftime("%z")) assert_equal("-05:00", t.strftime("%:z")) @@ -715,6 +730,7 @@ class TestTime < Test::Unit::TestCase 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) + assert_equal("-000000005", t.strftime("%10:::z")) bug6323 = '[ruby-core:44447]' t = T2000.getlocal("+00:36") @@ -724,6 +740,7 @@ class TestTime < Test::Unit::TestCase 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) + assert_equal("+000000:36", t.strftime("%10:::z")) t = T2000.getlocal("-00:55") assert_equal(" -055", t.strftime("%_10z"), bug6323) assert_equal("-000000055", t.strftime("%10z"), bug6323) @@ -731,6 +748,7 @@ class TestTime < Test::Unit::TestCase 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) + assert_equal("-000000:55", t.strftime("%10:::z")) end def test_strftime_invalid_modifier |