aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 13:09:07 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 13:09:07 +0000
commit0a76ec34eac00a971617d833d2c42ed68f12f911 (patch)
treeac03a7b172be3918012cc18639b177ea4cf1b913 /test/test_time.rb
parent4de238663a6e6d6b4f5306bb5f88a9e067c4f4c0 (diff)
downloadruby-0a76ec34eac00a971617d833d2c42ed68f12f911.tar.gz
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb19
1 files 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