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
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)) {
|
if (t - RSTRING_PTR(str) != RSTRING_LEN(str)) {
|
||||||
STR_SET_LEN(str, t - RSTRING_PTR(str));
|
STR_SET_LEN(str, t - RSTRING_PTR(str));
|
||||||
modify = 1;
|
modify = 1;
|
||||||
|
@ -68,6 +68,10 @@ class Test_StringCStr < Test::Unit::TestCase
|
|||||||
assert_wchars_term_char("foobar") {|s| s.delete!("ao".encode(s.encoding))}
|
assert_wchars_term_char("foobar") {|s| s.delete!("ao".encode(s.encoding))}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_wchar_squeeze!
|
||||||
|
assert_wchars_term_char("foo!") {|s| s.squeeze!}
|
||||||
|
end
|
||||||
|
|
||||||
def assert_wchars_term_char(str)
|
def assert_wchars_term_char(str)
|
||||||
result = {}
|
result = {}
|
||||||
WCHARS.map do |enc|
|
WCHARS.map do |enc|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user