diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 10:40:22 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 10:40:22 +0000 |
commit | 5c9d45e6e75c02884d13dc197ab9e7c94c98bc11 (patch) | |
tree | c328797b6ce8bb8bdc2d59c4de19b0e097443428 | |
parent | 9bf44e389ece8f91f517532a61a588f7fdedc8b1 (diff) | |
download | ruby-5c9d45e6e75c02884d13dc197ab9e7c94c98bc11.tar.gz |
add a test. [ruby-dev:22619]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_time.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 28286ddc04..d3707bf58d 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -24,14 +24,17 @@ class TestTime < Test::Unit::TestCase -Time.utc(2000, 3, 21, 3, 30), -3*3600) end - def test_timegm + def negative_time_t? begin Time.at(-1) - negative_time_t_supported = true + true rescue ArgumentError - negative_time_t_supported = false + false end - if negative_time_t_supported + end + + def test_timegm + if negative_time_t? assert_equal(-0x80000000, Time.utc(1901, 12, 13, 20, 45, 52).tv_sec) assert_equal(-2, Time.utc(1969, 12, 31, 23, 59, 58).tv_sec) assert_equal(-1, Time.utc(1969, 12, 31, 23, 59, 59).tv_sec) @@ -58,4 +61,11 @@ class TestTime < Test::Unit::TestCase assert_equal(946684822, Time.utc(2000, 1, 1, 0, 0, 0).tv_sec) end end + + def test_huge_difference # [ruby-dev:22619] + if negative_time_t? + assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff) + assert_equal(Time.at(0x7fffffff), Time.at(-0x80000000) + 0xffffffff) + end + end end |