* lib/scanf.rb (Scanf::FormatSpecifier#initialize): %i should accept

single digit decimal.  [ruby-core:18355]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-08-20 21:12:58 +00:00
Родитель e1ebab4ed0
Коммит b9e3f3c129
3 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Aug 21 06:12:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/scanf.rb (Scanf::FormatSpecifier#initialize): %i should accept
single digit decimal. [ruby-core:18355]
Thu Aug 21 06:02:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Aug 21 06:02:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* range.c (range_initialize_copy): Range is now a Struct. * range.c (range_initialize_copy): Range is now a Struct.

Просмотреть файл

@ -357,7 +357,7 @@ module Scanf
# %i # %i
when /%\*?i/ when /%\*?i/
[ "([-+]?(?:(?:0[0-7]+)|(?:0[Xx]#{h}+)|(?:[1-9]\\d+)))", :extract_integer ] [ "([-+]?(?:(?:0[0-7]+)|(?:0[Xx]#{h}+)|(?:[1-9]\\d*)))", :extract_integer ]
# %5i # %5i
when /%\*?(\d+)i/ when /%\*?(\d+)i/

Просмотреть файл

@ -179,8 +179,8 @@ def tests
[ "%3d%3x", "12abc", [12, "abc".hex] ], [ "%3d%3x", "12abc", [12, "abc".hex] ],
[ "%s%i%d", "hello +0xdef 123", [ "hello", "def".hex, 123] ], [ "%s%i%d", "hello +0xdef 123", [ "hello", "def".hex, 123] ],
[ "%s%i%d", "hello -0xdef 123", [ "hello", -"def".hex, 123] ], [ "%s%i%d", "hello -0xdef 123", [ "hello", -"def".hex, 123] ],
[ "%s%i%i%i", "hello 012 -012 100", [ "hello", 10, -10, 100 ] ], [ "%s%i%i%i%i", "hello 012 -012 100 1", [ "hello", 10, -10, 100, 1 ] ],
[ "%s%i%i%i", "hello 012 0x12 100", [ "hello", 10, 18, 100 ] ], [ "%s%i%i%i%i", "hello 012 0x12 100 1", [ "hello", 10, 18, 100, 1 ] ],
[ "%s%5i%3i%4i", "hello 0x123 123 0123", [ "hello", "0x123".hex, 123,"0123".oct] ], [ "%s%5i%3i%4i", "hello 0x123 123 0123", [ "hello", "0x123".hex, 123,"0123".oct] ],
[ "%s%3i%4i", "hello 1230123", [ "hello", 123,"0123".oct] ], [ "%s%3i%4i", "hello 1230123", [ "hello", 123,"0123".oct] ],
[ "%s%3i", "hello 1230", [ "hello", 123] ], [ "%s%3i", "hello 1230", [ "hello", 123] ],