From f423f7c29f2cfa7686b8e0ca0b9aa365f2b3d78c Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 7 Jan 2018 09:36:48 +0000 Subject: parse.y: nd_line of new_qcall * parse.y (new_qcall): set nd_line to the method name location. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_syntax.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 8bf1627f3b..e85d6b545f 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1137,6 +1137,32 @@ eom assert_nil obj.test end + def test_method_call_location + line = __LINE__+5 + e = assert_raise(NoMethodError) do + 1.upto(0) do + end + . + foo( + 1, + 2, + ) + end + assert_equal(line, e.backtrace_locations[0].lineno) + + line = __LINE__+5 + e = assert_raise(NoMethodError) do + 1.upto 0 do + end + . + foo( + 1, + 2, + ) + end + assert_equal(line, e.backtrace_locations[0].lineno) + end + private def not_label(x) @result = x; @not_label ||= nil end -- cgit v1.2.3