diff options
-rw-r--r-- | test/ruby/test_sprintf.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 467e86dd63..5ecabcc052 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -257,4 +257,12 @@ class TestSprintf < Test::Unit::TestCase def test_rb_sprintf assert(T012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.new.inspect =~ /^#<TestSprintf::T012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789:0x[0-9a-f]+>$/) end + + def test_negative_hex + s1 = sprintf("%0x", -0x40000000) + s2 = sprintf("%0x", -0x40000001) + b1 = (/\.\./ =~ s1) != nil + b2 = (/\.\./ =~ s2) != nil + assert(b1 == b2, "[ruby-dev:33224]") + end end |