mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* sprintf.c (rb_str_format): "%#.0o" should keep prefix where
"%#.0x" should not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e6e5a4316
commit
18e70b266f
3 changed files with 16 additions and 8 deletions
|
@ -145,7 +145,7 @@ class TestSprintfComb < Test::Unit::TestCase
|
|||
radix = 2
|
||||
digitmap = {0 => '0', 1 => '1'}
|
||||
complement = !pl && !sp
|
||||
prefix = '0b' if hs
|
||||
prefix = '0b' if hs && v != 0
|
||||
when 'd'
|
||||
radix = 10
|
||||
digitmap = {}
|
||||
|
@ -161,13 +161,13 @@ class TestSprintfComb < Test::Unit::TestCase
|
|||
digitmap = {}
|
||||
16.times {|i| digitmap[i] = i.to_s(16).upcase }
|
||||
complement = !pl && !sp
|
||||
prefix = '0X' if hs
|
||||
prefix = '0X' if hs && v != 0
|
||||
when 'x'
|
||||
radix = 16
|
||||
digitmap = {}
|
||||
16.times {|i| digitmap[i] = i.to_s(16) }
|
||||
complement = !pl && !sp
|
||||
prefix = '0x' if hs
|
||||
prefix = '0x' if hs && v != 0
|
||||
else
|
||||
raise "unexpected type: #{type.inspect}"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue