mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
string.c: term fill
* string.c (rb_str_delete_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
117438ee7b
commit
7a77cf7133
2 changed files with 5 additions and 1 deletions
2
string.c
2
string.c
|
@ -5971,7 +5971,7 @@ rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
|
|||
s += clen;
|
||||
}
|
||||
}
|
||||
*t = '\0';
|
||||
TERM_FILL(t, TERM_LEN(str));
|
||||
STR_SET_LEN(str, t - RSTRING_PTR(str));
|
||||
ENC_CODERANGE_SET(str, cr);
|
||||
|
||||
|
|
|
@ -64,6 +64,10 @@ class Test_StringCStr < Test::Unit::TestCase
|
|||
assert_wchars_term_char("foobar") {|s| s.sub!(/#{"foo".encode(s.encoding)}/, "")}
|
||||
end
|
||||
|
||||
def test_wchar_delete!
|
||||
assert_wchars_term_char("foobar") {|s| s.delete!("ao".encode(s.encoding))}
|
||||
end
|
||||
|
||||
def assert_wchars_term_char(str)
|
||||
result = {}
|
||||
WCHARS.map do |enc|
|
||||
|
|
Loading…
Reference in a new issue