summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-23 10:28:07 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-23 10:30:59 +0900
commita55eb9a2af7950d180d9d31ffde2bce66710f44f (patch)
tree4b9863c2aef76c20cd7c7ea7d6450d33c2915234 /test
parent37258b64c759c0add4d97f79aeeda8ae4ffc3677 (diff)
Make reciprocal properly of non-integral rational [Bug #17572]
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rational.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 820dd30a82..fe9de64c4c 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -613,6 +613,13 @@ class Rational_Test < Test::Unit::TestCase
assert_nothing_raised(TypeError, '[Bug #5020] [ruby-dev:44088]') do
Rational(1,2).coerce(Complex(1,1))
end
+
+ assert_raise(ZeroDivisionError) do
+ 1 / 0r.coerce(0+0i)[0]
+ end
+ assert_raise(ZeroDivisionError) do
+ 1 / 0r.coerce(0.0+0i)[0]
+ end
end
class ObjectX