comparison 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
comparison
equal deleted inserted replaced
21790:75be6f383577 21791:d504fcd3d2c0
1794 1794
1795 delete('Xexported.vim') 1795 delete('Xexported.vim')
1796 delete('Ximport.vim') 1796 delete('Ximport.vim')
1797 enddef 1797 enddef
1798 1798
1799 def Test_func_redefine_error()
1800 let lines = [
1801 'vim9script',
1802 'def Func()',
1803 ' eval [][0]',
1804 'enddef',
1805 'Func()',
1806 ]
1807 writefile(lines, 'Xtestscript.vim')
1808
1809 for count in range(3)
1810 try
1811 source Xtestscript.vim
1812 catch /E684/
1813 # function name should contain <SNR> every time
1814 assert_match('E684: list index out of range', v:exception)
1815 assert_match('function <SNR>\d\+_Func, line 1', v:throwpoint)
1816 endtry
1817 endfor
1818
1819 delete('Xtestscript.vim')
1820 enddef
1821
1799 def Test_func_overrules_import_fails() 1822 def Test_func_overrules_import_fails()
1800 let export_lines =<< trim END 1823 let export_lines =<< trim END
1801 vim9script 1824 vim9script
1802 export def Func() 1825 export def Func()
1803 echo 'imported' 1826 echo 'imported'