mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/scanf.rb: fix max width modifier for %f.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1392791a9e
commit
1720e7e0df
3 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sun Mar 28 10:03:51 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/scanf.rb: fix max width modifier for %f.
|
||||||
|
|
||||||
Sun Mar 28 10:35:45 2010 Ryan Davis <ryand-ruby@zenspider.com>
|
Sun Mar 28 10:35:45 2010 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
||||||
* lib/minitest/*.rb: Imported minitest 1.6.0 r5717.
|
* lib/minitest/*.rb: Imported minitest 1.6.0 r5717.
|
||||||
|
|
|
@ -410,11 +410,12 @@ module Scanf
|
||||||
|
|
||||||
# %f
|
# %f
|
||||||
when /%\*?[efgEFG]/
|
when /%\*?[efgEFG]/
|
||||||
[ '([-+]?((\d+(?>(?=[^\d.]|$)))|(\d*(\.(\d*([eE][-+]?\d+)?)))))', :extract_float ]
|
[ '([-+]?(?:\d+(?![\d.])|\d*\.\d*(?:[eE][-+]?\d+)?))', :extract_float ]
|
||||||
|
|
||||||
# %5f
|
# %5f
|
||||||
when /%\*?(\d+)[efgEFG]/
|
when /%\*?(\d+)[efgEFG]/
|
||||||
[ "(\\S{1,#{$1}})", :extract_float ]
|
[ '(?=[-+]?(?:\d+(?![\d.])|\d*\.\d*(?:[eE][-+]?\d+)?))' +
|
||||||
|
"(\\S{1,#{$1}})", :extract_float ]
|
||||||
|
|
||||||
# %5s
|
# %5s
|
||||||
when /%\*?(\d+)s/
|
when /%\*?(\d+)s/
|
||||||
|
|
|
@ -269,7 +269,7 @@ module ScanfTests
|
||||||
[ "%[[:upper:]]", "ABCdefGHI", [ "ABC" ] ],
|
[ "%[[:upper:]]", "ABCdefGHI", [ "ABC" ] ],
|
||||||
|
|
||||||
# Testing 'f'
|
# Testing 'f'
|
||||||
[ "%2f", "x", [0.0] ], # width-floats match anything (by design)
|
[ "%2f", "x", [] ],
|
||||||
[ "%F", "1.23e45", [1.23e+45] ],
|
[ "%F", "1.23e45", [1.23e+45] ],
|
||||||
[ "%e", "3.25ee", [3.25] ],
|
[ "%e", "3.25ee", [3.25] ],
|
||||||
[ "%E", "3..25", [3.0] ],
|
[ "%E", "3..25", [3.0] ],
|
||||||
|
|
Loading…
Add table
Reference in a new issue