From 0a76ec34eac00a971617d833d2c42ed68f12f911 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 3 May 2014 13:09:07 +0000 Subject: [PATCH] add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_time.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/test_time.rb b/test/test_time.rb index 0496af855e..1427089abb 100644 --- a/test/test_time.rb +++ b/test/test_time.rb @@ -401,8 +401,23 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc: assert_equal(Time.utc(2005, 8, 28, 06, 54, 20), Time.strptime("28/Aug/2005:06:54:20 +0000", "%d/%b/%Y:%T %z")) assert_equal(Time.at(1).localtime, Time.strptime("1", "%s")) assert_equal(false, Time.strptime('0', '%s').utc?) - assert_equal(3600, Time.strptime('0 +0100', '%s %z').utc_offset) - assert_equal(-7200, Time.strptime('20010203 -0200', '%Y%m%d %z').utc_offset) + end + + def test_strptime_s_z + t = Time.strptime('0 +0100', '%s %z') + assert_equal(0, t.to_r) + assert_equal(3600, t.utc_offset) + end + + def test_strptime_Ymd_z + t = Time.strptime('20010203 -0200', '%Y%m%d %z') + assert_equal(2001, t.year) + assert_equal(2, t.mon) + assert_equal(3, t.day) + assert_equal(0, t.hour) + assert_equal(0, t.min) + assert_equal(0, t.sec) + assert_equal(-7200, t.utc_offset) end def test_nsec