diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-17 01:24:22 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-17 01:24:22 +0000 |
commit | b30d203fed8c29fd05d010631ca8e4750ce34849 (patch) | |
tree | d1147089a3be6f5b09b4a5bb4e53ac5f5ab3ae83 /test/ruby/test_rational.rb | |
parent | 783fb0881f91d59dca1430657628c4d50bd1a2be (diff) | |
download | ruby-b30d203fed8c29fd05d010631ca8e4750ce34849.tar.gz |
* rational.c (nurat_coerce): Rational#coerce should converts itself
into Complex if the argument is a Complex with non-zero imaginary
part. [Bug #5020] [ruby-dev:44088]
* test/ruby/test_rational.rb (test_coerce): test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_rational.rb')
-rw-r--r-- | test/ruby/test_rational.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index 3d9709517f..70aab03c38 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -721,6 +721,10 @@ class Rational_Test < Test::Unit::TestCase assert_equal([Rational(2),Rational(1)], Rational(1).coerce(2)) assert_equal([Rational(2.2),Rational(1)], Rational(1).coerce(2.2)) assert_equal([Rational(2),Rational(1)], Rational(1).coerce(Rational(2))) + + assert_nothing_raised(TypeError, '[Bug #5020] [ruby-devl:44088]') do + Rational(1,2).coerce(Complex(1,1)) + end end class ObjectX |