diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-22 04:33:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-22 04:33:38 +0000 |
commit | d2d9257cd4b122fc5a7dca40594365d765e52011 (patch) | |
tree | 1aa501e455b5b0524d3e72877073d3cf0aca8412 /test/ruby | |
parent | 1a95e46cc6194933cf75a4bf91a0bb6502f177a0 (diff) |
string.c: raise at invalid byte sequence
* string.c (rb_str_count): raise at invalid byte sequence argument
even if single-byte optimization is effective.
[ruby-dev:48442] [Bug #10078]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_m17n_comb.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index 12aa4d539d..b7efd030fe 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -88,7 +88,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) @@ -111,6 +111,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) @@ -710,12 +715,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) |