1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/scanf.rb: fixed bug involving matching literal '['

* test/scanf/test_scanf.rb: added test for scanf.rb fix



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dblack 2008-09-03 12:54:13 +00:00
parent 6378201f8b
commit 9cab7d15ca
3 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Wed Sep 3 21:49:00 2008 David A. Black <dblack@rubypal.com>
* lib/scanf.rb: fixed bug involving matching literal '['
* test/scanf/test_scanf.rb: added test for scanf.rb fix
Wed Sep 3 21:31:59 2008 Tanaka Akira <akr@fsij.org>
* transcode_data.h (WORDINDEX_SHIFT_BITS): defined.

View file

@ -325,7 +325,7 @@ module Scanf
end
def count_space?
/(?:\A|\S)%\*?\d*c|\[/.match(@spec_string)
/(?:\A|\S)%\*?\d*c|%\d*\[/.match(@spec_string)
end
def initialize(str)

View file

@ -276,6 +276,13 @@ def tests
[ "%f", "+3.25", [3.25] ],
[ "%f", "+3.25e2", [325.0] ],
[ "%f", "3.z", [3.0] ],
# Testing embedded matches including literal '[' behavior
[",%d,%f", ",10,1.1", [10,1.1] ],
[" ,%d,%f", " ,10,1.1", [10,1.1] ],
["[%d,%f", "[10,1.1", [10,1.1] ],
[" [%d,%f", " [10,1.1", [10,1.1] ],
]
end
end