diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_findfile.vim | 37 | ||||
-rw-r--r-- | test/old/testdir/test_ins_complete.vim | 41 |
2 files changed, 77 insertions, 1 deletions
diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 2c049537f0..539c7a661a 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -364,7 +364,7 @@ func Test_findfunc() " Error cases - " Function that doesn't any argument + " Function that doesn't take any arguments func FindFuncNoArg() endfunc set findfunc=FindFuncNoArg @@ -484,6 +484,41 @@ func Test_findfunc_scriptlocal_func() call assert_equal('abc', g:FindFuncArg) bw! + new | only + set findfunc= + setlocal findfunc=NoSuchFunc + setglobal findfunc=s:FindFuncScript + call assert_equal('NoSuchFunc', &findfunc) + call assert_equal('NoSuchFunc', &l:findfunc) + call assert_equal(expand('<SID>') .. 'FindFuncScript', &g:findfunc) + new | only + call assert_equal(expand('<SID>') .. 'FindFuncScript', &findfunc) + call assert_equal(expand('<SID>') .. 'FindFuncScript', &g:findfunc) + call assert_equal('', &l:findfunc) + let g:FindFuncArg = '' + find abc + call assert_equal('abc', g:FindFuncArg) + bw! + + new | only + set findfunc= + setlocal findfunc=NoSuchFunc + set findfunc=s:FindFuncScript + call assert_equal(expand('<SID>') .. 'FindFuncScript', &findfunc) + call assert_equal(expand('<SID>') .. 'FindFuncScript', &g:findfunc) + call assert_equal('', &l:findfunc) + let g:FindFuncArg = '' + find abc + call assert_equal('abc', g:FindFuncArg) + new | only + call assert_equal(expand('<SID>') .. 'FindFuncScript', &findfunc) + call assert_equal(expand('<SID>') .. 'FindFuncScript', &g:findfunc) + call assert_equal('', &l:findfunc) + let g:FindFuncArg = '' + find abc + call assert_equal('abc', g:FindFuncArg) + bw! + set findfunc= delfunc s:FindFuncScript endfunc diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 01695d5be5..c02aa1db62 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2268,6 +2268,7 @@ func Test_thesaurusfunc_callback() call add(g:TsrFunc3Args, [a:findstart, a:base]) return a:findstart ? 0 : [] endfunc + set tsrfu=s:TsrFunc3 new call setline(1, 'script1') @@ -2283,6 +2284,46 @@ func Test_thesaurusfunc_callback() call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') call assert_equal([[1, ''], [0, 'script2']], g:TsrFunc3Args) bw! + + new | only + set thesaurusfunc= + setlocal thesaurusfunc=NoSuchFunc + setglobal thesaurusfunc=s:TsrFunc3 + call assert_equal('NoSuchFunc', &thesaurusfunc) + call assert_equal('NoSuchFunc', &l:thesaurusfunc) + call assert_equal('s:TsrFunc3', &g:thesaurusfunc) + new | only + call assert_equal('s:TsrFunc3', &thesaurusfunc) + call assert_equal('s:TsrFunc3', &g:thesaurusfunc) + call assert_equal('', &l:thesaurusfunc) + call setline(1, 'script1') + let g:TsrFunc3Args = [] + call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'script1']], g:TsrFunc3Args) + bw! + + new | only + set thesaurusfunc= + setlocal thesaurusfunc=NoSuchFunc + set thesaurusfunc=s:TsrFunc3 + call assert_equal('s:TsrFunc3', &thesaurusfunc) + call assert_equal('s:TsrFunc3', &g:thesaurusfunc) + call assert_equal('', &l:thesaurusfunc) + call setline(1, 'script1') + let g:TsrFunc3Args = [] + call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'script1']], g:TsrFunc3Args) + setlocal bufhidden=wipe + new | only! + call assert_equal('s:TsrFunc3', &thesaurusfunc) + call assert_equal('s:TsrFunc3', &g:thesaurusfunc) + call assert_equal('', &l:thesaurusfunc) + call setline(1, 'script1') + let g:TsrFunc3Args = [] + call feedkeys("A\<C-X>\<C-T>\<Esc>", 'x') + call assert_equal([[1, ''], [0, 'script1']], g:TsrFunc3Args) + bw! + delfunc s:TsrFunc3 " invalid return value |