mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/strscan/strscan.c (strscan_do_scan): StringScanner.new("").scan(//) should return "". [ruby-Bugs:4361]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
79c5eb1af3
commit
544789bd79
3 changed files with 15 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jul 26 17:43:20 2006 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* ext/strscan/strscan.c (strscan_do_scan):
|
||||||
|
StringScanner.new("").scan(//) should return "". [ruby-Bugs:4361]
|
||||||
|
|
||||||
Wed Jul 26 17:28:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Jul 26 17:28:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* sprintf.c (rb_str_format): prepend ".." to %u for negative bignum,
|
* sprintf.c (rb_str_format): prepend ".." to %u for negative bignum,
|
||||||
|
|
|
@ -391,9 +391,6 @@ strscan_set_pos(VALUE self, VALUE v)
|
||||||
return INT2NUM(i);
|
return INT2NUM(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I should implement this function? */
|
|
||||||
#define strscan_prepare_re(re) /* none */
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
||||||
{
|
{
|
||||||
|
@ -404,10 +401,6 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
|
||||||
GET_SCANNER(self, p);
|
GET_SCANNER(self, p);
|
||||||
|
|
||||||
CLEAR_MATCH_STATUS(p);
|
CLEAR_MATCH_STATUS(p);
|
||||||
if (EOS_P(p)) {
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
strscan_prepare_re(regex);
|
|
||||||
if (headonly) {
|
if (headonly) {
|
||||||
ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p),
|
ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p),
|
||||||
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
|
||||||
|
|
|
@ -242,6 +242,11 @@ class TestStringScanner < Test::Unit::TestCase
|
||||||
s.string.replace ''
|
s.string.replace ''
|
||||||
# unspecified: assert_equal 2, s.pos
|
# unspecified: assert_equal 2, s.pos
|
||||||
assert_equal nil, s.scan(/test/)
|
assert_equal nil, s.scan(/test/)
|
||||||
|
|
||||||
|
# [ruby-bugs:4361]
|
||||||
|
s = StringScanner.new("")
|
||||||
|
assert_equal "", s.scan(//)
|
||||||
|
assert_equal "", s.scan(//)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_skip
|
def test_skip
|
||||||
|
@ -259,6 +264,11 @@ class TestStringScanner < Test::Unit::TestCase
|
||||||
s.scan(/te/)
|
s.scan(/te/)
|
||||||
s.string.replace ''
|
s.string.replace ''
|
||||||
assert_equal nil, s.skip(/./)
|
assert_equal nil, s.skip(/./)
|
||||||
|
|
||||||
|
# [ruby-bugs:4361]
|
||||||
|
s = StringScanner.new("")
|
||||||
|
assert_equal 0, s.skip(//)
|
||||||
|
assert_equal 0, s.skip(//)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_getch
|
def test_getch
|
||||||
|
|
Loading…
Add table
Reference in a new issue