mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
proc.c: show the given name
* proc.c (method_inspect): show the given name primarily, and original_id if aliased. [ruby-core:52048] [Bug #7806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e5d0cee76
commit
d40ef8a85c
3 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Feb 13 18:10:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* proc.c (method_inspect): show the given name primarily, and
|
||||||
|
original_id if aliased. [ruby-core:52048] [Bug #7806]
|
||||||
|
|
||||||
Wed Feb 13 17:56:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Feb 13 17:56:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (warnflags): disable -Werror by default unless
|
* configure.in (warnflags): disable -Werror by default unless
|
||||||
|
|
6
proc.c
6
proc.c
|
@ -1958,7 +1958,11 @@ method_inspect(VALUE method)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb_str_buf_cat2(str, sharp);
|
rb_str_buf_cat2(str, sharp);
|
||||||
rb_str_append(str, rb_id2str(data->me->def->original_id));
|
rb_str_append(str, rb_id2str(data->id));
|
||||||
|
if (data->id != data->me->def->original_id) {
|
||||||
|
rb_str_catf(str, "(%"PRIsVALUE")",
|
||||||
|
rb_id2str(data->me->def->original_id));
|
||||||
|
}
|
||||||
if (data->me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
|
if (data->me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
|
||||||
rb_str_buf_cat2(str, " (not-implemented)");
|
rb_str_buf_cat2(str, " (not-implemented)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,11 @@ class TestMethod < Test::Unit::TestCase
|
||||||
assert_equal(class << o; self; end, m.owner)
|
assert_equal(class << o; self; end, m.owner)
|
||||||
assert_equal(:foo, m.unbind.name)
|
assert_equal(:foo, m.unbind.name)
|
||||||
assert_equal(class << o; self; end, m.unbind.owner)
|
assert_equal(class << o; self; end, m.unbind.owner)
|
||||||
|
class << o
|
||||||
|
alias bar foo
|
||||||
|
end
|
||||||
|
m = o.method(:bar)
|
||||||
|
assert_equal(:bar, m.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_instance_method
|
def test_instance_method
|
||||||
|
@ -311,6 +316,12 @@ class TestMethod < Test::Unit::TestCase
|
||||||
c2.class_eval { private :foo }
|
c2.class_eval { private :foo }
|
||||||
m2 = c2.new.method(:foo)
|
m2 = c2.new.method(:foo)
|
||||||
assert_equal("#<Method: #{ c2.inspect }(#{ c.inspect })#foo>", m2.inspect)
|
assert_equal("#<Method: #{ c2.inspect }(#{ c.inspect })#foo>", 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("#<Method: #{ c3.inspect }#bar(foo)>", m3.inspect, bug7806)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_callee_top_level
|
def test_callee_top_level
|
||||||
|
|
Loading…
Reference in a new issue