patch 8.2.0615: regexp benchmark stest is old style
Problem: Regexp benchmark stest is old style.
Solution: Make it a new style test. Fix using a NULL list. Add more tests.
(Yegappan Lakshmanan, closes #5963)
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index a1c7b98..7ae2639 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -469,6 +469,7 @@
" Test for 'completefunc' deleting text
func Test_completefunc_error()
new
+ " delete text when called for the first time
func CompleteFunc(findstart, base)
if a:findstart == 1
normal dd
@@ -479,9 +480,39 @@
set completefunc=CompleteFunc
call setline(1, ['', 'abcd', ''])
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E840:')
+
+ " delete text when called for the second time
+ func CompleteFunc2(findstart, base)
+ if a:findstart == 1
+ return col('.') - 1
+ endif
+ normal dd
+ return ['a', 'b']
+ endfunc
+ set completefunc=CompleteFunc2
+ call setline(1, ['', 'abcd', ''])
+ call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E565:')
+
set completefunc&
delfunc CompleteFunc
+ delfunc CompleteFunc2
close!
endfunc
+" Test for errors in using complete() function
+func Test_complete_func_error()
+ call assert_fails('call complete(1, ["a"])', 'E785:')
+ func ListColors()
+ call complete(col('.'), "blue")
+ endfunc
+ call assert_fails('exe "normal i\<C-R>=ListColors()\<CR>"', 'E474:')
+ func ListMonths()
+ call complete(col('.'), test_null_list())
+ endfunc
+ call assert_fails('exe "normal i\<C-R>=ListMonths()\<CR>"', 'E474:')
+ delfunc ListColors
+ delfunc ListMonths
+ call assert_fails('call complete_info({})', 'E714:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab