summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-26 02:39:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-26 02:39:00 +0000
commit34d4105556511e811fd632af7a7cebe970c08854 (patch)
treeb6e03e3b5ccbf92b0b8f5bd2f88e6bac4b02f107 /test
parent622f3f14b6928ee4fe3afa96db0250eb9da32e7a (diff)
string.c: consider widechar
* string.c (str_make_independent_expand): consider wide char encoding. [Fix GH-821] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/string/test_cstr.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/-ext-/string/test_cstr.rb b/test/-ext-/string/test_cstr.rb
index 72a9dd6..272e090 100644
--- a/test/-ext-/string/test_cstr.rb
+++ b/test/-ext-/string/test_cstr.rb
@@ -93,6 +93,17 @@ class Test_StringCStr < Test::Unit::TestCase
{}[string] = 1
non_terminated = "#{string}#{nil}"
assert_nil(Bug::String.cstr_term_char(non_terminated), gh821)
+
+ result = {}
+ WCHARS.map do |enc|
+ embedded_string = "ab".encode(enc)
+ string = embedded_string.gsub("b".encode(enc), "1".encode(enc))
+ {}[string] = 1
+ non_terminated = "#{string}#{nil}"
+ c = Bug::String.cstr_term_char(non_terminated)
+ result[enc] = c if c
+ end
+ assert_empty(result, gh821)
end
def assert_wchars_term_char(str)