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_squeeze_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0eebb8f1c0
commit
5c100b57f8
2 changed files with 5 additions and 1 deletions
2
string.c
2
string.c
|
@ -6076,7 +6076,7 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
|
|||
}
|
||||
}
|
||||
|
||||
*t = '\0';
|
||||
TERM_FILL(t, TERM_LEN(str));
|
||||
if (t - RSTRING_PTR(str) != RSTRING_LEN(str)) {
|
||||
STR_SET_LEN(str, t - RSTRING_PTR(str));
|
||||
modify = 1;
|
||||
|
|
|
@ -68,6 +68,10 @@ class Test_StringCStr < Test::Unit::TestCase
|
|||
assert_wchars_term_char("foobar") {|s| s.delete!("ao".encode(s.encoding))}
|
||||
end
|
||||
|
||||
def test_wchar_squeeze!
|
||||
assert_wchars_term_char("foo!") {|s| s.squeeze!}
|
||||
end
|
||||
|
||||
def assert_wchars_term_char(str)
|
||||
result = {}
|
||||
WCHARS.map do |enc|
|
||||
|
|
Loading…
Reference in a new issue