diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-16 06:51:17 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-16 06:51:17 +0000 |
commit | 7cbeff908fb75f82b08b2e7eeaed937167eef2d6 (patch) | |
tree | 89f4952dcb34e48bd655d55b645e627e194c90ce /test | |
parent | 3d490d209aaa9b6ae57748dba2a5782be4aeeaf8 (diff) | |
download | ruby-7cbeff908fb75f82b08b2e7eeaed937167eef2d6.tar.gz |
* proc.c (rb_binding_new_with_cfp): create binding object even if
the frame is IFUNC. But return a ruby-level binding to keep
compatibility.
This patch fix degradation introduced from r39067.
[Bug #7774] [ruby-dev:46960]
* test/ruby/test_settracefunc.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index b4143c602c..b010846b92 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -942,6 +942,16 @@ class TestSetTraceFunc < Test::Unit::TestCase assert_security_error_safe4(func) end + def m1_for_test_trace_point_binding_in_ifunc(arg) + arg + nil + rescue + end + + def m2_for_test_trace_point_binding_in_ifunc(arg) + arg.inject(:+) + rescue + end + def test_trace_point_binding_in_ifunc bug7774 = '[ruby-dev:46908]' src = %q{ @@ -969,5 +979,32 @@ class TestSetTraceFunc < Test::Unit::TestCase rescue RuntimeError end }, bug7774 + + # TracePoint + tp_b = nil + TracePoint.new(:raise) do |tp| + tp_b = tp.binding + end.enable do + m1_for_test_trace_point_binding_in_ifunc(0) + assert_equal(self, eval('self', tp_b), '[ruby-dev:46960]') + + m2_for_test_trace_point_binding_in_ifunc([0, nil]) + assert_equal(self, eval('self', tp_b), '[ruby-dev:46960]') + end + + # set_trace_func + stf_b = nil + set_trace_func ->(event, file, line, id, binding, klass) do + stf_b = binding if event == 'raise' + end + begin + m1_for_test_trace_point_binding_in_ifunc(0) + assert_equal(self, eval('self', stf_b), '[ruby-dev:46960]') + + m2_for_test_trace_point_binding_in_ifunc([0, nil]) + assert_equal(self, eval('self', stf_b), '[ruby-dev:46960]') + ensure + set_trace_func(nil) + end end end |