diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-11-10 15:15:53 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-11-10 15:15:53 +0900 |
| commit | a7b013b392ca0ba4930e579f4c9e40d99d871752 (patch) | |
| tree | 43eeeea09c8f8d93f972268f4b56d9fa9e37d605 /test/ruby/test_sprintf.rb | |
| parent | 9bcc5c5fd9e8e4d15040eec6850b49d860eba621 (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/test_sprintf.rb')
| -rw-r--r-- | test/ruby/test_sprintf.rb | 4 |
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 |
