From aafa14b4e8e0340b5bc1ab6bcbd76f5e5435e15f Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 3 May 2016 05:19:20 +0000 Subject: parse.y: trace elsif * parse.y (new_if_gen): set newline flag to NODE_IF to trace all if/elsif statements. [ruby-core:67720] [Bug #10763] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_settracefunc.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 9de2137aab..018c0062c3 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -1399,6 +1399,25 @@ class TestSetTraceFunc < Test::Unit::TestCase assert_equal [__LINE__ - 3, __LINE__ - 2], lines, 'Bug #10449' end + def test_elsif_line_event + bug10763 = '[ruby-core:67720] [Bug #10763]' + lines = [] + line = nil + + TracePoint.new(:line){|tp| + next unless target_thread? + lines << tp.lineno if line + }.enable{ + line = __LINE__ + if !line + 1 + elsif line + 2 + end + } + assert_equal [line+1, line+3, line+4], lines, bug10763 + end + class Bug10724 def initialize loop{return} -- cgit v1.2.3