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
@ -365,6 +365,19 @@ class TestObject < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
INPUT
|
INPUT
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def test_method_missing
|
def test_method_missing
|
||||||
|
@ -806,8 +806,8 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
|
|||||||
VALUE v = argv[i];
|
VALUE v = argv[i];
|
||||||
ID id = rb_check_id(&v);
|
ID id = rb_check_id(&v);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
rb_name_error_str(v, "method `%s' not defined in %s",
|
rb_name_error_str(v, "method `%"PRIsVALUE"' not defined in %"PRIsVALUE,
|
||||||
RSTRING_PTR(v), rb_class2name(mod));
|
v, rb_obj_class(mod));
|
||||||
}
|
}
|
||||||
remove_method(mod, id);
|
remove_method(mod, id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user