mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_method.c: preserve encodings
* vm_method.c (rb_mod_remove_method): preserve encodings of method name and class name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
606e855622
commit
91e2cd34d4
2 changed files with 15 additions and 2 deletions
|
@ -365,6 +365,19 @@ class TestObject < Test::Unit::TestCase
|
|||
end
|
||||
INPUT
|
||||
end
|
||||
|
||||
m = "\u{30e1 30bd 30c3 30c9}"
|
||||
c = Class.new
|
||||
assert_raise_with_message(NameError, /#{m}/) do
|
||||
c.class_eval {remove_method m}
|
||||
end
|
||||
c = Class.new {
|
||||
define_method(m) {}
|
||||
remove_method(m)
|
||||
}
|
||||
assert_raise_with_message(NameError, /#{m}/) do
|
||||
c.class_eval {remove_method m}
|
||||
end
|
||||
end
|
||||
|
||||
def test_method_missing
|
||||
|
|
|
@ -806,8 +806,8 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
|
|||
VALUE v = argv[i];
|
||||
ID id = rb_check_id(&v);
|
||||
if (!id) {
|
||||
rb_name_error_str(v, "method `%s' not defined in %s",
|
||||
RSTRING_PTR(v), rb_class2name(mod));
|
||||
rb_name_error_str(v, "method `%"PRIsVALUE"' not defined in %"PRIsVALUE,
|
||||
v, rb_obj_class(mod));
|
||||
}
|
||||
remove_method(mod, id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue