summaryrefslogtreecommitdiff
path: root/test/-ext-/string
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-05 01:54:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-05 01:54:22 +0000
commit3614f8bd1c813916054079055d13462e90808a96 (patch)
tree630977a8a3021123bf01dd0e3639f9b2215e1a8d /test/-ext-/string
parent6c41b73decf61254ac9c3bc3fc0e1d0169d5b524 (diff)
string.c: wchar terminator
* string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): terminate wchar strings with wchar 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/string')
-rw-r--r--test/-ext-/string/test_cstr.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/-ext-/string/test_cstr.rb b/test/-ext-/string/test_cstr.rb
index f691da6..1809fa1 100644
--- a/test/-ext-/string/test_cstr.rb
+++ b/test/-ext-/string/test_cstr.rb
@@ -39,4 +39,16 @@ class Test_StringCStr < Test::Unit::TestCase
assert_equal(0, s.cstr_term)
end
end
+
+ def test_wchar_lstrip!
+ str = Bug::String.new(" a".encode(Encoding::UTF_16BE))
+ str.lstrip!
+ assert_nil(str.cstr_term_char)
+ end
+
+ def test_wchar_rstrip!
+ str = Bug::String.new("a ".encode(Encoding::UTF_16BE))
+ str.rstrip!
+ assert_nil(str.cstr_term_char)
+ end
end