Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 21791:d504fcd3d2c0 v8.2.1445
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Commit: https://github.com/vim/vim/commit/c4ce36d48698669f81ec90f7c9dc9ab8c362e538
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 14 17:08:15 2020 +0200
patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again
Problem: Vim9: function expanded name is cleared when sourcing a script
again.
Solution: Only clear the expanded name when deleting the function.
(closes #6707)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 14 Aug 2020 17:15:04 +0200 |
parents | 6922d78b4d52 |
children | 1344d45ca6f2 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1796,6 +1796,29 @@ def Test_import_compile_error() delete('Ximport.vim') enddef +def Test_func_redefine_error() + let lines = [ + 'vim9script', + 'def Func()', + ' eval [][0]', + 'enddef', + 'Func()', + ] + writefile(lines, 'Xtestscript.vim') + + for count in range(3) + try + source Xtestscript.vim + catch /E684/ + # function name should contain <SNR> every time + assert_match('E684: list index out of range', v:exception) + assert_match('function <SNR>\d\+_Func, line 1', v:throwpoint) + endtry + endfor + + delete('Xtestscript.vim') +enddef + def Test_func_overrules_import_fails() let export_lines =<< trim END vim9script