diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-02 11:46:40 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-02 11:46:40 +0000 |
commit | bd421aa2d25aa73c83642a8f5af8fa16b794a3b6 (patch) | |
tree | d4e528d553256bdef37711ce58dba2705ad3df80 /test/ruby/test_m17n.rb | |
parent | 255f43160bf165df350454bdf4dcf72275029704 (diff) | |
download | ruby-bd421aa2d25aa73c83642a8f5af8fa16b794a3b6.tar.gz |
* string.c (rb_str_sub_bang): fix coderange.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r-- | test/ruby/test_m17n.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index a1772f6408..416d8e190c 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")) |