ruby-changes:36494
From: nobu <ko1@a...>
Date: Wed, 26 Nov 2014 03:58:19 +0900 (JST)
Subject: [ruby-changes:36494] nobu:r48576 (trunk): vm_method.c: preserve encodings
nobu 2014-11-26 03:58:05 +0900 (Wed, 26 Nov 2014) New Revision: 48576 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48576 Log: vm_method.c: preserve encodings * vm_method.c (rb_mod_remove_method): preserve encodings of method name and class name in error messages. Modified files: trunk/test/ruby/test_object.rb trunk/vm_method.c Index: vm_method.c =================================================================== --- vm_method.c (revision 48575) +++ vm_method.c (revision 48576) @@ -806,8 +806,8 @@ rb_mod_remove_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/vm_method.c#L806 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); } Index: test/ruby/test_object.rb =================================================================== --- test/ruby/test_object.rb (revision 48575) +++ test/ruby/test_object.rb (revision 48576) @@ -365,6 +365,19 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L365 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/