0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.0.0667: memory access error when command follows :endfunc

Problem:    Memory access error when command follows :endfunction. (Nikolai
            Pavlov)
Solution:   Make memory handling in :function straightforward. (closes #1793)
This commit is contained in:
Bram Moolenaar
2017-06-24 14:48:11 +02:00
parent 5fe691240b
commit 53564f7c1a
3 changed files with 42 additions and 21 deletions

View File

@@ -1379,6 +1379,11 @@ func Test_endfunction_trailing()
delfunc Xtest
unlet done
" trailing line break
exe "func Xtest()\necho 'hello'\nendfunc\n"
call assert_true(exists('*Xtest'))
delfunc Xtest
set verbose=1
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
call assert_notmatch('W22:', split(execute('1messages'), "\n")[0])
@@ -1390,6 +1395,11 @@ func Test_endfunction_trailing()
call assert_true(exists('*Xtest'))
delfunc Xtest
set verbose=0
function Foo()
echo 'hello'
endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
delfunc Foo
endfunc
func Test_delfunction_force()