diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-04 02:11:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-04 02:11:37 +0000 |
commit | a7e1820a9f9c0b6c84c281c171c105a34aa16738 (patch) | |
tree | 5de8ea761af4e4ac30dc229518093bacc55d2ee2 /test/ruby/test_method.rb | |
parent | 07132e0675ecacd9215504e9f9631fa1f83b7670 (diff) | |
download | ruby-a7e1820a9f9c0b6c84c281c171c105a34aa16738.tar.gz |
__callee__ fix
* eval.c (rb_frame_callee, rb_f_callee_name): fix to return the called
id.
* vm_insnhelper.c (vm_push_frame): set proper method entry.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index e299b722ee..6a5a75cf20 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -90,6 +90,20 @@ class TestMethod < Test::Unit::TestCase assert_equal(:m, Class.new {define_method(:m) {__method__}}.new.m) assert_equal(:m, Class.new {define_method(:m) {tap{return __method__}}}.new.m) assert_nil(eval("class TestCallee; __method__; end")) + + assert_equal(:test_callee, __callee__) + [ + ["method", Class.new {def m; __callee__; end},], + ["block", Class.new {def m; tap{return __callee__}; end},], + ["define_method", Class.new {define_method(:m) {__callee__}}], + ["define_method block", Class.new {define_method(:m) {tap{return __callee__}}}], + ].each do |mesg, c| + c.class_eval {alias m2 m} + o = c.new + assert_equal(:m, o.m, mesg) + assert_equal(:m2, o.m2, mesg) + end + assert_nil(eval("class TestCallee; __callee__; end")) end def test_method_in_define_method_block |