Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 30814) +++ test/ruby/test_string.rb (working copy) @@ -153,6 +153,18 @@ class TestString < Test::Unit::TestCase assert_raise(ArgumentError) { "foo"[1, 2, 3] = "" } end + def test_ASET_encoding + a = S("a") + a.force_encoding Encoding::US_ASCII + + r = S("") + r.force_encoding Encoding::UTF_8 + + a[/a/] = r + + assert_equal Encoding::US_ASCII, a.encoding + end + def test_CMP # '<=>' assert_equal(1, S("abcdef") <=> S("abcde")) assert_equal(0, S("abcdef") <=> S("abcdef"))