diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-13 23:51:16 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-13 23:51:16 +0000 |
commit | 4bf4ddb693b885a5ce9b9ad983c4743627ae29cc (patch) | |
tree | 1043eb3bd33ff94f689ab70f8153079c5be80d42 /test/ruby/test_time.rb | |
parent | 49ab7b42383ecd1d8194e17f52c8e3f9273e1459 (diff) | |
download | ruby-4bf4ddb693b885a5ce9b9ad983c4743627ae29cc.tar.gz |
* time.c (time_to_r): convert to rational if internal representation
is not rational.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_time.rb')
-rw-r--r-- | test/ruby/test_time.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index e6d5d31d80..39a8e297bb 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -540,4 +540,9 @@ class TestTime < Test::Unit::TestCase assert_equal(-1, d1 <=> d2) assert_equal(1, d2 <=> d1) end + + def test_to_r + assert_kind_of(Rational, Time.new(2000,1,1,0,0,Rational(4,3)).to_r) + assert_kind_of(Rational, Time.utc(1970).to_r) + end end |