0
0
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:
Bram Moolenaar
2020-08-14 18:35:07 +02:00
parent c4ce36d486
commit 7517ffdbb5
3 changed files with 44 additions and 1 deletions

View File

@@ -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