From 1d42215eb5c0a68c542f5855010bcc816c01fdb6 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 2 Oct 2008 11:46:40 +0000 Subject: * string.c (rb_str_sub_bang): fix coderange. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_m17n.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby/test_m17n.rb') diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index a1772f640..416d8e190 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -959,6 +959,21 @@ class TestM17N < Test::Unit::TestCase assert_equal(Encoding::EUC_JP, "\xa4\xa2".force_encoding("euc-jp").gsub(/./, '\&').encoding) end + def test_sub2 + s = "\x80".force_encoding("ASCII-8BIT") + r = Regexp.new("\x80".force_encoding("ASCII-8BIT")) + s2 = s.sub(r, "") + assert(s2.empty?) + assert(s2.ascii_only?) + end + + def test_sub3 + repl = "\x81".force_encoding("sjis") + assert_equal(false, repl.valid_encoding?) + s = "a@".sub(/a/, repl) + assert(s.valid_encoding?) + end + def test_insert s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") assert_equal(e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4a"), s.insert(-1, "a")) -- cgit