diff src/testdir/test_vim9_func.vim @ 21793:0706bd071fa3 v8.2.1446

patch 8.2.1446: Vim9: line number in error message is not correct Commit: https://github.com/vim/vim/commit/7517ffdbb564250de72ee3ef64fecf4a486df519 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 14 18:35:07 2020 +0200 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 https://github.com/vim/vim/issues/6708)
author Bram Moolenaar <Bram@vim.org>
date Fri, 14 Aug 2020 18:45:05 +0200
parents 25b659fa5ca5
children 51d4e0bc2eb7
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -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