summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:42:54 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-01-14 17:42:54 -0800
commit1ec258ab7002210670171f3f2f0c4b39657e24a4 (patch)
tree2e5ac1e99980fdb785c6c7923e42de25fba6725b /test/ruby
parent42f043c1893b320b9d2a38ec3b1065dee71ce863 (diff)
merge revision(s) d71be7274bd2623bb521be72c245c08fc38d6ae4: [Backport #20873]
[Bug #20873] Consider `-FIXNUM_MIN` overflow `-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using two's complement representation.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_sprintf.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 9b972dcbaa..3f821f7a5d 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -227,6 +227,10 @@ class TestSprintf < Test::Unit::TestCase
bug11766 = '[ruby-core:71806] [Bug #11766]'
assert_equal("x"*10+" 1.0", sprintf("x"*10+"%8.1f", 1r), bug11766)
+
+ require 'rbconfig/sizeof'
+ fmin, fmax = RbConfig::LIMITS.values_at("FIXNUM_MIN", "FIXNUM_MAX")
+ assert_match(/\A-\d+\.\d+\z/, sprintf("%f", Rational(fmin, fmax)))
end
def test_rational_precision