aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-29 09:26:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-29 09:26:45 +0000
commit4ce98205a428316ec1cd3b60806eeececd24e7e7 (patch)
tree8565fbc76307e94ace0886b0c668961c8fb23ca6 /test
parent6195c066a9ae85ce4fb3e6f183f6e065cf5ff9b9 (diff)
downloadruby-4ce98205a428316ec1cd3b60806eeececd24e7e7.tar.gz
rational.c: fix for mathn
* rational.c (read_num, read_rat_nos): dispatch by the type of numerator, for mathn. [ruby-core:78893] [Bug #13084] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/test_mathn.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_mathn.rb b/test/test_mathn.rb
index 00130eadf1..b50a09e4df 100644
--- a/test/test_mathn.rb
+++ b/test/test_mathn.rb
@@ -180,4 +180,13 @@ class TestMathn < Test::Unit::TestCase
assert_equal((-13/5), (-13/5).round(2, half: :down))
EOS
end
+
+ def test_rational
+ assert_separately(%w[-rmathn], "#{<<-"begin;"}\n#{<<-"end;"}", ignore_stderr: true)
+ begin;
+ assert_equal(-5, "-5".to_r)
+ assert_equal(1, "5/5".to_r)
+ assert_equal(5, "5e0".to_r)
+ end;
+ end
end