summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-20 22:16:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-20 22:16:21 +0000
commita834d7fe61fa307e47984022184195652799fc32 (patch)
tree9c884477e515d16110d42740dacdc1859f455841 /test
parenteaa1fccf1dbb92a78b5e4398f5f34659d58a1662 (diff)
merge revision(s) 35366,35377,35399,35406:
* strftime.c (rb_strftime_with_timespec): fix padding of time zone offset. [ruby-dev:43287][Bug #4458] * strftime.c (rb_strftime_with_timespec): add an interim digit for the timezone offset which is less than an hour. * strftime.c (rb_strftime_with_timespec): fix carry-up bug and overwrite '+' with '-' if negative offset less than a hour. [ruby-core:44447][Bug #6323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_time.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index a1f060ec85..2edba516fe 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -659,6 +659,38 @@ class TestTime < Test::Unit::TestCase
bug4457 = '[ruby-dev:43285]'
assert_raise(Errno::ERANGE, bug4457) {Time.now.strftime('%8192z')}
+
+ bug4458 = '[ruby-dev:43287]'
+ t = T2000.getlocal("+09:00")
+ 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)
+ t = T2000.getlocal("-05:00")
+ 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)
+
+ 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)
+ 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)
end
def test_delegate