diff --git a/proc.c b/proc.c index 7f4f2d46b6..217d228a8a 100644 --- a/proc.c +++ b/proc.c @@ -2743,6 +2743,18 @@ method_inspect(VALUE method) if (data->me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) { rb_str_buf_cat2(str, " (not-implemented)"); } + + // parameter information + // TODO + + { // source location + VALUE loc = rb_method_location(method); + if (!NIL_P(loc)) { + rb_str_catf(str, " %"PRIsVALUE":%"PRIsVALUE, + RARRAY_AREF(loc, 0), RARRAY_AREF(loc, 1)); + } + } + rb_str_buf_cat2(str, ">"); return str; diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 4e20534dfa..ba425a4517 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -432,29 +432,29 @@ class TestMethod < Test::Unit::TestCase def test_inspect o = Object.new - def o.foo; end + def o.foo; end; line_no = __LINE__ m = o.method(:foo) - assert_equal("#", m.inspect) + assert_equal("#", m.inspect) m = o.method(:foo) - assert_equal("#", m.unbind.inspect) + assert_match("#", m.inspect) + assert_equal("#", m.inspect) m = c.instance_method(:foo) - assert_equal("#", m.inspect) + assert_equal("#", m.inspect) c2 = Class.new(c) c2.class_eval { private :foo } m2 = c2.new.method(:foo) - assert_equal("#", m2.inspect) + assert_equal("#", m2.inspect) bug7806 = '[ruby-core:52048] [Bug #7806]' c3 = Class.new(c) c3.class_eval { alias bar foo } m3 = c3.new.method(:bar) - assert_equal("#", m3.inspect, bug7806) + assert_equal("#", m3.inspect, bug7806) m.taint assert_predicate(m.inspect, :tainted?, "inspect result should be infected") diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 604edf5f59..37045ad0d9 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -2313,7 +2313,7 @@ class TestModule < Test::Unit::TestCase A.prepend InspectIsShallow - expect = "#" + expect = "#" assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}" RUBY end