1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-05-03 13:09:07 +00:00
parent 4de238663a
commit 0a76ec34ea

View file

@ -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