diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-11 13:02:23 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-11 13:02:23 +0100 |
commit | cee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a (patch) | |
tree | 3459c3d301a0dfcb6669b6e5aa3b50597ccb0c0e /src/testdir/test_ins_complete.vim | |
parent | 6f7e555f7440df148350468ad8bc6d559d676d7c (diff) | |
download | vim-git-cee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a.tar.gz |
patch 8.1.0716: get warning message when 'completefunc' returns nothingv8.1.0716
Problem: Get warning message when 'completefunc' returns nothing.
Solution: Allow for returning v:none to suppress the warning message.
(Yasuhiro Matsumoto, closes #3789)
Diffstat (limited to 'src/testdir/test_ins_complete.vim')
-rw-r--r-- | src/testdir/test_ins_complete.vim | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index e1c733f69..6fb6e79e7 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -142,6 +142,14 @@ func Test_completefunc_args() delfunc CompleteFunc endfunc +func s:CompleteDone_CompleteFuncNone( findstart, base ) + if a:findstart + return 0 + endif + + return v:none +endfunc + func s:CompleteDone_CompleteFuncDict( findstart, base ) if a:findstart return 0 @@ -161,6 +169,10 @@ func s:CompleteDone_CompleteFuncDict( findstart, base ) \ } endfunc +func s:CompleteDone_CheckCompletedItemNone() + let s:called_completedone = 1 +endfunc + func s:CompleteDone_CheckCompletedItemDict() call assert_equal( 'aword', v:completed_item[ 'word' ] ) call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) @@ -172,21 +184,34 @@ func s:CompleteDone_CheckCompletedItemDict() let s:called_completedone = 1 endfunc -function Test_CompleteDoneDict() +func Test_CompleteDoneNone() + au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemNone() + + set completefunc=<SID>CompleteDone_CompleteFuncNone + execute "normal a\<C-X>\<C-U>\<C-Y>" + set completefunc& + + call assert_true(s:called_completedone) + + let s:called_completedone = 0 + au! CompleteDone +endfunc + +func Test_CompleteDoneDict() au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict() set completefunc=<SID>CompleteDone_CompleteFuncDict execute "normal a\<C-X>\<C-U>\<C-Y>" set completefunc& - call assert_equal( 'test', v:completed_item[ 'user_data' ] ) - call assert_true( s:called_completedone ) + call assert_equal('test', v:completed_item[ 'user_data' ]) + call assert_true(s:called_completedone) let s:called_completedone = 0 au! CompleteDone endfunc -func s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) +func s:CompleteDone_CompleteFuncDictNoUserData(findstart, base) if a:findstart return 0 endif @@ -215,21 +240,21 @@ func s:CompleteDone_CheckCompletedItemDictNoUserData() let s:called_completedone = 1 endfunc -function Test_CompleteDoneDictNoUserData() +func Test_CompleteDoneDictNoUserData() au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDictNoUserData() set completefunc=<SID>CompleteDone_CompleteFuncDictNoUserData execute "normal a\<C-X>\<C-U>\<C-Y>" set completefunc& - call assert_equal( '', v:completed_item[ 'user_data' ] ) - call assert_true( s:called_completedone ) + call assert_equal('', v:completed_item[ 'user_data' ]) + call assert_true(s:called_completedone) let s:called_completedone = 0 au! CompleteDone endfunc -func s:CompleteDone_CompleteFuncList( findstart, base ) +func s:CompleteDone_CompleteFuncList(findstart, base) if a:findstart return 0 endif @@ -248,15 +273,15 @@ func s:CompleteDone_CheckCompletedItemList() let s:called_completedone = 1 endfunc -function Test_CompleteDoneList() +func Test_CompleteDoneList() au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemList() set completefunc=<SID>CompleteDone_CompleteFuncList execute "normal a\<C-X>\<C-U>\<C-Y>" set completefunc& - call assert_equal( '', v:completed_item[ 'user_data' ] ) - call assert_true( s:called_completedone ) + call assert_equal('', v:completed_item[ 'user_data' ]) + call assert_true(s:called_completedone) let s:called_completedone = 0 au! CompleteDone |