aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_numeric.rb
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-06 13:31:22 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-06 13:31:22 +0000
commit7708560bb1c4686668268a2bca05da481b7c3132 (patch)
tree1321108064b7f1115498e64cb71c19c97bf09e40 /test/ruby/test_numeric.rb
parentb1411888d1c85835e92455fdd2af345d0be1cb0a (diff)
downloadruby-7708560bb1c4686668268a2bca05da481b7c3132.tar.gz
* numeric.c (num_quo): Use to_r method to convert the receiver to
rational. [ruby-core:41575] [Bug #5736] * test/ruby/test_numeric.rb: add a test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_numeric.rb')
-rw-r--r--test/ruby/test_numeric.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 09b48ebc69..fccf17ed29 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -54,7 +54,20 @@ class TestNumeric < Test::Unit::TestCase
end
def test_quo
- assert_raise(ArgumentError) {DummyNumeric.new.quo(1)}
+ assert_raise(TypeError) {DummyNumeric.new.quo(1)}
+ end
+
+ def test_quo_ruby_core_41575
+ x = DummyNumeric.new
+ rat = 84.quo(1)
+ DummyNumeric.class_eval do
+ define_method(:to_r) { rat }
+ end
+ assert_equal(2.quo(1), x.quo(42), '[ruby-core:41575]')
+ ensure
+ DummyNumeric.class_eval do
+ remove_method :to_r
+ end
end
def test_divmod