string.c: preserve encoding of global variable

* string.c (rb_str_setter): preserve encoding of global variable
  name in error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-11-23 17:03:48 +00:00
parent b58802a3c1
commit 25bab786cb
3 changed files with 11 additions and 1 deletions

View file

@ -2056,6 +2056,11 @@ class TestString < Test::Unit::TestCase
def test_setter
assert_raise(TypeError) { $/ = 1 }
name = "\u{5206 884c}"
assert_separately([], <<-"end;") # do
alias $#{name} $/
assert_raise_with_message(TypeError, /\\$#{name}/) { $#{name} = 1 }
end;
end
def test_to_id