summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 16:37:33 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-30 16:37:33 +0000
commite0c00fccc47fbf473768cc84d808c2de06b1e69f (patch)
treedf1428e37687b4dd318aa252d8495708bdd30764 /test
parentd22cfb2fdb900cdbc732a3667b5706130905a21c (diff)
merge revision(s) r46464: [Backport #9959]
* vm.c (invoke_block_from_c): move call/return event timing for bmethod. It can invoke inconsistent call event if this call raises argument error. [Bug #9959] * vm_insnhelper.c (vm_call_bmethod_body): ditto. * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_settracefunc.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index cee9029304..bcdde70860 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -383,7 +383,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
[["c-return", 3, :set_trace_func, Kernel],
["line", 6, __method__, self.class],
- ["call", 6, :foobar, FooBar],
+ ["call", 1, :foobar, FooBar],
["return", 6, :foobar, FooBar],
["line", 7, __method__, self.class],
["c-call", 7, :set_trace_func, Kernel]].each{|e|
@@ -1232,4 +1232,23 @@ class TestSetTraceFunc < Test::Unit::TestCase
trace.disable
end
end
+
+ define_method(:method_test_argument_error_on_bmethod){|correct_key: 1|}
+
+ def test_argument_error_on_bmethod
+ events = []
+ curr_thread = Thread.current
+ TracePoint.new(:call, :return){|tp|
+ next if curr_thread != Thread.current
+ events << [tp.event, tp.method_id]
+ }.enable do
+ begin
+ method_test_argument_error_on_bmethod(wrong_key: 2)
+ rescue => e
+ # ignore
+ end
+ end
+
+ assert_equal [], events # should be empty.
+ end
end