* 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
Родитель 6378201f8b
Коммит 9cab7d15ca
3 изменённых файлов: 14 добавлений и 1 удалений

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

@ -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.

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

@ -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)

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

@ -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