mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 18:43:59 +02:00
* 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
This commit is contained in:
parent
49ab7b4238
commit
4bf4ddb693
3 changed files with 16 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue