aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_settracefunc.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 10:49:46 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 10:49:46 +0000
commit370212a8ae39939979cf0651bd98108316a8e535 (patch)
tree70ed6cfd5100445d2e1366c51ce48de859e6665d /test/ruby/test_settracefunc.rb
parent59bdf7eac8dfaf740e2c87da93efdfc96b1c9469 (diff)
downloadruby-370212a8ae39939979cf0651bd98108316a8e535.tar.gz
* 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/trunk@46464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_settracefunc.rb')
-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 72e114398b..0c8d7399cc 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|
@@ -1238,4 +1238,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