summaryrefslogtreecommitdiff
path: root/test/-ext-/string
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-01 08:09:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-01 08:09:17 +0000
commit41cbb7f05010b4f37490059ff8f5e52b4f1f8538 (patch)
treeacd50e060201989a20f157bf3e82cc62a41a9519 /test/-ext-/string
parent8d7d4e332241ca922b0821c2a5cd4b19c18a6cdf (diff)
cstr.c: split bug_str_cstr_unterm
* ext/-test-/string/cstr.c (bug_str_cstr_unterm): split unterminating from bug_str_cstr_term. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/string')
-rw-r--r--test/-ext-/string/test_cstr.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/-ext-/string/test_cstr.rb b/test/-ext-/string/test_cstr.rb
index 7e24ec6..99c1325 100644
--- a/test/-ext-/string/test_cstr.rb
+++ b/test/-ext-/string/test_cstr.rb
@@ -7,11 +7,13 @@ class Test_StringCStr < Test::Unit::TestCase
def test_embed
s = Bug::String.new("abcdef")
s.set_len(3)
+ s.cstr_unterm('x')
assert_equal(0, s.cstr_term, Bug4319)
end
def test_long
s = Bug::String.new("abcdef")*100000
+ s.cstr_unterm('x')
assert_equal(0, s.cstr_term, Bug4319)
end
@@ -20,9 +22,11 @@ class Test_StringCStr < Test::Unit::TestCase
def test_wchar_embed
WCHARS.each do |enc|
s = Bug::String.new("\u{4022}a".encode(enc))
+ s.cstr_unterm('x')
assert_nothing_raised(ArgumentError) {s.cstr_term}
s.set_len(s.bytesize / 2)
assert_equal(1, s.size)
+ s.cstr_unterm('x')
assert_equal(0, s.cstr_term)
end
end
@@ -33,9 +37,11 @@ class Test_StringCStr < Test::Unit::TestCase
len = str.size * n
WCHARS.each do |enc|
s = Bug::String.new(str.encode(enc))*n
+ s.cstr_unterm('x')
assert_nothing_raised(ArgumentError, enc.name) {s.cstr_term}
s.set_len(s.bytesize / 2)
assert_equal(len / 2, s.size, enc.name)
+ s.cstr_unterm('x')
assert_equal(0, s.cstr_term, enc.name)
end
end