summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-05 02:52:31 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-05 02:52:31 +0000
commit5b52d585f492bf9929738c27241c028aefebbf2c (patch)
treeb09c5601852a60ddabe9dd6ac2fb5037fae54dc0 /test
parent93bceb14a426f4c2266a47b50cd5ff79d5f5a1c8 (diff)
merge revision(s) 53533: [Backport #12895]
* sprintf.c (rb_str_format): format exact number more exactly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_sprintf.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 66ae4db853..8aa0cbfea5 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -149,6 +149,11 @@ class TestSprintf < Test::Unit::TestCase
assert_equal(" Inf", sprintf("% e", inf), '[ruby-dev:34002]')
end
+ def test_bignum
+ assert_match(/\A10{120}\.0+\z/, sprintf("%f", 100**60))
+ assert_match(/\A10{180}\.0+\z/, sprintf("%f", 1000**60))
+ end
+
def test_rational
assert_match(/\A0\.10+\z/, sprintf("%.60f", 0.1r))
assert_match(/\A0\.010+\z/, sprintf("%.60f", 0.01r))