mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.2.1446: Vim9: line number in error message is not correct
Problem: Vim9: line number in error message is not correct. Solution: Set SOURCING_LNUM before calling emsg(). (closes #6708)
This commit is contained in:
@@ -1045,6 +1045,7 @@ def Test_error_reporting()
|
||||
call writefile(lines, 'Xdef')
|
||||
try
|
||||
source Xdef
|
||||
assert_report('should have failed')
|
||||
catch /E476:/
|
||||
assert_match('Invalid command: invalid', v:exception)
|
||||
assert_match(', line 3$', v:throwpoint)
|
||||
@@ -1064,11 +1065,30 @@ def Test_error_reporting()
|
||||
call writefile(lines, 'Xdef')
|
||||
try
|
||||
source Xdef
|
||||
assert_report('should have failed')
|
||||
catch /E476:/
|
||||
assert_match('Invalid command: invalid', v:exception)
|
||||
assert_match(', line 4$', v:throwpoint)
|
||||
endtry
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
def Func()
|
||||
let db = #{foo: 1, bar: 2}
|
||||
# comment
|
||||
let x = db.asdf
|
||||
enddef
|
||||
defcompile
|
||||
Func()
|
||||
END
|
||||
call writefile(lines, 'Xdef')
|
||||
try
|
||||
source Xdef
|
||||
assert_report('should have failed')
|
||||
catch /E716:/
|
||||
assert_match('_Func, line 3$', v:throwpoint)
|
||||
endtry
|
||||
|
||||
call delete('Xdef')
|
||||
enddef
|
||||
|
||||
|
Reference in New Issue
Block a user