mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.1.0711: test files still use function!
Problem: Test files still use function!. Solution: Remove the exclamation mark. Fix overwriting a function.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
" Vim script language tests
|
" Vim script language tests
|
||||||
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
||||||
" Last Change: 2016 Feb 07
|
" Last Change: 2019 Jan 09
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
" Test environment {{{1
|
" Test environment {{{1
|
||||||
@@ -318,7 +318,7 @@ let ExtraVimCount = 0
|
|||||||
let ExtraVimBase = expand("<sfile>")
|
let ExtraVimBase = expand("<sfile>")
|
||||||
let ExtraVimTestEnv = ""
|
let ExtraVimTestEnv = ""
|
||||||
"
|
"
|
||||||
function! ExtraVim(...)
|
function ExtraVim(...)
|
||||||
" Count how often this function is called.
|
" Count how often this function is called.
|
||||||
let g:ExtraVimCount = g:ExtraVimCount + 1
|
let g:ExtraVimCount = g:ExtraVimCount + 1
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ endfunction
|
|||||||
" an ExtraVim script as passed by ExtraVim() in ExtraVimBegin.
|
" an ExtraVim script as passed by ExtraVim() in ExtraVimBegin.
|
||||||
"
|
"
|
||||||
" EXTRA_VIM_START - do not change or remove this line.
|
" EXTRA_VIM_START - do not change or remove this line.
|
||||||
function! ExtraVimThrowpoint()
|
function ExtraVimThrowpoint()
|
||||||
if !exists("g:ExtraVimBegin")
|
if !exists("g:ExtraVimBegin")
|
||||||
Xout "ExtraVimThrowpoint() used outside ExtraVim() script."
|
Xout "ExtraVimThrowpoint() used outside ExtraVim() script."
|
||||||
return v:throwpoint
|
return v:throwpoint
|
||||||
@@ -530,7 +530,7 @@ endfunction
|
|||||||
" as a script file, use ExecAsScript below.
|
" as a script file, use ExecAsScript below.
|
||||||
"
|
"
|
||||||
" EXTRA_VIM_START - do not change or remove this line.
|
" EXTRA_VIM_START - do not change or remove this line.
|
||||||
function! MakeScript(funcname, ...)
|
function MakeScript(funcname, ...)
|
||||||
let script = tempname()
|
let script = tempname()
|
||||||
execute "redir! >" . script
|
execute "redir! >" . script
|
||||||
execute "function" a:funcname
|
execute "function" a:funcname
|
||||||
@@ -568,7 +568,7 @@ endfunction
|
|||||||
" location specified in the function.
|
" location specified in the function.
|
||||||
"
|
"
|
||||||
" EXTRA_VIM_START - do not change or remove this line.
|
" 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.
|
" Make a script from the function passed as argument.
|
||||||
let script = MakeScript(a:funcname)
|
let script = MakeScript(a:funcname)
|
||||||
|
|
||||||
@@ -8548,7 +8548,7 @@ endfunction
|
|||||||
|
|
||||||
" Remove the autocommands for the events specified as arguments in all used
|
" Remove the autocommands for the events specified as arguments in all used
|
||||||
" autogroups.
|
" autogroups.
|
||||||
function! Delete_autocommands(...)
|
function Delete_autocommands(...)
|
||||||
let augfile = tempname()
|
let augfile = tempname()
|
||||||
while 1
|
while 1
|
||||||
try
|
try
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
|
|
||||||
func! s:cleanup_buffers() abort
|
func s:cleanup_buffers() abort
|
||||||
for bnr in range(1, bufnr('$'))
|
for bnr in range(1, bufnr('$'))
|
||||||
if bufloaded(bnr) && bufnr('%') != bnr
|
if bufloaded(bnr) && bufnr('%') != bnr
|
||||||
execute 'bd! ' . bnr
|
execute 'bd! ' . bnr
|
||||||
@@ -1343,7 +1343,7 @@ func Test_ChangedP()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
let g:setline_handled = v:false
|
let g:setline_handled = v:false
|
||||||
func! SetLineOne()
|
func SetLineOne()
|
||||||
if !g:setline_handled
|
if !g:setline_handled
|
||||||
call setline(1, "(x)")
|
call setline(1, "(x)")
|
||||||
let g:setline_handled = v:true
|
let g:setline_handled = v:true
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
function! Test_charsearch()
|
func Test_charsearch()
|
||||||
enew!
|
enew!
|
||||||
call append(0, ['Xabcdefghijkemnopqretuvwxyz',
|
call append(0, ['Xabcdefghijkemnopqretuvwxyz',
|
||||||
\ 'Yabcdefghijkemnopqretuvwxyz',
|
\ 'Yabcdefghijkemnopqretuvwxyz',
|
||||||
@@ -29,10 +29,10 @@ function! Test_charsearch()
|
|||||||
normal! ;;p
|
normal! ;;p
|
||||||
call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3))
|
call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3))
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" Test for t,f,F,T movement commands and 'cpo-;' setting
|
" Test for t,f,F,T movement commands and 'cpo-;' setting
|
||||||
function! Test_search_cmds()
|
func Test_search_cmds()
|
||||||
enew!
|
enew!
|
||||||
call append(0, ["aaa two three four", " zzz", "yyy ",
|
call append(0, ["aaa two three four", " zzz", "yyy ",
|
||||||
\ "bbb yee yoo four", "ccc two three four",
|
\ "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('ccc', getline(5))
|
||||||
call assert_equal('ddd yee y', getline(6))
|
call assert_equal('ddd yee y', getline(6))
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
@@ -4,7 +4,7 @@ if !has('multi_byte')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Test for t,f,F,T movement commands
|
" Test for t,f,F,T movement commands
|
||||||
function! Test_search_cmds()
|
func Test_search_cmds()
|
||||||
new!
|
new!
|
||||||
call setline(1, "・最初から最後まで最強のVimは最高")
|
call setline(1, "・最初から最後まで最強のVimは最高")
|
||||||
1
|
1
|
||||||
@@ -17,6 +17,6 @@ function! Test_search_cmds()
|
|||||||
normal! ,
|
normal! ,
|
||||||
call assert_equal([0, 1, 28, 0], getpos('.'))
|
call assert_equal([0, 1, 28, 0], getpos('.'))
|
||||||
bw!
|
bw!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -5,7 +5,7 @@ endif
|
|||||||
|
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
|
||||||
func! Test_display_foldcolumn()
|
func Test_display_foldcolumn()
|
||||||
if !has("folding")
|
if !has("folding")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -38,7 +38,7 @@ func! Test_display_foldcolumn()
|
|||||||
quit!
|
quit!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_display_foldtext_mbyte()
|
func Test_display_foldtext_mbyte()
|
||||||
if !has("folding") || !has("multi_byte")
|
if !has("folding") || !has("multi_byte")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@@ -9,7 +9,7 @@ source view_util.vim
|
|||||||
|
|
||||||
" Needs to come first until the bug in getchar() is
|
" Needs to come first until the bug in getchar() is
|
||||||
" fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
|
" fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
|
||||||
func! Test_edit_00b()
|
func Test_edit_00b()
|
||||||
new
|
new
|
||||||
call setline(1, ['abc '])
|
call setline(1, ['abc '])
|
||||||
inoreabbr <buffer> h here some more
|
inoreabbr <buffer> h here some more
|
||||||
@@ -21,7 +21,7 @@ func! Test_edit_00b()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_01()
|
func Test_edit_01()
|
||||||
" set for Travis CI?
|
" set for Travis CI?
|
||||||
" set nocp noesckeys
|
" set nocp noesckeys
|
||||||
new
|
new
|
||||||
@@ -61,7 +61,7 @@ func! Test_edit_01()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_02()
|
func Test_edit_02()
|
||||||
" Change cursor position in InsertCharPre command
|
" Change cursor position in InsertCharPre command
|
||||||
new
|
new
|
||||||
call setline(1, 'abc')
|
call setline(1, 'abc')
|
||||||
@@ -101,7 +101,7 @@ func! Test_edit_02()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_03()
|
func Test_edit_03()
|
||||||
" Change cursor after <c-o> command to end of line
|
" Change cursor after <c-o> command to end of line
|
||||||
new
|
new
|
||||||
call setline(1, 'abc')
|
call setline(1, 'abc')
|
||||||
@@ -120,7 +120,7 @@ func! Test_edit_03()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_04()
|
func Test_edit_04()
|
||||||
" test for :stopinsert
|
" test for :stopinsert
|
||||||
new
|
new
|
||||||
call setline(1, 'abc')
|
call setline(1, 'abc')
|
||||||
@@ -132,7 +132,7 @@ func! Test_edit_04()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_05()
|
func Test_edit_05()
|
||||||
" test for folds being opened
|
" test for folds being opened
|
||||||
new
|
new
|
||||||
call setline(1, ['abcX', 'abcX', 'zzzZ'])
|
call setline(1, ['abcX', 'abcX', 'zzzZ'])
|
||||||
@@ -154,7 +154,7 @@ func! Test_edit_05()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_06()
|
func Test_edit_06()
|
||||||
" Test in diff mode
|
" Test in diff mode
|
||||||
if !has("diff") || !executable("diff")
|
if !has("diff") || !executable("diff")
|
||||||
return
|
return
|
||||||
@@ -176,7 +176,7 @@ func! Test_edit_06()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_07()
|
func Test_edit_07()
|
||||||
" 1) Test with completion <c-l> when popupmenu is visible
|
" 1) Test with completion <c-l> when popupmenu is visible
|
||||||
new
|
new
|
||||||
call setline(1, 'J')
|
call setline(1, 'J')
|
||||||
@@ -213,7 +213,7 @@ func! Test_edit_07()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_08()
|
func Test_edit_08()
|
||||||
" reset insertmode from i_ctrl-r_=
|
" reset insertmode from i_ctrl-r_=
|
||||||
let g:bufnr = bufnr('%')
|
let g:bufnr = bufnr('%')
|
||||||
new
|
new
|
||||||
@@ -227,7 +227,7 @@ func! Test_edit_08()
|
|||||||
unlet g:bufnr
|
unlet g:bufnr
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_09()
|
func Test_edit_09()
|
||||||
" test i_CTRL-\ combinations
|
" test i_CTRL-\ combinations
|
||||||
new
|
new
|
||||||
call setline(1, ['abc', 'def', 'ghi'])
|
call setline(1, ['abc', 'def', 'ghi'])
|
||||||
@@ -257,7 +257,7 @@ func! Test_edit_09()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_10()
|
func Test_edit_10()
|
||||||
" Test for starting selectmode
|
" Test for starting selectmode
|
||||||
new
|
new
|
||||||
set selectmode=key keymodel=startsel
|
set selectmode=key keymodel=startsel
|
||||||
@@ -269,7 +269,7 @@ func! Test_edit_10()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_11()
|
func Test_edit_11()
|
||||||
" Test that indenting kicks in
|
" Test that indenting kicks in
|
||||||
new
|
new
|
||||||
set cindent
|
set cindent
|
||||||
@@ -313,7 +313,7 @@ func! Test_edit_11()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_11_indentexpr()
|
func Test_edit_11_indentexpr()
|
||||||
" Test that indenting kicks in
|
" Test that indenting kicks in
|
||||||
new
|
new
|
||||||
" Use indentexpr instead of cindenting
|
" Use indentexpr instead of cindenting
|
||||||
@@ -340,7 +340,7 @@ func! Test_edit_11_indentexpr()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_12()
|
func Test_edit_12()
|
||||||
" Test changing indent in replace mode
|
" Test changing indent in replace mode
|
||||||
new
|
new
|
||||||
call setline(1, ["\tabc", "\tdef"])
|
call setline(1, ["\tabc", "\tdef"])
|
||||||
@@ -392,7 +392,7 @@ func! Test_edit_12()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_13()
|
func Test_edit_13()
|
||||||
" Test smartindenting
|
" Test smartindenting
|
||||||
if exists("+smartindent")
|
if exists("+smartindent")
|
||||||
new
|
new
|
||||||
@@ -405,7 +405,7 @@ func! Test_edit_13()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CR()
|
func Test_edit_CR()
|
||||||
" Test for <CR> in insert mode
|
" Test for <CR> in insert mode
|
||||||
" basically only in quickfix mode ist tested, the rest
|
" basically only in quickfix mode ist tested, the rest
|
||||||
" has been taken care of by other tests
|
" has been taken care of by other tests
|
||||||
@@ -438,7 +438,7 @@ func! Test_edit_CR()
|
|||||||
call delete('Xqflist.txt')
|
call delete('Xqflist.txt')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_()
|
func Test_edit_CTRL_()
|
||||||
" disabled for Windows builds, why?
|
" disabled for Windows builds, why?
|
||||||
if !has("multi_byte") || !has("rightleft") || has("win32")
|
if !has("multi_byte") || !has("rightleft") || has("win32")
|
||||||
return
|
return
|
||||||
@@ -469,7 +469,7 @@ func! Test_edit_CTRL_()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" needs to come first, to have the @. register empty
|
" 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
|
" Test pressing CTRL-A
|
||||||
new
|
new
|
||||||
call setline(1, repeat([''], 5))
|
call setline(1, repeat([''], 5))
|
||||||
@@ -489,7 +489,7 @@ func! Test_edit_00a_CTRL_A()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_EY()
|
func Test_edit_CTRL_EY()
|
||||||
" Ctrl-E/ Ctrl-Y in insert mode completion to scroll
|
" Ctrl-E/ Ctrl-Y in insert mode completion to scroll
|
||||||
10new
|
10new
|
||||||
call setline(1, range(1, 100))
|
call setline(1, range(1, 100))
|
||||||
@@ -505,7 +505,7 @@ func! Test_edit_CTRL_EY()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_G()
|
func Test_edit_CTRL_G()
|
||||||
new
|
new
|
||||||
call setline(1, ['foobar', 'foobar', 'foobar'])
|
call setline(1, ['foobar', 'foobar', 'foobar'])
|
||||||
call cursor(2, 4)
|
call cursor(2, 4)
|
||||||
@@ -523,7 +523,7 @@ func! Test_edit_CTRL_G()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_I()
|
func Test_edit_CTRL_I()
|
||||||
" Tab in completion mode
|
" Tab in completion mode
|
||||||
let path=expand("%:p:h")
|
let path=expand("%:p:h")
|
||||||
new
|
new
|
||||||
@@ -547,7 +547,7 @@ func! Test_edit_CTRL_I()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_K()
|
func Test_edit_CTRL_K()
|
||||||
" Test pressing CTRL-K (basically only dictionary completion and digraphs
|
" Test pressing CTRL-K (basically only dictionary completion and digraphs
|
||||||
" the rest is already covered
|
" the rest is already covered
|
||||||
call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt')
|
call writefile(['A', 'AA', 'AAA', 'AAAA'], 'Xdictionary.txt')
|
||||||
@@ -620,7 +620,7 @@ func! Test_edit_CTRL_K()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_L()
|
func Test_edit_CTRL_L()
|
||||||
" Test Ctrl-X Ctrl-L (line completion)
|
" Test Ctrl-X Ctrl-L (line completion)
|
||||||
new
|
new
|
||||||
set complete=.
|
set complete=.
|
||||||
@@ -676,7 +676,7 @@ func! Test_edit_CTRL_L()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_N()
|
func Test_edit_CTRL_N()
|
||||||
" Check keyword completion
|
" Check keyword completion
|
||||||
new
|
new
|
||||||
set complete=.
|
set complete=.
|
||||||
@@ -697,7 +697,7 @@ func! Test_edit_CTRL_N()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_O()
|
func Test_edit_CTRL_O()
|
||||||
" Check for CTRL-O in insert mode
|
" Check for CTRL-O in insert mode
|
||||||
new
|
new
|
||||||
inoreabbr <buffer> h here some more
|
inoreabbr <buffer> h here some more
|
||||||
@@ -722,7 +722,7 @@ func! Test_edit_CTRL_O()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_R()
|
func Test_edit_CTRL_R()
|
||||||
" Insert Register
|
" Insert Register
|
||||||
new
|
new
|
||||||
call test_override("ALL", 1)
|
call test_override("ALL", 1)
|
||||||
@@ -737,7 +737,7 @@ func! Test_edit_CTRL_R()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_S()
|
func Test_edit_CTRL_S()
|
||||||
" Test pressing CTRL-S (basically only spellfile completion)
|
" Test pressing CTRL-S (basically only spellfile completion)
|
||||||
" the rest is already covered
|
" the rest is already covered
|
||||||
new
|
new
|
||||||
@@ -781,7 +781,7 @@ func! Test_edit_CTRL_S()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_T()
|
func Test_edit_CTRL_T()
|
||||||
" Check for CTRL-T and CTRL-X CTRL-T in insert mode
|
" Check for CTRL-T and CTRL-X CTRL-T in insert mode
|
||||||
" 1) increase indent
|
" 1) increase indent
|
||||||
new
|
new
|
||||||
@@ -858,7 +858,7 @@ func! Test_edit_CTRL_T()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_U()
|
func Test_edit_CTRL_U()
|
||||||
" Test 'completefunc'
|
" Test 'completefunc'
|
||||||
new
|
new
|
||||||
" -1, -2 and -3 are special return values
|
" -1, -2 and -3 are special return values
|
||||||
@@ -917,7 +917,7 @@ func! Test_edit_CTRL_U()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_Z()
|
func Test_edit_CTRL_Z()
|
||||||
" Ctrl-Z when insertmode is not set inserts it literally
|
" Ctrl-Z when insertmode is not set inserts it literally
|
||||||
new
|
new
|
||||||
call setline(1, 'abc')
|
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?
|
" TODO: How to Test Ctrl-Z in insert mode, e.g. suspend?
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_DROP()
|
func Test_edit_DROP()
|
||||||
if !has("dnd")
|
if !has("dnd")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -943,7 +943,7 @@ func! Test_edit_DROP()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_CTRL_V()
|
func Test_edit_CTRL_V()
|
||||||
if has("ebcdic")
|
if has("ebcdic")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -971,7 +971,7 @@ func! Test_edit_CTRL_V()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_F1()
|
func Test_edit_F1()
|
||||||
" Pressing <f1>
|
" Pressing <f1>
|
||||||
new
|
new
|
||||||
call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
|
call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
|
||||||
@@ -981,7 +981,7 @@ func! Test_edit_F1()
|
|||||||
bw
|
bw
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_F21()
|
func Test_edit_F21()
|
||||||
" Pressing <f21>
|
" Pressing <f21>
|
||||||
" sends a netbeans command
|
" sends a netbeans command
|
||||||
if has("netbeans_intg")
|
if has("netbeans_intg")
|
||||||
@@ -992,7 +992,7 @@ func! Test_edit_F21()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_HOME_END()
|
func Test_edit_HOME_END()
|
||||||
" Test Home/End Keys
|
" Test Home/End Keys
|
||||||
new
|
new
|
||||||
set foldopen+=hor
|
set foldopen+=hor
|
||||||
@@ -1007,7 +1007,7 @@ func! Test_edit_HOME_END()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_INS()
|
func Test_edit_INS()
|
||||||
" Test for Pressing <Insert>
|
" Test for Pressing <Insert>
|
||||||
new
|
new
|
||||||
call setline(1, ['abc', 'def'])
|
call setline(1, ['abc', 'def'])
|
||||||
@@ -1021,7 +1021,7 @@ func! Test_edit_INS()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_LEFT_RIGHT()
|
func Test_edit_LEFT_RIGHT()
|
||||||
" Left, Shift-Left, Right, Shift-Right
|
" Left, Shift-Left, Right, Shift-Right
|
||||||
new
|
new
|
||||||
call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX'])
|
call setline(1, ['abc def ghi', 'ABC DEF GHI', 'ZZZ YYY XXX'])
|
||||||
@@ -1068,7 +1068,7 @@ func! Test_edit_LEFT_RIGHT()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_MOUSE()
|
func Test_edit_MOUSE()
|
||||||
" This is a simple test, since we not really using the mouse here
|
" This is a simple test, since we not really using the mouse here
|
||||||
if !has("mouse")
|
if !has("mouse")
|
||||||
return
|
return
|
||||||
@@ -1123,7 +1123,7 @@ func! Test_edit_MOUSE()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_PAGEUP_PAGEDOWN()
|
func Test_edit_PAGEUP_PAGEDOWN()
|
||||||
10new
|
10new
|
||||||
call setline(1, repeat(['abc def ghi'], 30))
|
call setline(1, repeat(['abc def ghi'], 30))
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
@@ -1222,7 +1222,7 @@ func! Test_edit_PAGEUP_PAGEDOWN()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_forbidden()
|
func Test_edit_forbidden()
|
||||||
new
|
new
|
||||||
" 1) edit in the sandbox is not allowed
|
" 1) edit in the sandbox is not allowed
|
||||||
call setline(1, 'a')
|
call setline(1, 'a')
|
||||||
@@ -1282,7 +1282,7 @@ func! Test_edit_forbidden()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_edit_rightleft()
|
func Test_edit_rightleft()
|
||||||
" Cursor in rightleft mode moves differently
|
" Cursor in rightleft mode moves differently
|
||||||
if !exists("+rightleft")
|
if !exists("+rightleft")
|
||||||
return
|
return
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Vim script used in test_eval.in. Needed for script-local function.
|
" Vim script used in test_eval.in. Needed for script-local function.
|
||||||
|
|
||||||
func! s:Testje()
|
func s:Testje()
|
||||||
return "foo"
|
return "foo"
|
||||||
endfunc
|
endfunc
|
||||||
let Bar = function('s:Testje')
|
let Bar = function('s:Testje')
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
" Test if fnameescape is correct for special chars like !
|
" Test if fnameescape is correct for special chars like !
|
||||||
function! Test_fnameescape()
|
func Test_fnameescape()
|
||||||
let fname = 'Xspa ce'
|
let fname = 'Xspa ce'
|
||||||
let status = v:false
|
let status = v:false
|
||||||
try
|
try
|
||||||
@@ -18,4 +18,4 @@ function! Test_fnameescape()
|
|||||||
endtry
|
endtry
|
||||||
call assert_true(status, "ExclamationMark")
|
call assert_true(status, "ExclamationMark")
|
||||||
call delete(fname)
|
call delete(fname)
|
||||||
endfunction
|
endfunc
|
||||||
|
@@ -1,112 +1,112 @@
|
|||||||
function! GetCwdInfo(win, tab)
|
func GetCwdInfo(win, tab)
|
||||||
let tab_changed = 0
|
let tab_changed = 0
|
||||||
let mod = ":t"
|
let mod = ":t"
|
||||||
if a:tab > 0 && a:tab != tabpagenr()
|
if a:tab > 0 && a:tab != tabpagenr()
|
||||||
let tab_changed = 1
|
let tab_changed = 1
|
||||||
exec "tabnext " . a:tab
|
exec "tabnext " . a:tab
|
||||||
endif
|
endif
|
||||||
let bufname = fnamemodify(bufname(winbufnr(a:win)), mod)
|
let bufname = fnamemodify(bufname(winbufnr(a:win)), mod)
|
||||||
if tab_changed
|
if tab_changed
|
||||||
tabprevious
|
tabprevious
|
||||||
endif
|
endif
|
||||||
if a:win == 0 && a:tab == 0
|
if a:win == 0 && a:tab == 0
|
||||||
let dirname = fnamemodify(getcwd(), mod)
|
let dirname = fnamemodify(getcwd(), mod)
|
||||||
let lflag = haslocaldir()
|
let lflag = haslocaldir()
|
||||||
elseif a:tab == 0
|
elseif a:tab == 0
|
||||||
let dirname = fnamemodify(getcwd(a:win), mod)
|
let dirname = fnamemodify(getcwd(a:win), mod)
|
||||||
let lflag = haslocaldir(a:win)
|
let lflag = haslocaldir(a:win)
|
||||||
else
|
else
|
||||||
let dirname = fnamemodify(getcwd(a:win, a:tab), mod)
|
let dirname = fnamemodify(getcwd(a:win, a:tab), mod)
|
||||||
let lflag = haslocaldir(a:win, a:tab)
|
let lflag = haslocaldir(a:win, a:tab)
|
||||||
endif
|
endif
|
||||||
return bufname . ' ' . dirname . ' ' . lflag
|
return bufname . ' ' . dirname . ' ' . lflag
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" Do all test in a separate window to avoid E211 when we recursively
|
" Do all test in a separate window to avoid E211 when we recursively
|
||||||
" delete the Xtopdir directory during cleanup
|
" delete the Xtopdir directory during cleanup
|
||||||
function SetUp()
|
function SetUp()
|
||||||
set visualbell
|
set visualbell
|
||||||
set nocp viminfo+=nviminfo
|
set nocp viminfo+=nviminfo
|
||||||
|
|
||||||
" On windows a swapfile in Xtopdir prevents it from being cleaned up.
|
" On windows a swapfile in Xtopdir prevents it from being cleaned up.
|
||||||
set noswapfile
|
set noswapfile
|
||||||
|
|
||||||
" On windows a stale "Xtopdir" directory may exist, remove it so that
|
" On windows a stale "Xtopdir" directory may exist, remove it so that
|
||||||
" we start from a clean state.
|
" we start from a clean state.
|
||||||
call delete("Xtopdir", "rf")
|
call delete("Xtopdir", "rf")
|
||||||
new
|
new
|
||||||
call mkdir('Xtopdir')
|
call mkdir('Xtopdir')
|
||||||
cd Xtopdir
|
cd Xtopdir
|
||||||
let g:topdir = getcwd()
|
let g:topdir = getcwd()
|
||||||
call mkdir('Xdir1')
|
call mkdir('Xdir1')
|
||||||
call mkdir('Xdir2')
|
call mkdir('Xdir2')
|
||||||
call mkdir('Xdir3')
|
call mkdir('Xdir3')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:cwd=getcwd()
|
let g:cwd=getcwd()
|
||||||
function TearDown()
|
function TearDown()
|
||||||
q
|
q
|
||||||
exec "cd " . g:cwd
|
exec "cd " . g:cwd
|
||||||
call delete("Xtopdir", "rf")
|
call delete("Xtopdir", "rf")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Test_GetCwd()
|
function Test_GetCwd()
|
||||||
new a
|
new a
|
||||||
new b
|
new b
|
||||||
new c
|
new c
|
||||||
3wincmd w
|
3wincmd w
|
||||||
lcd Xdir1
|
lcd Xdir1
|
||||||
call assert_equal("a Xdir1 1", GetCwdInfo(0, 0))
|
call assert_equal("a Xdir1 1", GetCwdInfo(0, 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
wincmd W
|
wincmd W
|
||||||
call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0))
|
call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
wincmd W
|
wincmd W
|
||||||
lcd Xdir3
|
lcd Xdir3
|
||||||
call assert_equal("c Xdir3 1", GetCwdInfo(0, 0))
|
call assert_equal("c Xdir3 1", GetCwdInfo(0, 0))
|
||||||
call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0))
|
call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0))
|
||||||
call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0))
|
call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0))
|
||||||
call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0))
|
call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
wincmd W
|
wincmd W
|
||||||
call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr()))
|
call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr()))
|
||||||
call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr()))
|
call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr()))
|
||||||
call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr()))
|
call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr()))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
|
|
||||||
tabnew x
|
tabnew x
|
||||||
new y
|
new y
|
||||||
new z
|
new z
|
||||||
3wincmd w
|
3wincmd w
|
||||||
call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0))
|
call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
wincmd W
|
wincmd W
|
||||||
lcd Xdir2
|
lcd Xdir2
|
||||||
call assert_equal("y Xdir2 1", GetCwdInfo(0, 0))
|
call assert_equal("y Xdir2 1", GetCwdInfo(0, 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
wincmd W
|
wincmd W
|
||||||
lcd Xdir3
|
lcd Xdir3
|
||||||
call assert_equal("z Xdir3 1", GetCwdInfo(0, 0))
|
call assert_equal("z Xdir3 1", GetCwdInfo(0, 0))
|
||||||
call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0))
|
call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0))
|
||||||
call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0))
|
call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0))
|
||||||
call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0))
|
call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
let tp_nr = tabpagenr()
|
let tp_nr = tabpagenr()
|
||||||
tabrewind
|
tabrewind
|
||||||
call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr))
|
call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr))
|
||||||
call assert_equal("y Xdir2 1", GetCwdInfo(2, 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("z Xdir3 1", GetCwdInfo(1, tp_nr))
|
||||||
call assert_equal(g:topdir, getcwd(-1))
|
call assert_equal(g:topdir, getcwd(-1))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function Test_GetCwd_lcd_shellslash()
|
function Test_GetCwd_lcd_shellslash()
|
||||||
new
|
new
|
||||||
let root = fnamemodify('/', ':p')
|
let root = fnamemodify('/', ':p')
|
||||||
exe 'lcd '.root
|
exe 'lcd '.root
|
||||||
let cwd = getcwd()
|
let cwd = getcwd()
|
||||||
if !exists('+shellslash') || &shellslash
|
if !exists('+shellslash') || &shellslash
|
||||||
call assert_equal(cwd[-1:], '/')
|
call assert_equal(cwd[-1:], '/')
|
||||||
else
|
else
|
||||||
call assert_equal(cwd[-1:], '\')
|
call assert_equal(cwd[-1:], '\')
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -38,15 +38,15 @@ func Test_highlight()
|
|||||||
call assert_fails("hi Crash term='asdf", "E475:")
|
call assert_fails("hi Crash term='asdf", "E475:")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! HighlightArgs(name)
|
func HighlightArgs(name)
|
||||||
return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '')
|
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
|
return has('gui_running') || str2nr(&t_Co) >= 8
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! HiCursorLine()
|
func HiCursorLine()
|
||||||
let hiCursorLine = HighlightArgs('CursorLine')
|
let hiCursorLine = HighlightArgs('CursorLine')
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
let guibg = matchstr(hiCursorLine, 'guibg=\w\+')
|
let guibg = matchstr(hiCursorLine, 'guibg=\w\+')
|
||||||
@@ -57,9 +57,9 @@ function! HiCursorLine()
|
|||||||
let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray'
|
let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray'
|
||||||
endif
|
endif
|
||||||
return [hiCursorLine, hi_ul, hi_bg]
|
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
|
let save_lcs = &lcs
|
||||||
set list
|
set list
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ function! Check_lcs_eol_attrs(attrs, row, col)
|
|||||||
|
|
||||||
set nolist
|
set nolist
|
||||||
let &lcs = save_lcs
|
let &lcs = save_lcs
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_highlight_eol_with_cursorline()
|
func Test_highlight_eol_with_cursorline()
|
||||||
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
|
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Test for v:hlsearch
|
" Test for v:hlsearch
|
||||||
|
|
||||||
function! Test_hlsearch()
|
func Test_hlsearch()
|
||||||
new
|
new
|
||||||
call setline(1, repeat(['aaa'], 10))
|
call setline(1, repeat(['aaa'], 10))
|
||||||
set hlsearch nolazyredraw
|
set hlsearch nolazyredraw
|
||||||
@@ -30,7 +30,7 @@ function! Test_hlsearch()
|
|||||||
call garbagecollect(1)
|
call garbagecollect(1)
|
||||||
call getchar(1)
|
call getchar(1)
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_hlsearch_hangs()
|
func Test_hlsearch_hangs()
|
||||||
if !has('reltime') || !has('float')
|
if !has('reltime') || !has('float')
|
||||||
|
@@ -142,7 +142,7 @@ func Test_completefunc_args()
|
|||||||
delfunc CompleteFunc
|
delfunc CompleteFunc
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:CompleteDone_CompleteFuncDict( findstart, base )
|
func s:CompleteDone_CompleteFuncDict( findstart, base )
|
||||||
if a:findstart
|
if a:findstart
|
||||||
return 0
|
return 0
|
||||||
endif
|
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( 'aword', v:completed_item[ 'word' ] )
|
||||||
call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
|
call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
|
||||||
call assert_equal( 'extra text', v:completed_item[ 'menu' ] )
|
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' ] )
|
call assert_equal( 'test', v:completed_item[ 'user_data' ] )
|
||||||
|
|
||||||
let s:called_completedone = 1
|
let s:called_completedone = 1
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_CompleteDoneDict()
|
function Test_CompleteDoneDict()
|
||||||
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict()
|
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDict()
|
||||||
@@ -186,7 +186,7 @@ function Test_CompleteDoneDict()
|
|||||||
au! CompleteDone
|
au! CompleteDone
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:CompleteDone_CompleteFuncDictNoUserData( findstart, base )
|
func s:CompleteDone_CompleteFuncDictNoUserData( findstart, base )
|
||||||
if a:findstart
|
if a:findstart
|
||||||
return 0
|
return 0
|
||||||
endif
|
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( 'aword', v:completed_item[ 'word' ] )
|
||||||
call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
|
call assert_equal( 'wrd', v:completed_item[ 'abbr' ] )
|
||||||
call assert_equal( 'extra text', v:completed_item[ 'menu' ] )
|
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' ] )
|
call assert_equal( '', v:completed_item[ 'user_data' ] )
|
||||||
|
|
||||||
let s:called_completedone = 1
|
let s:called_completedone = 1
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_CompleteDoneDictNoUserData()
|
function Test_CompleteDoneDictNoUserData()
|
||||||
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDictNoUserData()
|
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemDictNoUserData()
|
||||||
@@ -229,15 +229,15 @@ function Test_CompleteDoneDictNoUserData()
|
|||||||
au! CompleteDone
|
au! CompleteDone
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:CompleteDone_CompleteFuncList( findstart, base )
|
func s:CompleteDone_CompleteFuncList( findstart, base )
|
||||||
if a:findstart
|
if a:findstart
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return [ 'aword' ]
|
return [ 'aword' ]
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:CompleteDone_CheckCompletedItemList()
|
func s:CompleteDone_CheckCompletedItemList()
|
||||||
call assert_equal( 'aword', v:completed_item[ 'word' ] )
|
call assert_equal( 'aword', v:completed_item[ 'word' ] )
|
||||||
call assert_equal( '', v:completed_item[ 'abbr' ] )
|
call assert_equal( '', v:completed_item[ 'abbr' ] )
|
||||||
call assert_equal( '', v:completed_item[ 'menu' ] )
|
call assert_equal( '', v:completed_item[ 'menu' ] )
|
||||||
@@ -246,7 +246,7 @@ function! s:CompleteDone_CheckCompletedItemList()
|
|||||||
call assert_equal( '', v:completed_item[ 'user_data' ] )
|
call assert_equal( '', v:completed_item[ 'user_data' ] )
|
||||||
|
|
||||||
let s:called_completedone = 1
|
let s:called_completedone = 1
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_CompleteDoneList()
|
function Test_CompleteDoneList()
|
||||||
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemList()
|
au CompleteDone * :call <SID>CompleteDone_CheckCompletedItemList()
|
||||||
|
@@ -1,34 +1,34 @@
|
|||||||
" Test for lambda and closure
|
" Test for lambda and closure
|
||||||
|
|
||||||
function! Test_lambda_feature()
|
func Test_lambda_feature()
|
||||||
call assert_equal(1, has('lambda'))
|
call assert_equal(1, has('lambda'))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_filter()
|
func Test_lambda_with_filter()
|
||||||
let s:x = 2
|
let s:x = 2
|
||||||
call assert_equal([2, 3], filter([1, 2, 3], {i, v -> v >= s:x}))
|
call assert_equal([2, 3], filter([1, 2, 3], {i, v -> v >= s:x}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_map()
|
func Test_lambda_with_map()
|
||||||
let s:x = 1
|
let s:x = 1
|
||||||
call assert_equal([2, 3, 4], map([1, 2, 3], {i, v -> v + s:x}))
|
call assert_equal([2, 3, 4], map([1, 2, 3], {i, v -> v + s:x}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_sort()
|
func Test_lambda_with_sort()
|
||||||
call assert_equal([1, 2, 3, 4, 7], sort([3,7,2,1,4], {a, b -> a - b}))
|
call assert_equal([1, 2, 3, 4, 7], sort([3,7,2,1,4], {a, b -> a - b}))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_timer()
|
func Test_lambda_with_timer()
|
||||||
if !has('timers')
|
if !has('timers')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:n = 0
|
let s:n = 0
|
||||||
let s:timer_id = 0
|
let s:timer_id = 0
|
||||||
function! s:Foo()
|
func! s:Foo()
|
||||||
"let n = 0
|
"let n = 0
|
||||||
let s:timer_id = timer_start(50, {-> execute("let s:n += 1 | echo s:n", "")}, {"repeat": -1})
|
let s:timer_id = timer_start(50, {-> execute("let s:n += 1 | echo s:n", "")}, {"repeat": -1})
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call s:Foo()
|
call s:Foo()
|
||||||
sleep 200ms
|
sleep 200ms
|
||||||
@@ -40,12 +40,12 @@ function! Test_lambda_with_timer()
|
|||||||
call assert_true(m > 1)
|
call assert_true(m > 1)
|
||||||
call assert_true(s:n > m + 1)
|
call assert_true(s:n > m + 1)
|
||||||
call assert_true(s:n < 9)
|
call assert_true(s:n < 9)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_partial()
|
func Test_lambda_with_partial()
|
||||||
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
|
let l:Cb = function({... -> ['zero', a:1, a:2, a:3]}, ['one', 'two'])
|
||||||
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
|
call assert_equal(['zero', 'one', 'two', 'three'], l:Cb('three'))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_lambda_fails()
|
function Test_lambda_fails()
|
||||||
call assert_equal(3, {a, b -> a + b}(1, 2))
|
call assert_equal(3, {a, b -> a + b}(1, 2))
|
||||||
@@ -58,59 +58,59 @@ func Test_not_lamda()
|
|||||||
call assert_equal('foo', x['>'])
|
call assert_equal('foo', x['>'])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_capture_by_reference()
|
func Test_lambda_capture_by_reference()
|
||||||
let v = 1
|
let v = 1
|
||||||
let l:F = {x -> x + v}
|
let l:F = {x -> x + v}
|
||||||
let v = 2
|
let v = 2
|
||||||
call assert_equal(12, l:F(10))
|
call assert_equal(12, l:F(10))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_side_effect()
|
func Test_lambda_side_effect()
|
||||||
function! s:update_and_return(arr)
|
func! s:update_and_return(arr)
|
||||||
let a:arr[1] = 5
|
let a:arr[1] = 5
|
||||||
return a:arr
|
return a:arr
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:foo(arr)
|
func! s:foo(arr)
|
||||||
return {-> s:update_and_return(a:arr)}
|
return {-> s:update_and_return(a:arr)}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let arr = [3,2,1]
|
let arr = [3,2,1]
|
||||||
call assert_equal([3, 5, 1], s:foo(arr)())
|
call assert_equal([3, 5, 1], s:foo(arr)())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_refer_local_variable_from_other_scope()
|
func Test_lambda_refer_local_variable_from_other_scope()
|
||||||
function! s:foo(X)
|
func! s:foo(X)
|
||||||
return a:X() " refer l:x in s:bar()
|
return a:X() " refer l:x in s:bar()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:bar()
|
func! s:bar()
|
||||||
let x = 123
|
let x = 123
|
||||||
return s:foo({-> x})
|
return s:foo({-> x})
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_equal(123, s:bar())
|
call assert_equal(123, s:bar())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_do_not_share_local_variable()
|
func Test_lambda_do_not_share_local_variable()
|
||||||
function! s:define_funcs()
|
func! s:define_funcs()
|
||||||
let l:One = {-> split(execute("let a = 'abc' | echo a"))[0]}
|
let l:One = {-> split(execute("let a = 'abc' | echo a"))[0]}
|
||||||
let l:Two = {-> exists("a") ? a : "no"}
|
let l:Two = {-> exists("a") ? a : "no"}
|
||||||
return [l:One, l:Two]
|
return [l:One, l:Two]
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:define_funcs()
|
let l:F = s:define_funcs()
|
||||||
|
|
||||||
call assert_equal('no', l:F[1]())
|
call assert_equal('no', l:F[1]())
|
||||||
call assert_equal('abc', l:F[0]())
|
call assert_equal('abc', l:F[0]())
|
||||||
call assert_equal('no', l:F[1]())
|
call assert_equal('no', l:F[1]())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_closure_counter()
|
func Test_lambda_closure_counter()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 0
|
let x = 0
|
||||||
return {-> [execute("let x += 1"), x][-1]}
|
return {-> [execute("let x += 1"), x][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo()
|
let l:F = s:foo()
|
||||||
call test_garbagecollect_now()
|
call test_garbagecollect_now()
|
||||||
@@ -118,52 +118,52 @@ function! Test_lambda_closure_counter()
|
|||||||
call assert_equal(2, l:F())
|
call assert_equal(2, l:F())
|
||||||
call assert_equal(3, l:F())
|
call assert_equal(3, l:F())
|
||||||
call assert_equal(4, l:F())
|
call assert_equal(4, l:F())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_with_a_var()
|
func Test_lambda_with_a_var()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 2
|
let x = 2
|
||||||
return {... -> a:000 + [x]}
|
return {... -> a:000 + [x]}
|
||||||
endfunction
|
endfunc
|
||||||
function! s:bar()
|
func! s:bar()
|
||||||
return s:foo()(1)
|
return s:foo()(1)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_equal([1, 2], s:bar())
|
call assert_equal([1, 2], s:bar())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_call_lambda_from_lambda()
|
func Test_lambda_call_lambda_from_lambda()
|
||||||
function! s:foo(x)
|
func! s:foo(x)
|
||||||
let l:F1 = {-> {-> a:x}}
|
let l:F1 = {-> {-> a:x}}
|
||||||
return {-> l:F1()}
|
return {-> l:F1()}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo(1)
|
let l:F = s:foo(1)
|
||||||
call assert_equal(1, l:F()())
|
call assert_equal(1, l:F()())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_delfunc()
|
func Test_lambda_delfunc()
|
||||||
function! s:gen()
|
func! s:gen()
|
||||||
let pl = l:
|
let pl = l:
|
||||||
let l:Foo = {-> get(pl, "Foo", get(pl, "Bar", {-> 0}))}
|
let l:Foo = {-> get(pl, "Foo", get(pl, "Bar", {-> 0}))}
|
||||||
let l:Bar = l:Foo
|
let l:Bar = l:Foo
|
||||||
delfunction l:Foo
|
delfunction l:Foo
|
||||||
return l:Bar
|
return l:Bar
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:gen()
|
let l:F = s:gen()
|
||||||
call assert_fails(':call l:F()', 'E933:')
|
call assert_fails(':call l:F()', 'E933:')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_scope()
|
func Test_lambda_scope()
|
||||||
function! s:NewCounter()
|
func! s:NewCounter()
|
||||||
let c = 0
|
let c = 0
|
||||||
return {-> [execute('let c += 1'), c][-1]}
|
return {-> [execute('let c += 1'), c][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:NewCounter2()
|
func! s:NewCounter2()
|
||||||
return {-> [execute('let c += 100'), c][-1]}
|
return {-> [execute('let c += 100'), c][-1]}
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:C = s:NewCounter()
|
let l:C = s:NewCounter()
|
||||||
let l:D = s:NewCounter2()
|
let l:D = s:NewCounter2()
|
||||||
@@ -171,37 +171,37 @@ function! Test_lambda_scope()
|
|||||||
call assert_equal(1, l:C())
|
call assert_equal(1, l:C())
|
||||||
call assert_fails(':call l:D()', 'E15:') " E121: then E15:
|
call assert_fails(':call l:D()', 'E15:') " E121: then E15:
|
||||||
call assert_equal(2, l:C())
|
call assert_equal(2, l:C())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_share_scope()
|
func Test_lambda_share_scope()
|
||||||
function! s:New()
|
func! s:New()
|
||||||
let c = 0
|
let c = 0
|
||||||
let l:Inc0 = {-> [execute('let c += 1'), c][-1]}
|
let l:Inc0 = {-> [execute('let c += 1'), c][-1]}
|
||||||
let l:Dec0 = {-> [execute('let c -= 1'), c][-1]}
|
let l:Dec0 = {-> [execute('let c -= 1'), c][-1]}
|
||||||
return [l:Inc0, l:Dec0]
|
return [l:Inc0, l:Dec0]
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let [l:Inc, l:Dec] = s:New()
|
let [l:Inc, l:Dec] = s:New()
|
||||||
|
|
||||||
call assert_equal(1, l:Inc())
|
call assert_equal(1, l:Inc())
|
||||||
call assert_equal(2, l:Inc())
|
call assert_equal(2, l:Inc())
|
||||||
call assert_equal(1, l:Dec())
|
call assert_equal(1, l:Dec())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_circular_reference()
|
func Test_lambda_circular_reference()
|
||||||
function! s:Foo()
|
func! s:Foo()
|
||||||
let d = {}
|
let d = {}
|
||||||
let d.f = {-> d}
|
let d.f = {-> d}
|
||||||
return d.f
|
return d.f
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call s:Foo()
|
call s:Foo()
|
||||||
call test_garbagecollect_now()
|
call test_garbagecollect_now()
|
||||||
let i = 0 | while i < 10000 | call s:Foo() | let i+= 1 | endwhile
|
let i = 0 | while i < 10000 | call s:Foo() | let i+= 1 | endwhile
|
||||||
call test_garbagecollect_now()
|
call test_garbagecollect_now()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_lambda_combination()
|
func Test_lambda_combination()
|
||||||
call assert_equal(2, {x -> {x -> x}}(1)(2))
|
call assert_equal(2, {x -> {x -> x}}(1)(2))
|
||||||
call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
|
call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
|
||||||
call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
|
call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
|
||||||
@@ -214,17 +214,17 @@ function! Test_lambda_combination()
|
|||||||
let Z = {f -> {x -> f({y -> x(x)(y)})}({x -> f({y -> x(x)(y)})})}
|
let Z = {f -> {x -> f({y -> x(x)(y)})}({x -> f({y -> x(x)(y)})})}
|
||||||
let Fact = {f -> {x -> x == 0 ? 1 : x * f(x - 1)}}
|
let Fact = {f -> {x -> x == 0 ? 1 : x * f(x - 1)}}
|
||||||
call assert_equal(120, Z(Fact)(5))
|
call assert_equal(120, Z(Fact)(5))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_closure_counter()
|
func Test_closure_counter()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 0
|
let x = 0
|
||||||
function! s:bar() closure
|
func! s:bar() closure
|
||||||
let x += 1
|
let x += 1
|
||||||
return x
|
return x
|
||||||
endfunction
|
endfunc
|
||||||
return function('s:bar')
|
return function('s:bar')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
let l:F = s:foo()
|
let l:F = s:foo()
|
||||||
call test_garbagecollect_now()
|
call test_garbagecollect_now()
|
||||||
@@ -232,30 +232,30 @@ function! Test_closure_counter()
|
|||||||
call assert_equal(2, l:F())
|
call assert_equal(2, l:F())
|
||||||
call assert_equal(3, l:F())
|
call assert_equal(3, l:F())
|
||||||
call assert_equal(4, l:F())
|
call assert_equal(4, l:F())
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_closure_unlet()
|
func Test_closure_unlet()
|
||||||
function! s:foo()
|
func! s:foo()
|
||||||
let x = 1
|
let x = 1
|
||||||
function! s:bar() closure
|
func! s:bar() closure
|
||||||
unlet x
|
unlet x
|
||||||
endfunction
|
endfunc
|
||||||
call s:bar()
|
call s:bar()
|
||||||
return l:
|
return l:
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
call assert_false(has_key(s:foo(), 'x'))
|
call assert_false(has_key(s:foo(), 'x'))
|
||||||
call test_garbagecollect_now()
|
call test_garbagecollect_now()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! LambdaFoo()
|
func LambdaFoo()
|
||||||
let x = 0
|
let x = 0
|
||||||
function! LambdaBar() closure
|
func! LambdaBar() closure
|
||||||
let x += 1
|
let x += 1
|
||||||
return x
|
return x
|
||||||
endfunction
|
endfunc
|
||||||
return function('LambdaBar')
|
return function('LambdaBar')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_closure_refcount()
|
func Test_closure_refcount()
|
||||||
let g:Count = LambdaFoo()
|
let g:Count = LambdaFoo()
|
||||||
|
@@ -499,19 +499,19 @@ func Test_dict_lock_extend()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No remove() of write-protected scope-level variable
|
" No remove() of write-protected scope-level variable
|
||||||
func! Tfunc(this_is_a_long_parameter_name)
|
func Tfunc1(this_is_a_long_parameter_name)
|
||||||
call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E795')
|
call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E795')
|
||||||
endfun
|
endfunc
|
||||||
func Test_dict_scope_var_remove()
|
func Test_dict_scope_var_remove()
|
||||||
call Tfunc('testval')
|
call Tfunc1('testval')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No extend() of write-protected scope-level variable
|
" No extend() of write-protected scope-level variable
|
||||||
func! Tfunc(this_is_a_long_parameter_name)
|
func Tfunc2(this_is_a_long_parameter_name)
|
||||||
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
|
||||||
endfunc
|
endfunc
|
||||||
func Test_dict_scope_var_extend()
|
func Test_dict_scope_var_extend()
|
||||||
call Tfunc('testval')
|
call Tfunc2('testval')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" No :unlet of variable in locked scope
|
" No :unlet of variable in locked scope
|
||||||
|
@@ -13,9 +13,9 @@ function s:screen_lines(lnum, width) abort
|
|||||||
return ScreenLines(a:lnum, a:width)
|
return ScreenLines(a:lnum, a:width)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:compare_lines(expect, actual)
|
func s:compare_lines(expect, actual)
|
||||||
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
|
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function s:test_windows(...)
|
function s:test_windows(...)
|
||||||
call NewWindow(10, 20)
|
call NewWindow(10, 20)
|
||||||
|
@@ -9,15 +9,15 @@ endif
|
|||||||
|
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
|
||||||
function s:screen_lines(lnum, width) abort
|
func s:screen_lines(lnum, width) abort
|
||||||
return ScreenLines(a:lnum, a:width)
|
return ScreenLines(a:lnum, a:width)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:compare_lines(expect, actual)
|
func s:compare_lines(expect, actual)
|
||||||
call assert_equal(a:expect, a:actual)
|
call assert_equal(a:expect, a:actual)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function s:screen_attr(lnum, chars, ...) abort
|
func s:screen_attr(lnum, chars, ...) abort
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
let attr = []
|
let attr = []
|
||||||
let prefix = get(a:000, 0, 0)
|
let prefix = get(a:000, 0, 0)
|
||||||
@@ -26,18 +26,18 @@ function s:screen_attr(lnum, chars, ...) abort
|
|||||||
let attr += [screenattr(a:lnum, scol + prefix)]
|
let attr += [screenattr(a:lnum, scol + prefix)]
|
||||||
endfor
|
endfor
|
||||||
return attr
|
return attr
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function s:test_windows(...)
|
func s:test_windows(...)
|
||||||
call NewWindow(10, 20)
|
call NewWindow(10, 20)
|
||||||
setl ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
setl ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
||||||
exe get(a:000, 0, '')
|
exe get(a:000, 0, '')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function s:close_windows(...)
|
func s:close_windows(...)
|
||||||
call CloseWindow()
|
call CloseWindow()
|
||||||
exe get(a:000, 0, '')
|
exe get(a:000, 0, '')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_linebreak_with_fancy_listchars()
|
func Test_linebreak_with_fancy_listchars()
|
||||||
call s:test_windows("setl list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
call s:test_windows("setl list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
" Test that a deleted mark is restored after delete-undo-redo-undo.
|
" Test that a deleted mark is restored after delete-undo-redo-undo.
|
||||||
function! Test_Restore_DelMark()
|
func Test_Restore_DelMark()
|
||||||
enew!
|
enew!
|
||||||
call append(0, [" textline A", " textline B", " textline C"])
|
call append(0, [" textline A", " textline B", " textline C"])
|
||||||
normal! 2gg
|
normal! 2gg
|
||||||
@@ -11,10 +11,10 @@ function! Test_Restore_DelMark()
|
|||||||
call assert_equal(2, pos[1])
|
call assert_equal(2, pos[1])
|
||||||
call assert_equal(1, pos[2])
|
call assert_equal(1, pos[2])
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" Test that CTRL-A and CTRL-X updates last changed mark '[, '].
|
" Test that CTRL-A and CTRL-X updates last changed mark '[, '].
|
||||||
function! Test_Incr_Marks()
|
func Test_Incr_Marks()
|
||||||
enew!
|
enew!
|
||||||
call append(0, ["123 123 123", "123 123 123", "123 123 123"])
|
call append(0, ["123 123 123", "123 123 123", "123 123 123"])
|
||||||
normal! gg
|
normal! gg
|
||||||
@@ -23,7 +23,7 @@ function! Test_Incr_Marks()
|
|||||||
call assert_equal("123 XXXXXXX", getline(2))
|
call assert_equal("123 XXXXXXX", getline(2))
|
||||||
call assert_equal("XXX 123 123", getline(3))
|
call assert_equal("XXX 123 123", getline(3))
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_setpos()
|
func Test_setpos()
|
||||||
new one
|
new one
|
||||||
|
@@ -9,7 +9,7 @@ endif
|
|||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
|
|
||||||
function! Test_simple_matchadd()
|
func Test_simple_matchadd()
|
||||||
new
|
new
|
||||||
|
|
||||||
1put='# This is a Test'
|
1put='# This is a Test'
|
||||||
@@ -29,9 +29,9 @@ function! Test_simple_matchadd()
|
|||||||
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_simple_matchadd_and_conceal()
|
func Test_simple_matchadd_and_conceal()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ function! Test_simple_matchadd_and_conceal()
|
|||||||
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_matchadd_and_conceallevel_3()
|
func Test_matchadd_and_conceallevel_3()
|
||||||
new
|
new
|
||||||
|
|
||||||
setlocal conceallevel=3
|
setlocal conceallevel=3
|
||||||
@@ -92,9 +92,9 @@ function! Test_matchadd_and_conceallevel_3()
|
|||||||
|
|
||||||
syntax off
|
syntax off
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_default_conceal_char()
|
func Test_default_conceal_char()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
@@ -128,9 +128,9 @@ function! Test_default_conceal_char()
|
|||||||
|
|
||||||
let &listchars = listchars_save
|
let &listchars = listchars_save
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_syn_and_match_conceal()
|
func Test_syn_and_match_conceal()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
@@ -164,9 +164,9 @@ function! Test_syn_and_match_conceal()
|
|||||||
|
|
||||||
syntax off
|
syntax off
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_clearmatches()
|
func Test_clearmatches()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
@@ -203,9 +203,9 @@ function! Test_clearmatches()
|
|||||||
call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0])
|
call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0])
|
||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_using_matchaddpos()
|
func Test_using_matchaddpos()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
" set filetype and :syntax on to change screenattr()
|
" set filetype and :syntax on to change screenattr()
|
||||||
@@ -234,9 +234,9 @@ function! Test_using_matchaddpos()
|
|||||||
|
|
||||||
syntax off
|
syntax off
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_matchadd_repeat_conceal_with_syntax_off()
|
func Test_matchadd_repeat_conceal_with_syntax_off()
|
||||||
new
|
new
|
||||||
|
|
||||||
" To test targets in the same line string is replaced with conceal char
|
" To test targets in the same line string is replaced with conceal char
|
||||||
@@ -253,9 +253,9 @@ function! Test_matchadd_repeat_conceal_with_syntax_off()
|
|||||||
call assert_equal('t_tt', Screenline(2))
|
call assert_equal('t_tt', Screenline(2))
|
||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_matchadd_and_syn_conceal()
|
func Test_matchadd_and_syn_conceal()
|
||||||
new
|
new
|
||||||
let cnt='Inductive bool : Type := | true : bool | false : bool.'
|
let cnt='Inductive bool : Type := | true : bool | false : bool.'
|
||||||
let expect = 'Inductive - : Type := | true : - | false : -.'
|
let expect = 'Inductive - : Type := | true : - | false : -.'
|
||||||
@@ -276,4 +276,4 @@ function! Test_matchadd_and_syn_conceal()
|
|||||||
call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
|
call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
|
||||||
call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
|
call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
|
||||||
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
|
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
|
||||||
endfunction
|
endfunc
|
||||||
|
@@ -7,19 +7,19 @@ if !has('gui_running') && has('unix')
|
|||||||
set term=ansi
|
set term=ansi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:screenline(lnum) abort
|
func s:screenline(lnum) abort
|
||||||
let line = []
|
let line = []
|
||||||
for c in range(1, winwidth(0))
|
for c in range(1, winwidth(0))
|
||||||
call add(line, nr2char(screenchar(a:lnum, c)))
|
call add(line, nr2char(screenchar(a:lnum, c)))
|
||||||
endfor
|
endfor
|
||||||
return s:trim(join(line, ''))
|
return s:trim(join(line, ''))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! s:trim(str) abort
|
func s:trim(str) abort
|
||||||
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
|
return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_match_using_multibyte_conceal_char()
|
func Test_match_using_multibyte_conceal_char()
|
||||||
new
|
new
|
||||||
setlocal concealcursor=n conceallevel=1
|
setlocal concealcursor=n conceallevel=1
|
||||||
|
|
||||||
@@ -40,4 +40,4 @@ function! Test_match_using_multibyte_conceal_char()
|
|||||||
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
|
||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
endfunc
|
||||||
|
@@ -43,7 +43,7 @@ endfunction
|
|||||||
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
|
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
|
||||||
" output could then be disturbed when 'cmdheight' was greater than one.
|
" output could then be disturbed when 'cmdheight' was greater than one.
|
||||||
" This test ensures that the bugfix for this issue remains in place.
|
" This test ensures that the bugfix for this issue remains in place.
|
||||||
function! Test_stopinsert_does_not_break_message_output()
|
func Test_stopinsert_does_not_break_message_output()
|
||||||
set cmdheight=2
|
set cmdheight=2
|
||||||
redraw!
|
redraw!
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ function! Test_stopinsert_does_not_break_message_output()
|
|||||||
redraw!
|
redraw!
|
||||||
|
|
||||||
set cmdheight&
|
set cmdheight&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_message_completion()
|
func Test_message_completion()
|
||||||
call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
@@ -2,23 +2,23 @@
|
|||||||
|
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
|
||||||
func! s:screen_lines(start, end) abort
|
func s:screen_lines(start, end) abort
|
||||||
return ScreenLines([a:start, a:end], 8)
|
return ScreenLines([a:start, a:end], 8)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:compare_lines(expect, actual)
|
func s:compare_lines(expect, actual)
|
||||||
call assert_equal(a:expect, a:actual)
|
call assert_equal(a:expect, a:actual)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:test_windows(h, w) abort
|
func s:test_windows(h, w) abort
|
||||||
call NewWindow(a:h, a:w)
|
call NewWindow(a:h, a:w)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:close_windows() abort
|
func s:close_windows() abort
|
||||||
call CloseWindow()
|
call CloseWindow()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:validate_cursor() abort
|
func s:validate_cursor() abort
|
||||||
" update skipcol.
|
" update skipcol.
|
||||||
" wincol():
|
" wincol():
|
||||||
" f_wincol
|
" f_wincol
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Test for options
|
" Test for options
|
||||||
|
|
||||||
function! Test_whichwrap()
|
func Test_whichwrap()
|
||||||
set whichwrap=b,s
|
set whichwrap=b,s
|
||||||
call assert_equal('b,s', &whichwrap)
|
call assert_equal('b,s', &whichwrap)
|
||||||
|
|
||||||
@@ -20,16 +20,16 @@ function! Test_whichwrap()
|
|||||||
call assert_equal('h', &whichwrap)
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_isfname()
|
func Test_isfname()
|
||||||
" This used to cause Vim to access uninitialized memory.
|
" This used to cause Vim to access uninitialized memory.
|
||||||
set isfname=
|
set isfname=
|
||||||
call assert_equal("~X", expand("~X"))
|
call assert_equal("~X", expand("~X"))
|
||||||
set isfname&
|
set isfname&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_wildchar()
|
func Test_wildchar()
|
||||||
" Empty 'wildchar' used to access invalid memory.
|
" Empty 'wildchar' used to access invalid memory.
|
||||||
call assert_fails('set wildchar=', 'E521:')
|
call assert_fails('set wildchar=', 'E521:')
|
||||||
call assert_fails('set wildchar=abc', 'E521:')
|
call assert_fails('set wildchar=abc', 'E521:')
|
||||||
@@ -40,9 +40,9 @@ function Test_wildchar()
|
|||||||
let a=execute('set wildchar?')
|
let a=execute('set wildchar?')
|
||||||
call assert_equal("\n wildchar=<Esc>", a)
|
call assert_equal("\n wildchar=<Esc>", a)
|
||||||
set wildchar&
|
set wildchar&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_options()
|
func Test_options()
|
||||||
let caught = 'ok'
|
let caught = 'ok'
|
||||||
try
|
try
|
||||||
options
|
options
|
||||||
@@ -53,9 +53,9 @@ function Test_options()
|
|||||||
|
|
||||||
" close option-window
|
" close option-window
|
||||||
close
|
close
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_path_keep_commas()
|
func Test_path_keep_commas()
|
||||||
" Test that changing 'path' keeps two commas.
|
" Test that changing 'path' keeps two commas.
|
||||||
set path=foo,,bar
|
set path=foo,,bar
|
||||||
set path-=bar
|
set path-=bar
|
||||||
@@ -63,7 +63,7 @@ function Test_path_keep_commas()
|
|||||||
call assert_equal('foo,,bar', &path)
|
call assert_equal('foo,,bar', &path)
|
||||||
|
|
||||||
set path&
|
set path&
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_signcolumn()
|
func Test_signcolumn()
|
||||||
if has('signs')
|
if has('signs')
|
||||||
|
@@ -114,9 +114,9 @@ func Test_function_in_dict()
|
|||||||
call OuterCall()
|
call OuterCall()
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:cache_clear() dict
|
func s:cache_clear() dict
|
||||||
return self.name
|
return self.name
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_script_function_in_dict()
|
func Test_script_function_in_dict()
|
||||||
let s:obj = {'name': 'foo'}
|
let s:obj = {'name': 'foo'}
|
||||||
@@ -136,10 +136,10 @@ func Test_script_function_in_dict()
|
|||||||
call assert_equal('bar', B())
|
call assert_equal('bar', B())
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:cache_arg(arg) dict
|
func s:cache_arg(arg) dict
|
||||||
let s:result = self.name . '/' . a:arg
|
let s:result = self.name . '/' . a:arg
|
||||||
return s:result
|
return s:result
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_script_function_in_dict_arg()
|
func Test_script_function_in_dict_arg()
|
||||||
let s:obj = {'name': 'foo'}
|
let s:obj = {'name': 'foo'}
|
||||||
|
@@ -1,24 +1,24 @@
|
|||||||
" Tests for smartindent
|
" Tests for smartindent
|
||||||
|
|
||||||
" Tests for not doing smart indenting when it isn't set.
|
" Tests for not doing smart indenting when it isn't set.
|
||||||
function! Test_nosmartindent()
|
func Test_nosmartindent()
|
||||||
new
|
new
|
||||||
call append(0, [" some test text",
|
call append(0, [" some test text",
|
||||||
\ " test text",
|
\ " test text",
|
||||||
\ "test text",
|
\ "test text",
|
||||||
\ " test text"])
|
\ " test text"])
|
||||||
set nocindent nosmartindent autoindent
|
set nocindent nosmartindent autoindent
|
||||||
exe "normal! gg/some\<CR>"
|
exe "normal! gg/some\<CR>"
|
||||||
exe "normal! 2cc#test\<Esc>"
|
exe "normal! 2cc#test\<Esc>"
|
||||||
call assert_equal(" #test", getline(1))
|
call assert_equal(" #test", getline(1))
|
||||||
enew! | close
|
enew! | close
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function MyIndent()
|
func MyIndent()
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" When 'indentexpr' is set, setting 'si' has no effect.
|
" When 'indentexpr' is set, setting 'si' has no effect.
|
||||||
function Test_smartindent_has_no_effect()
|
func Test_smartindent_has_no_effect()
|
||||||
new
|
new
|
||||||
exe "normal! i\<Tab>one\<Esc>"
|
exe "normal! i\<Tab>one\<Esc>"
|
||||||
set noautoindent
|
set noautoindent
|
||||||
@@ -36,6 +36,6 @@ function Test_smartindent_has_no_effect()
|
|||||||
set smartindent&
|
set smartindent&
|
||||||
set indentexpr&
|
set indentexpr&
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Tests for multi-line regexps with ":s".
|
" Tests for multi-line regexps with ":s".
|
||||||
|
|
||||||
function! Test_multiline_subst()
|
func Test_multiline_subst()
|
||||||
enew!
|
enew!
|
||||||
call append(0, ["1 aa",
|
call append(0, ["1 aa",
|
||||||
\ "bb",
|
\ "bb",
|
||||||
@@ -38,9 +38,9 @@ function! Test_multiline_subst()
|
|||||||
call assert_equal('7x7f', getline(12))
|
call assert_equal('7x7f', getline(12))
|
||||||
call assert_equal('xxxxx', getline(13))
|
call assert_equal('xxxxx', getline(13))
|
||||||
enew!
|
enew!
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_substitute_variants()
|
func Test_substitute_variants()
|
||||||
" Validate that all the 2-/3-letter variants which embed the flags into the
|
" Validate that all the 2-/3-letter variants which embed the flags into the
|
||||||
" command name actually work.
|
" command name actually work.
|
||||||
enew!
|
enew!
|
||||||
@@ -105,7 +105,7 @@ function! Test_substitute_variants()
|
|||||||
call assert_equal(var.exp, getline('.'), msg)
|
call assert_equal(var.exp, getline('.'), msg)
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_substitute_repeat()
|
func Test_substitute_repeat()
|
||||||
" This caused an invalid memory access.
|
" This caused an invalid memory access.
|
||||||
@@ -401,9 +401,9 @@ func Test_sub_cmd_4()
|
|||||||
|
|
||||||
" List entry format: [input, cmd, output]
|
" List entry format: [input, cmd, output]
|
||||||
let tests = [ ['aAa', "s/A/\\=substitute(submatch(0), '.', '\\', '')/",
|
let tests = [ ['aAa', "s/A/\\=substitute(submatch(0), '.', '\\', '')/",
|
||||||
\ ['a\a']],
|
\ ['a\a']],
|
||||||
\ ['bBb', "s/B/\\=substitute(submatch(0), '.', '\\', '')/",
|
\ ['bBb', "s/B/\\=substitute(submatch(0), '.', '\\', '')/",
|
||||||
\ ['b\b']],
|
\ ['b\b']],
|
||||||
\ ['cCc', "s/C/\\=substitute(submatch(0), '.', '\<C-V>\<C-M>', '')/",
|
\ ['cCc', "s/C/\\=substitute(submatch(0), '.', '\<C-V>\<C-M>', '')/",
|
||||||
\ ["c\<C-V>", 'c']],
|
\ ["c\<C-V>", 'c']],
|
||||||
\ ['dDd', "s/D/\\=substitute(submatch(0), '.', '\\\<C-V>\<C-M>', '')/",
|
\ ['dDd', "s/D/\\=substitute(submatch(0), '.', '\\\<C-V>\<C-M>', '')/",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Tests for system() and systemlist()
|
" Tests for system() and systemlist()
|
||||||
|
|
||||||
function! Test_System()
|
func Test_System()
|
||||||
if !executable('echo') || !executable('cat') || !executable('wc')
|
if !executable('echo') || !executable('cat') || !executable('wc')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -45,9 +45,9 @@ function! Test_System()
|
|||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
call assert_fails('call system("wc -l", 99999)', 'E86:')
|
call assert_fails('call system("wc -l", 99999)', 'E86:')
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Test_system_exmode()
|
func Test_system_exmode()
|
||||||
if has('unix') " echo $? only works on Unix
|
if has('unix') " echo $? only works on Unix
|
||||||
let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"'
|
let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"'
|
||||||
" Need to put this in a script, "catch" isn't found after an unknown
|
" Need to put this in a script, "catch" isn't found after an unknown
|
||||||
|
@@ -122,7 +122,7 @@ func Test_terminal_hide_buffer()
|
|||||||
unlet g:job
|
unlet g:job
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:Nasty_exit_cb(job, st)
|
func s:Nasty_exit_cb(job, st)
|
||||||
exe g:buf . 'bwipe!'
|
exe g:buf . 'bwipe!'
|
||||||
let g:buf = 0
|
let g:buf = 0
|
||||||
endfunc
|
endfunc
|
||||||
@@ -1727,3 +1727,27 @@ func Test_terminal_no_job()
|
|||||||
let term = term_start('false', {'term_finish': 'close'})
|
let term = term_start('false', {'term_finish': 'close'})
|
||||||
call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
|
call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_term_gettitle()
|
||||||
|
if !has('title') || empty(&t_ts)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" TODO: this fails on Travis
|
||||||
|
return
|
||||||
|
|
||||||
|
" term_gettitle() returns an empty string for a non-terminal buffer
|
||||||
|
" or for a non-existing buffer.
|
||||||
|
call assert_equal('', term_gettitle(bufnr('%')))
|
||||||
|
call assert_equal('', term_gettitle(bufnr('$') + 1))
|
||||||
|
|
||||||
|
let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'])
|
||||||
|
call WaitForAssert({-> assert_equal('[No Name] - VIM', term_gettitle(term)) })
|
||||||
|
|
||||||
|
call term_sendkeys(term, ":e Xfoo\r")
|
||||||
|
call WaitForAssert({-> assert_match('Xfoo (.*[/\\]testdir) - VIM', term_gettitle(term)) })
|
||||||
|
|
||||||
|
call term_sendkeys(term, ":set titlestring=foo\r")
|
||||||
|
call WaitForAssert({-> assert_equal('foo', term_gettitle(term)) })
|
||||||
|
|
||||||
|
exe term . 'bwipe!'
|
||||||
|
endfunc
|
||||||
|
@@ -236,7 +236,7 @@ func Test_sentence_with_quotes()
|
|||||||
%delete _
|
%delete _
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_sentence_with_cursor_on_delimiter()
|
func Test_sentence_with_cursor_on_delimiter()
|
||||||
enew!
|
enew!
|
||||||
call setline(1, "A '([sentence.])' A sentence.")
|
call setline(1, "A '([sentence.])' A sentence.")
|
||||||
|
|
||||||
|
@@ -25,17 +25,17 @@ func Test_strchars()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for customlist completion
|
" Test for customlist completion
|
||||||
function! CustomComplete1(lead, line, pos)
|
func CustomComplete1(lead, line, pos)
|
||||||
return ['あ', 'い']
|
return ['あ', 'い']
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! CustomComplete2(lead, line, pos)
|
func CustomComplete2(lead, line, pos)
|
||||||
return ['あたし', 'あたま', 'あたりめ']
|
return ['あたし', 'あたま', 'あたりめ']
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! CustomComplete3(lead, line, pos)
|
func CustomComplete3(lead, line, pos)
|
||||||
return ['Nこ', 'Nん', 'Nぶ']
|
return ['Nこ', 'Nん', 'Nぶ']
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_customlist_completion()
|
func Test_customlist_completion()
|
||||||
command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo
|
command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo
|
||||||
|
@@ -5,12 +5,12 @@ if !has("multi_byte")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! Ch(a, op, b, expected)
|
func Ch(a, op, b, expected)
|
||||||
call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected,
|
call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected,
|
||||||
\ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
|
\ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Chk(a, b, result)
|
func Chk(a, b, result)
|
||||||
if a:result == 0
|
if a:result == 0
|
||||||
call Ch(a:a, '==?', a:b, 1)
|
call Ch(a:a, '==?', a:b, 1)
|
||||||
call Ch(a:a, '!=?', a:b, 0)
|
call Ch(a:a, '!=?', a:b, 0)
|
||||||
@@ -33,26 +33,26 @@ function! Chk(a, b, result)
|
|||||||
call Ch(a:a, '<?', a:b, 1)
|
call Ch(a:a, '<?', a:b, 1)
|
||||||
call Ch(a:a, '>?', a:b, 0)
|
call Ch(a:a, '>?', a:b, 0)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! Check(a, b, result)
|
func Check(a, b, result)
|
||||||
call Chk(a:a, a:b, a:result)
|
call Chk(a:a, a:b, a:result)
|
||||||
call Chk(a:b, a:a, -a:result)
|
call Chk(a:b, a:a, -a:result)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! LT(a, b)
|
func LT(a, b)
|
||||||
call Check(a:a, a:b, -1)
|
call Check(a:a, a:b, -1)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! GT(a, b)
|
func GT(a, b)
|
||||||
call Check(a:a, a:b, 1)
|
call Check(a:a, a:b, 1)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function! EQ(a, b)
|
func EQ(a, b)
|
||||||
call Check(a:a, a:b, 0)
|
call Check(a:a, a:b, 0)
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_comparisons()
|
func Test_comparisons()
|
||||||
call EQ('', '')
|
call EQ('', '')
|
||||||
call LT('', 'a')
|
call LT('', 'a')
|
||||||
call EQ('abc', 'abc')
|
call EQ('abc', 'abc')
|
||||||
@@ -85,11 +85,11 @@ function Test_comparisons()
|
|||||||
for n in range(0xC0, 0xFF)
|
for n in range(0xC0, 0xFF)
|
||||||
call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n))
|
call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n))
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" test that g~ap changes one paragraph only.
|
" test that g~ap changes one paragraph only.
|
||||||
function Test_gap()
|
func Test_gap()
|
||||||
new
|
new
|
||||||
call feedkeys("iabcd\n\ndefggg0g~ap", "tx")
|
call feedkeys("iabcd\n\ndefggg0g~ap", "tx")
|
||||||
call assert_equal(["ABCD", "", "defg"], getline(1,3))
|
call assert_equal(["ABCD", "", "defg"], getline(1,3))
|
||||||
endfunction
|
endfunc
|
||||||
|
@@ -134,7 +134,7 @@ func Test_vartabs()
|
|||||||
bwipeout!
|
bwipeout!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_vartabs_breakindent()
|
func Test_vartabs_breakindent()
|
||||||
if !exists("+breakindent")
|
if !exists("+breakindent")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
" Test environment {{{1
|
" Test environment {{{1
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
|
|
||||||
com! XpathINIT let g:Xpath = ''
|
com! XpathINIT let g:Xpath = ''
|
||||||
com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args>
|
com! -nargs=1 -bar Xpath let g:Xpath = g:Xpath . <args>
|
||||||
|
|
||||||
" Append a message to the "messages" file
|
" Append a message to the "messages" file
|
||||||
func! Xout(text)
|
func Xout(text)
|
||||||
split messages
|
split messages
|
||||||
$put =a:text
|
$put =a:text
|
||||||
wq
|
wq
|
||||||
@@ -25,7 +25,7 @@ com! -nargs=1 Xout call Xout(<args>)
|
|||||||
" in the variable argument list. This function is useful if similar tests are
|
" in the variable argument list. This function is useful if similar tests are
|
||||||
" to be made for a ":return" from a function call or a ":finish" in a script
|
" to be made for a ":return" from a function call or a ":finish" in a script
|
||||||
" file.
|
" file.
|
||||||
function! MakeScript(funcname, ...)
|
func MakeScript(funcname, ...)
|
||||||
let script = tempname()
|
let script = tempname()
|
||||||
execute "redir! >" . script
|
execute "redir! >" . script
|
||||||
execute "function" a:funcname
|
execute "function" a:funcname
|
||||||
@@ -50,7 +50,7 @@ function! MakeScript(funcname, ...)
|
|||||||
write
|
write
|
||||||
bwipeout
|
bwipeout
|
||||||
return script
|
return script
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
" ExecAsScript - Source a temporary script made from a function. {{{2
|
" ExecAsScript - Source a temporary script made from a function. {{{2
|
||||||
"
|
"
|
||||||
@@ -301,9 +301,9 @@ XpathINIT
|
|||||||
"
|
"
|
||||||
let calls = ""
|
let calls = ""
|
||||||
com! -nargs=1 CALL
|
com! -nargs=1 CALL
|
||||||
\ if !exists("calls") && !exists("outer") |
|
\ if !exists("calls") && !exists("outer") |
|
||||||
\ let g:calls = g:calls . <args> |
|
\ let g:calls = g:calls . <args> |
|
||||||
\ endif
|
\ endif
|
||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
while i < 3
|
while i < 3
|
||||||
@@ -357,7 +357,7 @@ endif
|
|||||||
if exists("*F1")
|
if exists("*F1")
|
||||||
call F1("F1")
|
call F1("F1")
|
||||||
if exists("*G1")
|
if exists("*G1")
|
||||||
call G1("G1")
|
call G1("G1")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -367,13 +367,13 @@ endif
|
|||||||
if exists("*F2")
|
if exists("*F2")
|
||||||
call F2(2, "F2")
|
call F2(2, "F2")
|
||||||
if exists("*G21")
|
if exists("*G21")
|
||||||
call G21("G21")
|
call G21("G21")
|
||||||
endif
|
endif
|
||||||
if exists("*G22")
|
if exists("*G22")
|
||||||
call G22("G22")
|
call G22("G22")
|
||||||
endif
|
endif
|
||||||
if exists("*G23")
|
if exists("*G23")
|
||||||
call G23("G23")
|
call G23("G23")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -383,13 +383,13 @@ endif
|
|||||||
if exists("*F3")
|
if exists("*F3")
|
||||||
call F3(3, "F3")
|
call F3(3, "F3")
|
||||||
if exists("*G31")
|
if exists("*G31")
|
||||||
call G31("G31")
|
call G31("G31")
|
||||||
endif
|
endif
|
||||||
if exists("*G32")
|
if exists("*G32")
|
||||||
call G32("G32")
|
call G32("G32")
|
||||||
endif
|
endif
|
||||||
if exists("*G33")
|
if exists("*G33")
|
||||||
call G33("G33")
|
call G33("G33")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -640,7 +640,7 @@ function! MSG(enr, emsg)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return match
|
return match
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
if 1 || strlen("\"") | Xpath 'a'
|
if 1 || strlen("\"") | Xpath 'a'
|
||||||
Xpath 'b'
|
Xpath 'b'
|
||||||
@@ -1032,11 +1032,11 @@ func Test_type()
|
|||||||
call assert_true(empty(v:none))
|
call assert_true(empty(v:none))
|
||||||
|
|
||||||
func ChangeYourMind()
|
func ChangeYourMind()
|
||||||
try
|
try
|
||||||
return v:true
|
return v:true
|
||||||
finally
|
finally
|
||||||
return 'something else'
|
return 'something else'
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
call ChangeYourMind()
|
call ChangeYourMind()
|
||||||
@@ -1250,70 +1250,70 @@ endfunction
|
|||||||
func Test_script_lines()
|
func Test_script_lines()
|
||||||
" :append
|
" :append
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Append', [
|
call DefineFunction('T_Append', [
|
||||||
\ 'append',
|
\ 'append',
|
||||||
\ 'py <<EOS',
|
\ 'py <<EOS',
|
||||||
\ '.',
|
\ '.',
|
||||||
\ ])
|
\ ])
|
||||||
catch
|
catch
|
||||||
call assert_report("Can't define function")
|
call assert_report("Can't define function")
|
||||||
endtry
|
endtry
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Append', [
|
call DefineFunction('T_Append', [
|
||||||
\ 'append',
|
\ 'append',
|
||||||
\ 'abc',
|
\ 'abc',
|
||||||
\ ])
|
\ ])
|
||||||
call assert_report("Shouldn't be able to define function")
|
call assert_report("Shouldn't be able to define function")
|
||||||
catch
|
catch
|
||||||
call assert_exception('Vim(function):E126: Missing :endfunction')
|
call assert_exception('Vim(function):E126: Missing :endfunction')
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" :change
|
" :change
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Change', [
|
call DefineFunction('T_Change', [
|
||||||
\ 'change',
|
\ 'change',
|
||||||
\ 'py <<EOS',
|
\ 'py <<EOS',
|
||||||
\ '.',
|
\ '.',
|
||||||
\ ])
|
\ ])
|
||||||
catch
|
catch
|
||||||
call assert_report("Can't define function")
|
call assert_report("Can't define function")
|
||||||
endtry
|
endtry
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Change', [
|
call DefineFunction('T_Change', [
|
||||||
\ 'change',
|
\ 'change',
|
||||||
\ 'abc',
|
\ 'abc',
|
||||||
\ ])
|
\ ])
|
||||||
call assert_report("Shouldn't be able to define function")
|
call assert_report("Shouldn't be able to define function")
|
||||||
catch
|
catch
|
||||||
call assert_exception('Vim(function):E126: Missing :endfunction')
|
call assert_exception('Vim(function):E126: Missing :endfunction')
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" :insert
|
" :insert
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Insert', [
|
call DefineFunction('T_Insert', [
|
||||||
\ 'insert',
|
\ 'insert',
|
||||||
\ 'py <<EOS',
|
\ 'py <<EOS',
|
||||||
\ '.',
|
\ '.',
|
||||||
\ ])
|
\ ])
|
||||||
catch
|
catch
|
||||||
call assert_report("Can't define function")
|
call assert_report("Can't define function")
|
||||||
endtry
|
endtry
|
||||||
try
|
try
|
||||||
call DefineFunction('T_Insert', [
|
call DefineFunction('T_Insert', [
|
||||||
\ 'insert',
|
\ 'insert',
|
||||||
\ 'abc',
|
\ 'abc',
|
||||||
\ ])
|
\ ])
|
||||||
call assert_report("Shouldn't be able to define function")
|
call assert_report("Shouldn't be able to define function")
|
||||||
catch
|
catch
|
||||||
call assert_exception('Vim(function):E126: Missing :endfunction')
|
call assert_exception('Vim(function):E126: Missing :endfunction')
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
" Test 96: line continuation {{{1
|
" Test 96: line continuation {{{1
|
||||||
"
|
"
|
||||||
" Undefined behavior was detected by ubsan with line continuation
|
" Undefined behavior was detected by ubsan with line continuation
|
||||||
" after an empty line.
|
" after an empty line.
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
func Test_script_emty_line_continuation()
|
func Test_script_emty_line_continuation()
|
||||||
|
|
||||||
|
@@ -578,13 +578,13 @@ func Test_winrestcmd()
|
|||||||
only
|
only
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! Fun_RenewFile()
|
func Fun_RenewFile()
|
||||||
sleep 2
|
sleep 2
|
||||||
silent execute '!echo "1" > tmp.txt'
|
silent execute '!echo "1" > tmp.txt'
|
||||||
sp
|
sp
|
||||||
wincmd p
|
wincmd p
|
||||||
edit! tmp.txt
|
edit! tmp.txt
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
func Test_window_prevwin()
|
func Test_window_prevwin()
|
||||||
" Can we make this work on MS-Windows?
|
" Can we make this work on MS-Windows?
|
||||||
|
@@ -7,17 +7,17 @@ else
|
|||||||
let s:xxd_cmd = $XXD
|
let s:xxd_cmd = $XXD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
func! PrepareBuffer(lines)
|
func PrepareBuffer(lines)
|
||||||
new
|
new
|
||||||
call append(0, a:lines)
|
call append(0, a:lines)
|
||||||
$d
|
$d
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! s:Mess(counter)
|
func s:Mess(counter)
|
||||||
return printf("Failed xxd test %d:", a:counter)
|
return printf("Failed xxd test %d:", a:counter)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_xxd()
|
func Test_xxd()
|
||||||
call PrepareBuffer(range(1,30))
|
call PrepareBuffer(range(1,30))
|
||||||
set ff=unix
|
set ff=unix
|
||||||
w XXDfile
|
w XXDfile
|
||||||
|
@@ -799,6 +799,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
711,
|
||||||
/**/
|
/**/
|
||||||
710,
|
710,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user