diff options
35 files changed, 456 insertions, 430 deletions
diff --git a/src/testdir/test49.vim b/src/testdir/test49.vim index f50062e7b2..0f825a255b 100644 --- a/src/testdir/test49.vim +++ b/src/testdir/test49.vim @@ -1,6 +1,6 @@ " Vim script language tests " Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com> -" Last Change: 2016 Feb 07 +" Last Change: 2019 Jan 09 "------------------------------------------------------------------------------- " Test environment {{{1 @@ -318,7 +318,7 @@ let ExtraVimCount = 0 let ExtraVimBase = expand("<sfile>") let ExtraVimTestEnv = "" " -function! ExtraVim(...) +function ExtraVim(...) " Count how often this function is called. let g:ExtraVimCount = g:ExtraVimCount + 1 @@ -500,7 +500,7 @@ endfunction " an ExtraVim script as passed by ExtraVim() in ExtraVimBegin. " " EXTRA_VIM_START - do not change or remove this line. -function! ExtraVimThrowpoint() +function ExtraVimThrowpoint() if !exists("g:ExtraVimBegin") Xout "ExtraVimThrowpoint() used outside ExtraVim() script." return v:throwpoint @@ -530,7 +530,7 @@ endfunction " as a script file, use ExecAsScript below. " " EXTRA_VIM_START - do not change or remove this line. -function! MakeScript(funcname, ...) +function MakeScript(funcname, ...) let script = tempname() execute "redir! >" . script execute "function" a:funcname @@ -568,7 +568,7 @@ endfunction " location specified in the function. " " EXTRA_VIM_START - do not change or remove this line. -function! ExecAsScript(funcname) +function ExecAsScript(funcname) " Make a script from the function passed as argument. let script = MakeScript(a:funcname) @@ -8548,7 +8548,7 @@ endfunction " Remove the autocommands for the events specified as arguments in all used " autogroups. -function! Delete_autocommands(...) +function Delete_autocommands(...) let augfile = tempname() while 1 try diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index b839bbb474..4582d1a989 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2,7 +2,7 @@ source shared.vim -func! s:cleanup_buffers() abort +func s:cleanup_buffers() abort for bnr in range(1, bufnr('$')) if bufloaded(bnr) && bufnr('%') != bnr execute 'bd! ' . bnr @@ -1343,7 +1343,7 @@ func Test_ChangedP() endfunc let g:setline_handled = v:false -func! SetLineOne() +func SetLineOne() if !g:setline_handled call setline(1, "(x)") let g:setline_handled = v:true diff --git a/src/testdir/test_charsearch.vim b/src/testdir/test_charsearch.vim index 8b313b5a35..17a49e02be 100644 --- a/src/testdir/test_charsearch.vim +++ b/src/testdir/test_charsearch.vim @@ -1,5 +1,5 @@ -function! Test_charsearch() +func Test_charsearch() enew! call append(0, ['Xabcdefghijkemnopqretuvwxyz', \ 'Yabcdefghijkemnopqretuvwxyz', @@ -29,10 +29,10 @@ function! Test_charsearch() normal! ;;p call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3)) enew! -endfunction +endfunc " Test for t,f,F,T movement commands and 'cpo-;' setting -function! Test_search_cmds() +func Test_search_cmds() enew! call append(0, ["aaa two three four", " zzz", "yyy ", \ "bbb yee yoo four", "ccc two three four", @@ -59,4 +59,4 @@ function! Test_search_cmds() call assert_equal('ccc', getline(5)) call assert_equal('ddd yee y', getline(6)) enew! -endfunction +endfunc diff --git a/src/testdir/test_charsearch_utf8.vim b/src/testdir/test_charsearch_utf8.vim index ade7dd408c..399ac51c48 100644 --- a/src/testdir/test_charsearch_utf8.vim +++ b/src/testdir/test_charsearch_utf8.vim @@ -4,7 +4,7 @@ if !has('multi_byte') endif " Test for t,f,F,T movement commands -function! Test_search_cmds() +func Test_search_cmds() new! call setline(1, "・最初から最後まで最強のVimは最高") 1 @@ -17,6 +17,6 @@ function! Test_search_cmds() normal! , call assert_equal([0, 1, 28, 0], getpos('.')) bw! -endfunction +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim index 48b7a2318e..e0e3e3b54c 100644 --- a/src/testdir/test_display.vim +++ b/src/testdir/test_display.vim @@ -5,7 +5,7 @@ endif source view_util.vim -func! Test_display_foldcolumn() +func Test_display_foldcolumn() if !has("folding") return endif @@ -38,7 +38,7 @@ func! Test_display_foldcolumn() quit! endfunc -func! Test_display_foldtext_mbyte() +func Test_display_foldtext_mbyte() if !has("folding") || !has("multi_byte") return endif diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index 63f58ae750..7b31469632 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -9,7 +9,7 @@ source view_util.vim " Needs to come first until the bug in getchar() is " fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ -func! Test_edit_00b() +func Test_edit_00b() new call setline(1, ['abc ']) inoreabbr <buffer> h here some more @@ -21,7 +21,7 @@ func! Test_edit_00b() bw! endfunc -func! Test_edit_01() +func Test_edit_01() " set for Travis CI? " set nocp noesckeys new @@ -61,7 +61,7 @@ func! Test_edit_01() bw! endfunc -func! Test_edit_02() +func Test_edit_02() " Change cursor position in InsertCharPre command new call setline(1, 'abc') @@ -101,7 +101,7 @@ func! Test_edit_02() bw! endfunc -func! Test_edit_03() +func Test_edit_03() " Change cursor after <c-o> command to end of line new call setline(1, 'abc') @@ -120,7 +120,7 @@ func! Test_edit_03() bw! endfunc -func! Test_edit_04() +func Test_edit_04() " test for :stopinsert new call setline(1, 'abc') @@ -132,7 +132,7 @@ func! Test_edit_04() bw! endfunc -func! Test_edit_05() +func Test_edit_05() " test for folds being opened new call setline(1, ['abcX', 'abcX', 'zzzZ']) @@ -154,7 +154,7 @@ func! Test_edit_05() bw! endfunc -func! Test_edit_06() +func Test_edit_06() " Test in diff mode if !has("diff") || !executable("diff") return @@ -176,7 +176,7 @@ func! Test_edit_06() bw! endfunc -func! Test_edit_07() +func Test_edit_07() " 1) Test with completion <c-l> when popupmenu is visible new call setline(1, 'J') @@ -213,7 +213,7 @@ func! Test_edit_07() bw! endfunc -func! Test_edit_08() +func Test_edit_08() " reset insertmode from i_ctrl-r_= let g:bufnr = bufnr('%') new @@ -227,7 +227,7 @@ func! Test_edit_08() unlet g:bufnr endfunc -func! Test_edit_09() +func Test_edit_09() " test i_CTRL-\ combinations new call setline(1, ['abc', 'def', 'ghi']) @@ -257,7 +257,7 @@ func! Test_edit_09() bw! endfunc -func! Test_edit_10() +func Test_edit_10() " Test for starting selectmode new set selectmode=key keymodel=startsel @@ -269,7 +269,7 @@ func! Test_edit_10() bw! endfunc -func! Test_edit_11() +func Test_edit_11() " Test that indenting kicks in new set cindent @@ -313,7 +313,7 @@ func! Test_edit_11() bw! endfunc -func! Test_edit_11_indentexpr() +func Test_edit_11_indentexpr() " Test that indenting kicks in new " Use indentexpr instead of cindenting @@ -340,7 +340,7 @@ func! Test_edit_11_indentexpr() bw! endfunc -func! Test_edit_12() +func Test_edit_12() " Test changing indent in replace mode new call setline(1, ["\tabc", "\tdef"]) @@ -392,7 +392,7 @@ func! Test_edit_12() bw! endfunc -func! Test_edit_13() +func Test_edit_13() " Test smartindenting if exists("+smartindent") new @@ -405,7 +405,7 @@ func! Test_edit_13() endif endfunc -func! Test_edit_CR() +func Test_edit_CR() " Test for <CR> in insert mode " basically only in quickfix mode ist tested, the rest " has been taken care of by other tests @@ -438,7 +438,7 @@ func! Test_edit_CR() call delete('Xqflist.txt') endfunc -func! Test_edit_CTRL_() +func Test_edit_CTRL_() " disabled for Windows builds, why? if !has("multi_byte") || !has("rightleft") || has("win32") return @@ -469,7 +469,7 @@ func! Test_edit_CTRL_() endfunc " needs to come first, to have the @. register empty -func! Test_edit_00a_CTRL_A() +func Test_edit_00a_CTRL_A() " Test pressing CTRL-A new call setline(1, repeat([''], 5)) @@ -489,7 +489,7 @@ func! Test_edit_00a_CTRL_A() bw! endfunc -func! Test_edit_CTRL_EY() +func Test_edit_CTRL_EY() " Ctrl-E/ Ctrl-Y in insert mode completion to scroll 10new call setline(1, range(1, 100)) @@ -505,7 +505,7 @@ func! Test_edit_CTRL_EY() bw! endfunc -func! Test_edit_CTRL_G() +func Test_edit_CTRL_G() new call setline(1, ['foobar', 'foobar', 'foobar']) call cursor(2, 4) @@ -523,7 +523,7 @@ func! Test_edit_CTRL_G() bw! endfunc -func! Test_edit_CTRL_I() +func Test_edit_CTRL_I() " Tab in completion mode let path=expand("%:p:h") new @@ -547,7 +547,7 @@ func! Test_edit_CTRL_I() bw! endfunc -func! Test_edit_CTRL_K() +func Test_edit_CTRL_K() " Test pressing CTRL-K (basically only dictionary completion and digraphs " the rest is already covered call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt') @@ -620,7 +620,7 @@ func! Test_edit_CTRL_K() bw! endfunc -func! Test_edit_CTRL_L() +func Test_edit_CTRL_L() " Test Ctrl-X Ctrl-L (line completion) new set complete=. @@ -676,7 +676,7 @@ func! Test_edit_CTRL_L() bw! endfunc -func! Test_edit_CTRL_N() +func Test_edit_CTRL_N() " Check keyword completion new set complete=. @@ -697,7 +697,7 @@ func! Test_edit_CTRL_N() bw! endfunc -func! Test_edit_CTRL_O() +func Test_edit_CTRL_O() " Check for CTRL-O in insert mode new inoreabbr <buffer> h here some more @@ -722,7 +722,7 @@ func! Test_edit_CTRL_O() bw! endfunc -func! Test_edit_CTRL_R() +func Test_edit_CTRL_R() " Insert Register new call test_override("ALL", 1) @@ -737,7 +737,7 @@ func! Test_edit_CTRL_R() bw! endfunc -func! Test_edit_CTRL_S() +func Test_edit_CTRL_S() " Test pressing CTRL-S (basically only spellfile completion) " the rest is already covered new @@ -781,7 +781,7 @@ func! Test_edit_CTRL_S() bw! endfunc -func! Test_edit_CTRL_T() +func Test_edit_CTRL_T() " Check for CTRL-T and CTRL-X CTRL-T in insert mode " 1) increase indent new @@ -858,7 +858,7 @@ func! Test_edit_CTRL_T() bw! endfunc -func! Test_edit_CTRL_U() +func Test_edit_CTRL_U() " Test 'completefunc' new " -1, -2 and -3 are special return values @@ -917,7 +917,7 @@ func! Test_edit_CTRL_U() bw! endfunc -func! Test_edit_CTRL_Z() +func Test_edit_CTRL_Z() " Ctrl-Z when insertmode is not set inserts it literally new call setline(1, 'abc') @@ -927,7 +927,7 @@ func! Test_edit_CTRL_Z() " TODO: How to Test Ctrl-Z in insert mode, e.g. suspend? endfunc -func! Test_edit_DROP() +func Test_edit_DROP() if !has("dnd") return endif @@ -943,7 +943,7 @@ func! Test_edit_DROP() bw! endfunc -func! Test_edit_CTRL_V() +func Test_edit_CTRL_V() if has("ebcdic") return endif @@ -971,7 +971,7 @@ func! Test_edit_CTRL_V() bw! endfunc -func! Test_edit_F1() +func Test_edit_F1() " Pressing <f1> new call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix') @@ -981,7 +981,7 @@ func! Test_edit_F1() bw endfunc -func! Test_edit_F21() +func Test_edit_F21() " Pressing <f21> " sends a netbeans command if has("netbeans_intg") @@ -992,7 +992,7 @@ func! Test_edit_F21() endif endfunc -func! Test_edit_HOME_END() +func Test_edit_HOME_END() " Test Home/End Keys new set foldopen+=hor @@ -1007,7 +1007,7 @@ func! Test_edit_HOME_END() bw! endfunc -func! Test_edit_INS() +func Test_edit_INS() " Test for Pressing <Insert> new call setline(1, ['abc', 'def']) @@ -1021,7 +1021,7 @@ func! Test_edit_INS() bw! endfunc -func! Test_edit_LEFT_RIGHT() +func Test_edit_LEFT_RIGHT() " Left, Shift-Left, Right, Shift-Right new call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX']) @@ -1068,7 +1068,7 @@ func! Test_edit_LEFT_RIGHT() bw! endfunc -func! Test_edit_MOUSE() +func Test_edit_MOUSE() " This is a simple test, since we not really using the mouse here if !has("mouse") return @@ -1123,7 +1123,7 @@ func! Test_edit_MOUSE() bw! endfunc -func! Test_edit_PAGEUP_PAGEDOWN() +func Test_edit_PAGEUP_PAGEDOWN() 10new call setline(1, repeat(['abc def ghi'], 30)) call cursor(1, 1) @@ -1222,7 +1222,7 @@ func! Test_edit_PAGEUP_PAGEDOWN() bw! endfunc -func! Test_edit_forbidden() +func Test_edit_forbidden() new " 1) edit in the sandbox is not allowed call setline(1, 'a') @@ -1282,7 +1282,7 @@ func! Test_edit_forbidden() bw! endfunc -func! Test_edit_rightleft() +func Test_edit_rightleft() " Cursor in rightleft mode moves differently if !exists("+rightleft") return diff --git a/src/testdir/test_eval_func.vim b/src/testdir/test_eval_func.vim index 4fcd0421ab..09d2f62d9c 100644 --- a/src/testdir/test_eval_func.vim +++ b/src/testdir/test_eval_func.vim @@ -1,6 +1,6 @@ " Vim script used in test_eval.in. Needed for script-local function. -func! s:Testje() +func s:Testje() return "foo" endfunc let Bar = function('s:Testje') diff --git a/src/testdir/test_fnameescape.vim b/src/testdir/test_fnameescape.vim index cdff0dfbd9..5382b89aa6 100644 --- a/src/testdir/test_fnameescape.vim +++ b/src/testdir/test_fnameescape.vim @@ -1,6 +1,6 @@ " Test if fnameescape is correct for special chars like ! -function! Test_fnameescape() +func Test_fnameescape() let fname = 'Xspa ce' let status = v:false try @@ -18,4 +18,4 @@ function! Test_fnameescape() endtry call assert_true(status, "ExclamationMark") call delete(fname) -endfunction +endfunc diff --git a/src/testdir/test_getcwd.vim b/src/testdir/test_getcwd.vim index 5d97295e9a..ca098781e4 100644 --- a/src/testdir/test_getcwd.vim +++ b/src/testdir/test_getcwd.vim @@ -1,112 +1,112 @@ -function! GetCwdInfo(win, tab) - let tab_changed = 0 - let mod = ":t" - if a:tab > 0 && a:tab != tabpagenr() - let tab_changed = 1 - exec "tabnext " . a:tab - endif - let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) - if tab_changed - tabprevious - endif - if a:win == 0 && a:tab == 0 - let dirname = fnamemodify(getcwd(), mod) - let lflag = haslocaldir() - elseif a:tab == 0 - let dirname = fnamemodify(getcwd(a:win), mod) - let lflag = haslocaldir(a:win) - else - let dirname = fnamemodify(getcwd(a:win, a:tab), mod) - let lflag = haslocaldir(a:win, a:tab) - endif - return bufname . ' ' . dirname . ' ' . lflag -endfunction +func GetCwdInfo(win, tab) + let tab_changed = 0 + let mod = ":t" + if a:tab > 0 && a:tab != tabpagenr() + let tab_changed = 1 + exec "tabnext " . a:tab + endif + let bufname = fnamemodify(bufname(winbufnr(a:win)), mod) + if tab_changed + tabprevious + endif + if a:win == 0 && a:tab == 0 + let dirname = fnamemodify(getcwd(), mod) + let lflag = haslocaldir() + elseif a:tab == 0 + let dirname = fnamemodify(getcwd(a:win), mod) + let lflag = haslocaldir(a:win) + else + let dirname = fnamemodify(getcwd(a:win, a:tab), mod) + let lflag = haslocaldir(a:win, a:tab) + endif + return bufname . ' ' . dirname . ' ' . lflag +endfunc " Do all test in a separate window to avoid E211 when we recursively " delete the Xtopdir directory during cleanup function SetUp() - set visualbell - set nocp viminfo+=nviminfo + set visualbell + set nocp viminfo+=nviminfo - " On windows a swapfile in Xtopdir prevents it from being cleaned up. - set noswapfile + " On windows a swapfile in Xtopdir prevents it from being cleaned up. + set noswapfile - " On windows a stale "Xtopdir" directory may exist, remove it so that - " we start from a clean state. - call delete("Xtopdir", "rf") - new - call mkdir('Xtopdir') - cd Xtopdir - let g:topdir = getcwd() - call mkdir('Xdir1') - call mkdir('Xdir2') - call mkdir('Xdir3') + " On windows a stale "Xtopdir" directory may exist, remove it so that + " we start from a clean state. + call delete("Xtopdir", "rf") + new + call mkdir('Xtopdir') + cd Xtopdir + let g:topdir = getcwd() + call mkdir('Xdir1') + call mkdir('Xdir2') + call mkdir('Xdir3') endfunction let g:cwd=getcwd() function TearDown() - q - exec "cd " . g:cwd - call delete("Xtopdir", "rf") + q + exec "cd " . g:cwd + call delete("Xtopdir", "rf") endfunction function Test_GetCwd() - new a - new b - new c - 3wincmd w - lcd Xdir1 - call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir3 - call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) - call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) - call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) - call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) - call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) - call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) - call assert_equal(g:topdir, getcwd(-1)) + new a + new b + new c + 3wincmd w + lcd Xdir1 + call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) + call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) + call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) + call assert_equal(g:topdir, getcwd(-1)) - tabnew x - new y - new z - 3wincmd w - call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir2 - call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) - call assert_equal(g:topdir, getcwd(-1)) - wincmd W - lcd Xdir3 - call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) - call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) - call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) - call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) - call assert_equal(g:topdir, getcwd(-1)) - let tp_nr = tabpagenr() - tabrewind - call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) - call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) - call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) - call assert_equal(g:topdir, getcwd(-1)) + tabnew x + new y + new z + 3wincmd w + call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir2 + call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) + wincmd W + lcd Xdir3 + call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) + call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) + call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) + call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) + call assert_equal(g:topdir, getcwd(-1)) + let tp_nr = tabpagenr() + tabrewind + call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) + call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) + call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) + call assert_equal(g:topdir, getcwd(-1)) endfunc function Test_GetCwd_lcd_shellslash() - new - let root = fnamemodify('/', ':p') - exe 'lcd '.root - let cwd = getcwd() - if !exists('+shellslash') || &shellslash - call assert_equal(cwd[-1:], '/') - else - call assert_equal(cwd[-1:], '\') - endif + new + let root = fnamemodify('/', ':p') + exe 'lcd '.root + let cwd = getcwd() + if !exists('+shellslash') || &shellslash + call assert_equal(cwd[-1:], '/') + else + call assert_equal(cwd[-1:], '\') + endif endfunc diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index 1e8efea1ad..67c7506133 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -38,15 +38,15 @@ func Test_highlight() call assert_fails("hi Crash term='asdf", "E475:") endfunc -function! HighlightArgs(name) +func HighlightArgs(name) return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '') -endfunction +endfunc -function! IsColorable() +func IsColorable() return has('gui_running') || str2nr(&t_Co) >= 8 -endfunction +endfunc -function! HiCursorLine() +func HiCursorLine() let hiCursorLine = HighlightArgs('CursorLine') if has('gui_running') let guibg = matchstr(hiCursorLine, 'guibg=\w\+') @@ -57,9 +57,9 @@ function! HiCursorLine() let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray' endif return [hiCursorLine, hi_ul, hi_bg] -endfunction +endfunc -function! Check_lcs_eol_attrs(attrs, row, col) +func Check_lcs_eol_attrs(attrs, row, col) let save_lcs = &lcs set list @@ -67,7 +67,7 @@ function! Check_lcs_eol_attrs(attrs, row, col) set nolist let &lcs = save_lcs -endfunction +endfunc func Test_highlight_eol_with_cursorline() let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() diff --git a/src/testdir/test_hlsearch.vim b/src/testdir/test_hlsearch.vim index 0b59440594..d4db4b76ef 100644 --- a/src/testdir/test_hlsearch.vim +++ b/src/testdir/test_hlsearch.vim @@ -1,6 +1,6 @@ " Test for v:hlsearch -function! Test_hlsearch() +func Test_hlsearch() new call setline(1, repeat(['aaa'], 10)) set hlsearch nolazyredraw @@ -30,7 +30,7 @@ function! Test_hlsearch() call garbagecollect(1) call getchar(1) enew! -endfunction +endfunc func Test_hlsearch_hangs() if !has('reltime') || !has('float') diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index f7e1590efc..e1c733f696 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -142,7 +142,7 @@ func Test_completefunc_args() delfunc CompleteFunc endfunc -function! s:CompleteDone_CompleteFuncDict( findstart, base ) +func s:CompleteDone_CompleteFuncDict( findstart, base ) if a:findstart return 0 endif @@ -159,9 +159,9 @@ function! s:CompleteDone_CompleteFuncDict( findstart, base ) \ } \ ] \ } -endfunction +endfunc -function! s:CompleteDone_CheckCompletedItemDict() +func s:CompleteDone_CheckCompletedItemDict() call assert_equal( 'aword', v:completed_item[ 'word' ] ) call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) @@ -170,7 +170,7 @@ function! s:CompleteDone_CheckCompletedItemDict() call assert_equal( 'test', v:completed_item[ 'user_data' ] ) let s:called_completedone = 1 -endfunction +endfunc function Test_CompleteDoneDict() au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict() @@ -186,7 +186,7 @@ function Test_CompleteDoneDict() au! CompleteDone endfunc -function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) +func s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) if a:findstart return 0 endif @@ -202,9 +202,9 @@ function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base ) \ } \ ] \ } -endfunction +endfunc -function! s:CompleteDone_CheckCompletedItemDictNoUserData() +func s:CompleteDone_CheckCompletedItemDictNoUserData() call assert_equal( 'aword', v:completed_item[ 'word' ] ) call assert_equal( 'wrd', v:completed_item[ 'abbr' ] ) call assert_equal( 'extra text', v:completed_item[ 'menu' ] ) @@ -213,7 +213,7 @@ function! s:CompleteDone_CheckCompletedItemDictNoUserData() call assert_equal( '', v:completed_item[ 'user_data' |