string.c: fill the terminator

* string.c (str_replace_shared_without_enc): fill the terminator
  of embedded strings in wide char encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-07-25 02:05:34 +00:00
parent 9e4b24d4f3
commit 8101cc3de4
3 changed files with 26 additions and 5 deletions

View file

@ -86,6 +86,14 @@ class Test_StringCStr < Test::Unit::TestCase
}
end
def test_wchar_replace
assert_wchars_term_char("abc") {|s|
w = s.dup
s.replace("abcdefghijklmnop")
s.replace(w)
}
end
def test_embedded_from_heap
gh821 = "[GH-821]"
embedded_string = "abcdefghi"