summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_m17n.rb5
-rw-r--r--test/ruby/test_m17n_comb.rb12
2 files changed, 14 insertions, 3 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index b9b85b2129..7d00b1aec6 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1037,6 +1037,11 @@ class TestM17N < Test::Unit::TestCase
assert_raise(Encoding::CompatibilityError){s.count(a("\xa3\xb0"))}
end
+ def test_count_sjis_trailing_byte
+ bug10078 = '[ruby-dev:48442] [Bug #10078]'
+ assert_equal(0, s("\x98\x61").count("a"), bug10078)
+ end
+
def test_delete
assert_equal(1, e("\xa1\xa2").delete("z").length)
s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4")
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 446ceccc4a..55bfe39553 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -87,7 +87,7 @@ class TestM17NComb < Test::Unit::TestCase
r
end
- def assert_enccall(recv, meth, *args, &block)
+ def encdumpcall(recv, meth, *args, &block)
desc = ''
if String === recv
desc << encdump(recv)
@@ -110,6 +110,11 @@ class TestM17NComb < Test::Unit::TestCase
if block
desc << ' {}'
end
+ desc
+ end
+
+ def assert_enccall(recv, meth, *args, &block)
+ desc = encdumpcall(recv, meth, *args, &block)
result = nil
assert_nothing_raised(desc) {
result = recv.send(meth, *args, &block)
@@ -709,12 +714,13 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_count
combination(STRINGS, STRINGS) {|s1, s2|
+ desc = proc {encdumpcall(s1, :count, s2)}
if !s1.valid_encoding? || !s2.valid_encoding?
- assert_raise(ArgumentError, Encoding::CompatibilityError) { s1.count(s2) }
+ assert_raise(ArgumentError, Encoding::CompatibilityError, desc) { s1.count(s2) }
next
end
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
- assert_raise(Encoding::CompatibilityError) { s1.count(s2) }
+ assert_raise(Encoding::CompatibilityError, desc) { s1.count(s2) }
next
end
n = enccall(s1, :count, s2)