From b836d449b45abc03482db30c28a9de590a95bb6f Mon Sep 17 00:00:00 2001 From: Tom Stuart Date: Tue, 25 Aug 2015 17:05:01 +0100 Subject: [PATCH] Add failing test for String#index and #include? on wide encodings --- test/ruby/test_m17n.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index eb2063e..437f4ed 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1066,6 +1066,9 @@ class TestM17N < Test::Unit::TestCase assert_equal(false, e("\xa1\xa2\xa3\xa4").include?(e("\xa3"))) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") assert_equal(false, s.include?(e("\xb0\xa3"))) + each_encoding("abcdef", "def") do |str, substr| + assert_equal(true, str.include?(substr)) + end end def test_index @@ -1075,6 +1078,9 @@ class TestM17N < Test::Unit::TestCase assert_nil(e("\xa1\xa2\xa3\xa4").rindex(e("\xa3"))) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") assert_raise(Encoding::CompatibilityError){s.rindex(a("\xb1\xa3"))} + each_encoding("abcdef", "def") do |str, substr| + assert_equal(3, str.index(substr)) + end end def test_next -- 2.3.6