diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-12-07 12:23:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-07 12:23:57 +0000 |
commit | 4dc24eb5adbcc76838fae1e900936dd230209d96 (patch) | |
tree | 79f8deb9ac0294b4cbc228cbde0180ce205964c7 /src/testdir/test_ins_complete.vim | |
parent | 92c33eb2735045d25fceed3b607f44d7156c59c1 (diff) |
patch 8.2.3756: might crash when callback is not validv8.2.3756
Problem: might crash when callback is not valid.
Solution: Check for valid callback. (Yegappan Lakshmanan, closes #9293)
Diffstat (limited to 'src/testdir/test_ins_complete.vim')
-rw-r--r-- | src/testdir/test_ins_complete.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index d508ba087f..aa7b24bf85 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -1074,6 +1074,15 @@ func Test_completefunc_callback() call assert_fails('call feedkeys("A\<C-X>\<C-U>\<Esc>", "x")', 'E117:') call assert_equal([], g:MycompleteFunc2_args) + " set 'completefunc' to a non-existing function + set completefunc=MycompleteFunc2 + call setline(1, 'five') + call assert_fails("set completefunc=function('NonExistingFunc')", 'E700:') + call assert_fails("let &completefunc = function('NonExistingFunc')", 'E700:') + let g:MycompleteFunc2_args = [] + call feedkeys("A\<C-X>\<C-U>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'five']], g:MycompleteFunc2_args) + " cleanup delfunc MycompleteFunc1 delfunc MycompleteFunc2 @@ -1285,6 +1294,15 @@ func Test_omnifunc_callback() call assert_fails('call feedkeys("A\<C-X>\<C-O>\<Esc>", "x")', 'E117:') call assert_equal([], g:MyomniFunc2_args) + " set 'omnifunc' to a non-existing function + set omnifunc=MyomniFunc2 + call setline(1, 'nine') + call assert_fails("set omnifunc=function('NonExistingFunc')", 'E700:') + call assert_fails("let &omnifunc = function('NonExistingFunc')", 'E700:') + let g:MyomniFunc2_args = [] + call feedkeys("A\<C-X>\<C-O>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'nine']], g:MyomniFunc2_args) + " cleanup delfunc MyomniFunc1 delfunc MyomniFunc2 @@ -1522,6 +1540,16 @@ func Test_thesaurusfunc_callback() call feedkeys("A\<C-X>\<C-T>\<Esc>", "x") call assert_equal('sunday', getline(1)) call assert_equal([[1, ''], [0, 'sun']], g:MytsrFunc4_args) + %bw! + + " set 'thesaurusfunc' to a non-existing function + set thesaurusfunc=MytsrFunc2 + call setline(1, 'ten') + call assert_fails("set thesaurusfunc=function('NonExistingFunc')", 'E700:') + call assert_fails("let &thesaurusfunc = function('NonExistingFunc')", 'E700:') + let g:MytsrFunc2_args = [] + call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'ten']], g:MytsrFunc2_args) " cleanup set thesaurusfunc& |