error.c: preserve encoding

* error.c (rb_error_frozen_object): preserve encoding of class
  name in error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-09-19 01:46:42 +00:00
parent d9a597408f
commit 8b9afe6520
3 changed files with 20 additions and 1 deletions

View file

@ -68,6 +68,17 @@ class TestObject < Test::Unit::TestCase
assert_equal(true, nil.frozen?)
end
def test_frozen_error_message
name = "C\u{30c6 30b9 30c8}"
klass = EnvUtil.labeled_class(name) {
attr_accessor :foo
}
obj = klass.new.freeze
assert_raise_with_message(RuntimeError, /#{name}/) {
obj.foo = 1
}
end
def test_nil_to_f
assert_equal(0.0, nil.to_f)
end