Skip to content

Commit

Permalink
add test.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed May 12, 2009
1 parent f64e076 commit 87d95fd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/ruby/test_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ def teardown
$VERBOSE = @verbose
end

def test_new
assert_equal(Time.utc(2000,2,10), Time.new(2000,2,10, 11,0,0, 3600*11))
assert_equal(Time.utc(2000,2,10), Time.new(2000,2,9, 13,0,0, -3600*11))
assert_equal(Time.utc(2000,2,10), Time.new(2000,2,10, 11,0,0, "+11:00"))
assert_equal(Rational(1,2), Time.new(2000,2,10, 11,0,5.5, "+11:00").subsec)
end

def test_time_add()
assert_equal(Time.utc(2000, 3, 21, 3, 30) + 3 * 3600,
Time.utc(2000, 3, 21, 6, 30))
Expand Down Expand Up @@ -305,16 +312,24 @@ def test_localtime_gmtime
t1 = Time.gm(2000)
t2 = t1.getlocal
assert_equal(t1, t2)
t3 = t1.getlocal("-02:00")
assert_equal(t1, t3)
assert_equal(-7200, t3.utc_offset)
t1.localtime
assert_equal(t1, t2)
assert_equal(t1.gmt?, t2.gmt?)
assert_equal(t1, t3)

t1 = Time.local(2000)
t2 = t1.getgm
assert_equal(t1, t2)
t3 = t1.getlocal("-02:00")
assert_equal(t1, t3)
assert_equal(-7200, t3.utc_offset)
t1.gmtime
assert_equal(t1, t2)
assert_equal(t1.gmt?, t2.gmt?)
assert_equal(t1, t3)
end

def test_asctime
Expand Down

0 comments on commit 87d95fd

Please sign in to comment.