mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 8.1.1362: code and data in tests can be hard to read
Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes #4400)
This commit is contained in:
@@ -423,18 +423,20 @@ func Test_autocmd_bufwipe_in_SessLoadPost()
|
|||||||
set noswapfile
|
set noswapfile
|
||||||
mksession!
|
mksession!
|
||||||
|
|
||||||
let content = ['set nocp noswapfile',
|
let content =<< trim [CODE]
|
||||||
\ 'let v:swapchoice="e"',
|
set nocp noswapfile
|
||||||
\ 'augroup test_autocmd_sessionload',
|
let v:swapchoice="e"
|
||||||
\ 'autocmd!',
|
augroup test_autocmd_sessionload
|
||||||
\ 'autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"',
|
autocmd!
|
||||||
\ 'augroup END',
|
autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"
|
||||||
\ '',
|
augroup END
|
||||||
\ 'func WriteErrors()',
|
|
||||||
\ ' call writefile([execute("messages")], "Xerrors")',
|
func WriteErrors()
|
||||||
\ 'endfunc',
|
call writefile([execute("messages")], "Xerrors")
|
||||||
\ 'au VimLeave * call WriteErrors()',
|
endfunc
|
||||||
\ ]
|
au VimLeave * call WriteErrors()
|
||||||
|
[CODE]
|
||||||
|
|
||||||
call writefile(content, 'Xvimrc')
|
call writefile(content, 'Xvimrc')
|
||||||
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
|
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
|
||||||
let errors = join(readfile('Xerrors'))
|
let errors = join(readfile('Xerrors'))
|
||||||
@@ -452,27 +454,29 @@ func Test_autocmd_bufwipe_in_SessLoadPost2()
|
|||||||
set noswapfile
|
set noswapfile
|
||||||
mksession!
|
mksession!
|
||||||
|
|
||||||
let content = ['set nocp noswapfile',
|
let content =<< trim [CODE]
|
||||||
\ 'function! DeleteInactiveBufs()',
|
set nocp noswapfile
|
||||||
\ ' tabfirst',
|
function! DeleteInactiveBufs()
|
||||||
\ ' let tabblist = []',
|
tabfirst
|
||||||
\ ' for i in range(1, tabpagenr(''$''))',
|
let tabblist = []
|
||||||
\ ' call extend(tabblist, tabpagebuflist(i))',
|
for i in range(1, tabpagenr(''$''))
|
||||||
\ ' endfor',
|
call extend(tabblist, tabpagebuflist(i))
|
||||||
\ ' for b in range(1, bufnr(''$''))',
|
endfor
|
||||||
\ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')',
|
for b in range(1, bufnr(''$''))
|
||||||
\ ' exec ''bwipeout '' . b',
|
if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')
|
||||||
\ ' endif',
|
exec ''bwipeout '' . b
|
||||||
\ ' endfor',
|
endif
|
||||||
\ ' echomsg "SessionLoadPost DONE"',
|
endfor
|
||||||
\ 'endfunction',
|
echomsg "SessionLoadPost DONE"
|
||||||
\ 'au SessionLoadPost * call DeleteInactiveBufs()',
|
endfunction
|
||||||
\ '',
|
au SessionLoadPost * call DeleteInactiveBufs()
|
||||||
\ 'func WriteErrors()',
|
|
||||||
\ ' call writefile([execute("messages")], "Xerrors")',
|
func WriteErrors()
|
||||||
\ 'endfunc',
|
call writefile([execute("messages")], "Xerrors")
|
||||||
\ 'au VimLeave * call WriteErrors()',
|
endfunc
|
||||||
\ ]
|
au VimLeave * call WriteErrors()
|
||||||
|
[CODE]
|
||||||
|
|
||||||
call writefile(content, 'Xvimrc')
|
call writefile(content, 'Xvimrc')
|
||||||
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
|
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
|
||||||
let errors = join(readfile('Xerrors'))
|
let errors = join(readfile('Xerrors'))
|
||||||
@@ -933,21 +937,23 @@ func Test_bufunload_all()
|
|||||||
call writefile(['Test file Xxx1'], 'Xxx1')"
|
call writefile(['Test file Xxx1'], 'Xxx1')"
|
||||||
call writefile(['Test file Xxx2'], 'Xxx2')"
|
call writefile(['Test file Xxx2'], 'Xxx2')"
|
||||||
|
|
||||||
let content = [
|
let content =<< trim [CODE]
|
||||||
\ "func UnloadAllBufs()",
|
func UnloadAllBufs()
|
||||||
\ " let i = 1",
|
let i = 1
|
||||||
\ " while i <= bufnr('$')",
|
while i <= bufnr('$')
|
||||||
\ " if i != bufnr('%') && bufloaded(i)",
|
if i != bufnr('%') && bufloaded(i)
|
||||||
\ " exe i . 'bunload'",
|
exe i . 'bunload'
|
||||||
\ " endif",
|
endif
|
||||||
\ " let i += 1",
|
let i += 1
|
||||||
\ " endwhile",
|
endwhile
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "au BufUnload * call UnloadAllBufs()",
|
au BufUnload * call UnloadAllBufs()
|
||||||
\ "au VimLeave * call writefile(['Test Finished'], 'Xout')",
|
au VimLeave * call writefile(['Test Finished'], 'Xout')
|
||||||
\ "edit Xxx1",
|
edit Xxx1
|
||||||
\ "split Xxx2",
|
split Xxx2
|
||||||
\ "q"]
|
q
|
||||||
|
[CODE]
|
||||||
|
|
||||||
call writefile(content, 'Xtest')
|
call writefile(content, 'Xtest')
|
||||||
|
|
||||||
call delete('Xout')
|
call delete('Xout')
|
||||||
|
@@ -8,14 +8,14 @@ if !CanRunVimInTerminal()
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:common_script = [
|
let s:common_script =<< [CODE]
|
||||||
\ 'call setline(1, ["one one one", "two tXo two", "three three three"])',
|
call setline(1, ["one one one", "two tXo two", "three three three"])
|
||||||
\ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100',
|
set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100
|
||||||
\ 'func MyBalloonExpr()',
|
func MyBalloonExpr()
|
||||||
\ ' return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text',
|
return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text
|
||||||
\ 'endfun',
|
endfun
|
||||||
\ 'redraw',
|
redraw
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
func Test_balloon_eval_term()
|
func Test_balloon_eval_term()
|
||||||
" Use <Ignore> after <MouseMove> to return from vgetc() without removing
|
" Use <Ignore> after <MouseMove> to return from vgetc() without removing
|
||||||
|
@@ -93,23 +93,24 @@ func Test_appendbufline()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_appendbufline_no_E315()
|
func Test_appendbufline_no_E315()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'set stl=%f ls=2',
|
set stl=%f ls=2
|
||||||
\ 'new',
|
new
|
||||||
\ 'let buf = bufnr("%")',
|
let buf = bufnr("%")
|
||||||
\ 'quit',
|
quit
|
||||||
\ 'vsp',
|
vsp
|
||||||
\ 'exec "buffer" buf',
|
exec "buffer" buf
|
||||||
\ 'wincmd w',
|
wincmd w
|
||||||
\ 'call appendbufline(buf, 0, "abc")',
|
call appendbufline(buf, 0, "abc")
|
||||||
\ 'redraw',
|
redraw
|
||||||
\ 'while getbufline(buf, 1)[0] =~ "^\\s*$"',
|
while getbufline(buf, 1)[0] =~ "^\\s*$"
|
||||||
\ ' sleep 10m',
|
sleep 10m
|
||||||
\ 'endwhile',
|
endwhile
|
||||||
\ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")',
|
au VimLeavePre * call writefile([v:errmsg], "Xerror")
|
||||||
\ 'au VimLeavePre * call writefile(["done"], "Xdone")',
|
au VimLeavePre * call writefile(["done"], "Xdone")
|
||||||
\ 'qall!',
|
qall!
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if !RunVim([], after, '--clean')
|
if !RunVim([], after, '--clean')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@@ -18,25 +18,25 @@ endfunc
|
|||||||
func Test_cino_extern_c()
|
func Test_cino_extern_c()
|
||||||
" Test for cino-E
|
" Test for cino-E
|
||||||
|
|
||||||
let without_ind = [
|
let without_ind =<< trim [CODE]
|
||||||
\ '#ifdef __cplusplus',
|
#ifdef __cplusplus
|
||||||
\ 'extern "C" {',
|
extern "C" {
|
||||||
\ '#endif',
|
#endif
|
||||||
\ 'int func_a(void);',
|
int func_a(void);
|
||||||
\ '#ifdef __cplusplus',
|
#ifdef __cplusplus
|
||||||
\ '}',
|
}
|
||||||
\ '#endif'
|
#endif
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
let with_ind = [
|
let with_ind =<< trim [CODE]
|
||||||
\ '#ifdef __cplusplus',
|
#ifdef __cplusplus
|
||||||
\ 'extern "C" {',
|
extern "C" {
|
||||||
\ '#endif',
|
#endif
|
||||||
\ "\tint func_a(void);",
|
int func_a(void);
|
||||||
\ '#ifdef __cplusplus',
|
#ifdef __cplusplus
|
||||||
\ '}',
|
}
|
||||||
\ '#endif'
|
#endif
|
||||||
\ ]
|
[CODE]
|
||||||
new
|
new
|
||||||
setlocal cindent cinoptions=E0
|
setlocal cindent cinoptions=E0
|
||||||
call setline(1, without_ind)
|
call setline(1, without_ind)
|
||||||
@@ -89,16 +89,32 @@ func Test_cindent_expr()
|
|||||||
return v:lnum == 1 ? shiftwidth() : 0
|
return v:lnum == 1 ? shiftwidth() : 0
|
||||||
endfunc
|
endfunc
|
||||||
setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction()
|
setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction()
|
||||||
call setline(1, ['var_a = something()', 'b = something()'])
|
let testinput =<< trim [CODE]
|
||||||
|
var_a = something()
|
||||||
|
b = something()
|
||||||
|
[CODE]
|
||||||
|
call setline(1, testinput)
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
|
call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
|
||||||
call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$'))
|
let expected =<< trim [CODE]
|
||||||
|
var_a = something();
|
||||||
|
b = something();
|
||||||
|
[CODE]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
%d
|
%d
|
||||||
call setline(1, [' var_a = something()', ' b = something()'])
|
let testinput =<< trim [CODE]
|
||||||
|
var_a = something()
|
||||||
|
b = something()
|
||||||
|
[CODE]
|
||||||
|
call setline(1, testinput)
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
|
call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
|
||||||
call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$'))
|
let expected =<< trim [CODE]
|
||||||
|
var_a = something();
|
||||||
|
b = something()
|
||||||
|
[CODE]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -11,21 +11,23 @@ if !CanRunVimInTerminal()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
func Test_conceal_two_windows()
|
func Test_conceal_two_windows()
|
||||||
call writefile([
|
let code =<< trim [CODE]
|
||||||
\ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]',
|
let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
|
||||||
\ 'call setline(1, lines)',
|
call setline(1, lines)
|
||||||
\ 'syntax match test /|hidden|/ conceal',
|
syntax match test /|hidden|/ conceal
|
||||||
\ 'set conceallevel=2',
|
set conceallevel=2
|
||||||
\ 'set concealcursor=',
|
set concealcursor=
|
||||||
\ 'exe "normal /here\r"',
|
exe "normal /here\r"
|
||||||
\ 'new',
|
new
|
||||||
\ 'call setline(1, lines)',
|
call setline(1, lines)
|
||||||
\ 'call setline(4, "Second window")',
|
call setline(4, "Second window")
|
||||||
\ 'syntax match test /|hidden|/ conceal',
|
syntax match test /|hidden|/ conceal
|
||||||
\ 'set conceallevel=2',
|
set conceallevel=2
|
||||||
\ 'set concealcursor=nc',
|
set concealcursor=nc
|
||||||
\ 'exe "normal /here\r"',
|
exe "normal /here\r"
|
||||||
\ ], 'XTest_conceal')
|
[CODE]
|
||||||
|
|
||||||
|
call writefile(code, 'XTest_conceal')
|
||||||
" Check that cursor line is concealed
|
" Check that cursor line is concealed
|
||||||
let buf = RunVimInTerminal('-S XTest_conceal', {})
|
let buf = RunVimInTerminal('-S XTest_conceal', {})
|
||||||
call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
|
call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
|
||||||
@@ -113,14 +115,16 @@ endfunc
|
|||||||
func Test_conceal_with_cursorline()
|
func Test_conceal_with_cursorline()
|
||||||
" Opens a help window, where 'conceal' is set, switches to the other window
|
" Opens a help window, where 'conceal' is set, switches to the other window
|
||||||
" where 'cursorline' needs to be updated when the cursor moves.
|
" where 'cursorline' needs to be updated when the cursor moves.
|
||||||
call writefile([
|
let code =<< trim [CODE]
|
||||||
\ 'set cursorline',
|
set cursorline
|
||||||
\ 'normal othis is a test',
|
normal othis is a test
|
||||||
\ 'new',
|
new
|
||||||
\ 'call setline(1, ["one", "two", "three", "four", "five"])',
|
call setline(1, ["one", "two", "three", "four", "five"])
|
||||||
\ 'set ft=help',
|
set ft=help
|
||||||
\ 'normal M',
|
normal M
|
||||||
\ ], 'XTest_conceal_cul')
|
[CODE]
|
||||||
|
|
||||||
|
call writefile(code, 'XTest_conceal_cul')
|
||||||
let buf = RunVimInTerminal('-S XTest_conceal_cul', {})
|
let buf = RunVimInTerminal('-S XTest_conceal_cul', {})
|
||||||
call VerifyScreenDump(buf, 'Test_conceal_cul_01', {})
|
call VerifyScreenDump(buf, 'Test_conceal_cul_01', {})
|
||||||
|
|
||||||
|
@@ -3,52 +3,56 @@
|
|||||||
source shared.vim
|
source shared.vim
|
||||||
|
|
||||||
func Test_exiting()
|
func Test_exiting()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
|
au QuitPre * call writefile(["QuitPre"], "Xtestout")
|
||||||
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
|
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
|
||||||
\ 'quit',
|
quit
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
||||||
endif
|
endif
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
|
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
|
au QuitPre * call writefile(["QuitPre"], "Xtestout")
|
||||||
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
|
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
|
||||||
\ 'help',
|
help
|
||||||
\ 'wincmd w',
|
wincmd w
|
||||||
\ 'quit',
|
quit
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
||||||
endif
|
endif
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
|
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
|
au QuitPre * call writefile(["QuitPre"], "Xtestout")
|
||||||
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
|
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
|
||||||
\ 'split',
|
split
|
||||||
\ 'new',
|
new
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
|
||||||
endif
|
endif
|
||||||
call delete('Xtestout')
|
call delete('Xtestout')
|
||||||
|
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")',
|
au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
|
||||||
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
|
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
|
||||||
\ 'augroup nasty',
|
augroup nasty
|
||||||
\ ' au ExitPre * split',
|
au ExitPre * split
|
||||||
\ 'augroup END',
|
augroup END
|
||||||
\ 'quit',
|
quit
|
||||||
\ 'augroup nasty',
|
augroup nasty
|
||||||
\ ' au! ExitPre',
|
au! ExitPre
|
||||||
\ 'augroup END',
|
augroup END
|
||||||
\ 'quit',
|
quit
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
|
call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
|
||||||
\ readfile('Xtestout'))
|
\ readfile('Xtestout'))
|
||||||
|
@@ -513,17 +513,18 @@ func Test_fold_create_marker_in_C()
|
|||||||
set fdm=marker fdl=9
|
set fdm=marker fdl=9
|
||||||
set filetype=c
|
set filetype=c
|
||||||
|
|
||||||
let content = [
|
let content =<< trim [CODE]
|
||||||
\ '/*',
|
/*
|
||||||
\ ' * comment',
|
* comment
|
||||||
\ ' * ',
|
*
|
||||||
\ ' *',
|
*
|
||||||
\ ' */',
|
*/
|
||||||
\ 'int f(int* p) {',
|
int f(int* p) {
|
||||||
\ ' *p = 3;',
|
*p = 3;
|
||||||
\ ' return 0;',
|
return 0;
|
||||||
\ '}'
|
}
|
||||||
\]
|
[CODE]
|
||||||
|
|
||||||
for c in range(len(content) - 1)
|
for c in range(len(content) - 1)
|
||||||
bw!
|
bw!
|
||||||
call append(0, content)
|
call append(0, content)
|
||||||
|
@@ -15,262 +15,282 @@ func XTest_goto_decl(cmd, lines, line, col)
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD()
|
func Test_gD()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int x;',
|
int x;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 1, 5)
|
call XTest_goto_decl('gD', lines, 1, 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_too()
|
func Test_gD_too()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'Filename x;',
|
Filename x;
|
||||||
\ '',
|
|
||||||
\ 'int Filename',
|
int Filename
|
||||||
\ 'int func() {',
|
int func() {
|
||||||
\ ' Filename x;',
|
Filename x;
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 1, 10)
|
call XTest_goto_decl('gD', lines, 1, 10)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_comment()
|
func Test_gD_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ '/* int x; */',
|
/* int x; */
|
||||||
\ 'int x;',
|
int x;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 2, 5)
|
call XTest_goto_decl('gD', lines, 2, 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_inline_comment()
|
func Test_gD_inline_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int y /* , x */;',
|
int y /* , x */;
|
||||||
\ 'int x;',
|
int x;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 2, 5)
|
call XTest_goto_decl('gD', lines, 2, 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_string()
|
func Test_gD_string()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'char *s[] = "x";',
|
char *s[] = "x";
|
||||||
\ 'int x = 1;',
|
int x = 1;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 2, 5)
|
call XTest_goto_decl('gD', lines, 2, 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_string_same_line()
|
func Test_gD_string_same_line()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'char *s[] = "x", int x = 1;',
|
char *s[] = "x", int x = 1;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 1, 22)
|
call XTest_goto_decl('gD', lines, 1, 22)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gD_char()
|
func Test_gD_char()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ "char c = 'x';",
|
char c = 'x';
|
||||||
\ 'int x = 1;',
|
int x = 1;
|
||||||
\ '',
|
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gD', lines, 2, 5)
|
call XTest_goto_decl('gD', lines, 2, 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd()
|
func Test_gd()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int x;',
|
int x;
|
||||||
\ '',
|
|
||||||
\ 'int func(int x)',
|
int func(int x)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 3, 14)
|
call XTest_goto_decl('gd', lines, 3, 14)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_not_local()
|
func Test_gd_not_local()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func1(void)',
|
int func1(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ '',
|
|
||||||
\ 'int func2(int x)',
|
int func2(int x)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 3, 10)
|
call XTest_goto_decl('gd', lines, 3, 10)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_kr_style()
|
func Test_gd_kr_style()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(x)',
|
int func(x)
|
||||||
\ ' int x;',
|
int x;
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 2, 7)
|
call XTest_goto_decl('gd', lines, 2, 7)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_missing_braces()
|
func Test_gd_missing_braces()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'def func1(a)',
|
def func1(a)
|
||||||
\ ' a + 1',
|
a + 1
|
||||||
\ 'end',
|
end
|
||||||
\ '',
|
|
||||||
\ 'a = 1',
|
a = 1
|
||||||
\ '',
|
|
||||||
\ 'def func2()',
|
def func2()
|
||||||
\ ' return a',
|
return a
|
||||||
\ 'end',
|
end
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 1, 11)
|
call XTest_goto_decl('gd', lines, 1, 11)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_comment()
|
func Test_gd_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' /* int x; */',
|
/* int x; */
|
||||||
\ ' int x;',
|
int x;
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 4, 7)
|
call XTest_goto_decl('gd', lines, 4, 7)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_comment_in_string()
|
func Test_gd_comment_in_string()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' char *s ="//"; int x;',
|
char *s ="//"; int x;
|
||||||
\ ' int x;',
|
int x;
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 3, 22)
|
call XTest_goto_decl('gd', lines, 3, 22)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_string_in_comment()
|
func Test_gd_string_in_comment()
|
||||||
set comments=
|
set comments=
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' /* " */ int x;',
|
/* " */ int x;
|
||||||
\ ' int x;',
|
int x;
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 3, 15)
|
call XTest_goto_decl('gd', lines, 3, 15)
|
||||||
set comments&
|
set comments&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_inline_comment()
|
func Test_gd_inline_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(/* x is an int */ int x)',
|
int func(/* x is an int */ int x)
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 1, 32)
|
call XTest_goto_decl('gd', lines, 1, 32)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_inline_comment_only()
|
func Test_gd_inline_comment_only()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void) /* one lonely x */',
|
int func(void) /* one lonely x */
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 3, 10)
|
call XTest_goto_decl('gd', lines, 3, 10)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_inline_comment_body()
|
func Test_gd_inline_comment_body()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' int y /* , x */;',
|
int y /* , x */;
|
||||||
\ '',
|
|
||||||
\ ' for (/* int x = 0 */; y < 2; y++);',
|
for (/* int x = 0 */; y < 2; y++);
|
||||||
\ '',
|
|
||||||
\ ' int x = 0;',
|
int x = 0;
|
||||||
\ '',
|
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 7, 7)
|
call XTest_goto_decl('gd', lines, 7, 7)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_trailing_multiline_comment()
|
func Test_gd_trailing_multiline_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(int x) /* x is an int */',
|
int func(int x) /* x is an int */
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 1, 14)
|
call XTest_goto_decl('gd', lines, 1, 14)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_trailing_comment()
|
func Test_gd_trailing_comment()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(int x) // x is an int',
|
int func(int x) // x is an int
|
||||||
\ '{',
|
{
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 1, 14)
|
call XTest_goto_decl('gd', lines, 1, 14)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_string()
|
func Test_gd_string()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' char *s = "x";',
|
char *s = "x";
|
||||||
\ ' int x = 1;',
|
int x = 1;
|
||||||
\ '',
|
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
call XTest_goto_decl('gd', lines, 4, 7)
|
call XTest_goto_decl('gd', lines, 4, 7)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_string_only()
|
func Test_gd_string_only()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'int func(void)',
|
int func(void)
|
||||||
\ '{',
|
{
|
||||||
\ ' char *s = "x";',
|
char *s = "x";
|
||||||
\ '',
|
|
||||||
\ ' return x;',
|
return x;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('gd', lines, 5, 10)
|
call XTest_goto_decl('gd', lines, 5, 10)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -289,24 +309,25 @@ func Test_cursorline_keep_col()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_gd_local_block()
|
func Test_gd_local_block()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ ' int main()',
|
int main()
|
||||||
\ '{',
|
{
|
||||||
\ ' char *a = "NOT NULL";',
|
char *a = "NOT NULL";
|
||||||
\ ' if(a)',
|
if(a)
|
||||||
\ ' {',
|
{
|
||||||
\ ' char *b = a;',
|
char *b = a;
|
||||||
\ ' printf("%s\n", b);',
|
printf("%s\n", b);
|
||||||
\ ' }',
|
}
|
||||||
\ ' else',
|
else
|
||||||
\ ' {',
|
{
|
||||||
\ ' char *b = "NULL";',
|
char *b = "NULL";
|
||||||
\ ' return b;',
|
return b;
|
||||||
\ ' }',
|
}
|
||||||
\ '',
|
|
||||||
\ ' return 0;',
|
return 0;
|
||||||
\ '}',
|
}
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call XTest_goto_decl('1gd', lines, 11, 11)
|
call XTest_goto_decl('1gd', lines, 11, 11)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -98,30 +98,27 @@ ert
|
|||||||
normal `xyl$p
|
normal `xyl$p
|
||||||
normal `yy2l$p
|
normal `yy2l$p
|
||||||
|
|
||||||
normal G
|
|
||||||
let last_line = line('$')
|
|
||||||
|
|
||||||
" Expected output
|
" Expected output
|
||||||
append
|
let expected =<< trim [DATA]
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
zx cvn. as dfg? hjkl iop! ert ernop
|
zx cvn. as dfg? hjkl iop! ert ernop
|
||||||
zx cvn. as dfg? hjkl iop! ert ernop
|
zx cvn. as dfg? hjkl iop! ert ernop
|
||||||
.
|
[DATA]
|
||||||
|
|
||||||
call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
enew!
|
enew!
|
||||||
call append(0, text)
|
call append(0, text)
|
||||||
@@ -143,31 +140,28 @@ zx cvn. as dfg? hjkl iop! ert ernop
|
|||||||
normal `xyl$p
|
normal `xyl$p
|
||||||
normal `yy2l$p
|
normal `yy2l$p
|
||||||
|
|
||||||
normal G
|
|
||||||
let last_line = line('$')
|
|
||||||
|
|
||||||
" Expected output
|
" Expected output
|
||||||
append
|
let expected =<< trim [DATA]
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
zx cvn. as dfg? hjkl iop! ert enop
|
zx cvn. as dfg? hjkl iop! ert enop
|
||||||
zx cvn. as dfg? hjkl iop! ert ernop
|
zx cvn. as dfg? hjkl iop! ert ernop
|
||||||
|
|
||||||
.
|
[DATA]
|
||||||
|
|
||||||
call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
enew!
|
enew!
|
||||||
call append(0, text)
|
call append(0, text)
|
||||||
@@ -180,29 +174,26 @@ zx cvn. as dfg? hjkl iop! ert ernop
|
|||||||
normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ
|
normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ
|
||||||
normal j4Jy3l$pjdG
|
normal j4Jy3l$pjdG
|
||||||
|
|
||||||
normal G
|
|
||||||
let last_line = line('$')
|
|
||||||
|
|
||||||
" Expected output
|
" Expected output
|
||||||
append
|
let expected =<< trim [DATA]
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf. asdf
|
asdfasdf. asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
asdfasdf asdf
|
asdfasdf asdf
|
||||||
zx cvn. as dfg? hjkl iop! ert a
|
zx cvn. as dfg? hjkl iop! ert a
|
||||||
.
|
[DATA]
|
||||||
|
|
||||||
call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
set nocompatible
|
set nocompatible
|
||||||
set cpoptions&vim
|
set cpoptions&vim
|
||||||
@@ -262,11 +253,8 @@ action();
|
|||||||
.,+2join
|
.,+2join
|
||||||
exe "normal jj3J\<CR>"
|
exe "normal jj3J\<CR>"
|
||||||
|
|
||||||
normal G
|
|
||||||
let last_line = line('$')
|
|
||||||
|
|
||||||
" Expected output
|
" Expected output
|
||||||
append
|
let expected =<< trim [CODE]
|
||||||
{
|
{
|
||||||
/* Make sure the previous comment leader is not removed. */
|
/* Make sure the previous comment leader is not removed. */
|
||||||
/* Make sure the previous comment leader is not removed. */
|
/* Make sure the previous comment leader is not removed. */
|
||||||
@@ -279,9 +267,9 @@ action();
|
|||||||
if (condition) // Remove the next comment leader! OK, I will.
|
if (condition) // Remove the next comment leader! OK, I will.
|
||||||
action();
|
action();
|
||||||
}
|
}
|
||||||
.
|
[CODE]
|
||||||
|
|
||||||
call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
set comments&vim
|
set comments&vim
|
||||||
set joinspaces&vim
|
set joinspaces&vim
|
||||||
@@ -389,11 +377,8 @@ int i = 7 /* foo *// 3
|
|||||||
exe "normal j6J\<CR>"
|
exe "normal j6J\<CR>"
|
||||||
exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>"
|
exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>"
|
||||||
|
|
||||||
normal G
|
|
||||||
let last_line = line('$')
|
|
||||||
|
|
||||||
" Expected output
|
" Expected output
|
||||||
append
|
let expected =<< [CODE]
|
||||||
{
|
{
|
||||||
/* Make sure the previous comment leader is not removed. */
|
/* Make sure the previous comment leader is not removed. */
|
||||||
/* Make sure the previous comment leader is not removed. */
|
/* Make sure the previous comment leader is not removed. */
|
||||||
@@ -416,8 +401,8 @@ int i = 7 /* foo *// 3 // comment
|
|||||||
|
|
||||||
Some code!// Make sure backspacing does not remove this comment leader.
|
Some code!// Make sure backspacing does not remove this comment leader.
|
||||||
}
|
}
|
||||||
.
|
[CODE]
|
||||||
|
|
||||||
call assert_equal(getline(last_line + 1, '$'), getline(1, last_line))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
close!
|
close!
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -65,34 +65,35 @@ func Test_mksession_utf8()
|
|||||||
call wincol()
|
call wincol()
|
||||||
mksession! test_mks.out
|
mksession! test_mks.out
|
||||||
let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
|
let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
|
||||||
let expected = [
|
let expected =<< trim [DATA]
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ 'normal! 08|',
|
normal! 08|
|
||||||
\ 'normal! 08|',
|
normal! 08|
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ 'normal! 016|',
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 8 . '|'
|
||||||
\ " normal! 08|",
|
normal! 08|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 8 . '|'
|
||||||
\ " normal! 08|",
|
normal! 08|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|",
|
normal! 016|
|
||||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
exe 'normal! ' . s:c . '|zs' . 16 . '|'
|
||||||
\ " normal! 016|"
|
normal! 016|
|
||||||
\ ]
|
[DATA]
|
||||||
|
|
||||||
call assert_equal(expected, li)
|
call assert_equal(expected, li)
|
||||||
tabclose!
|
tabclose!
|
||||||
|
|
||||||
|
@@ -1555,73 +1555,158 @@ endfunc
|
|||||||
|
|
||||||
fun! Test_normal29_brace()
|
fun! Test_normal29_brace()
|
||||||
" basic test for { and } movements
|
" basic test for { and } movements
|
||||||
let text= ['A paragraph begins after each empty line, and also at each of a set of',
|
let text =<< trim [DATA]
|
||||||
\ 'paragraph macros, specified by the pairs of characters in the ''paragraphs''',
|
A paragraph begins after each empty line, and also at each of a set of
|
||||||
\ 'option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to',
|
paragraph macros, specified by the pairs of characters in the 'paragraphs'
|
||||||
\ 'the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in',
|
option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to
|
||||||
\ 'the first column). A section boundary is also a paragraph boundary.',
|
the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in
|
||||||
\ 'Note that a blank line (only containing white space) is NOT a paragraph',
|
the first column). A section boundary is also a paragraph boundary.
|
||||||
\ 'boundary.',
|
Note that a blank line (only containing white space) is NOT a paragraph
|
||||||
\ '',
|
boundary.
|
||||||
\ '',
|
|
||||||
\ 'Also note that this does not include a ''{'' or ''}'' in the first column. When',
|
|
||||||
\ 'the ''{'' flag is in ''cpoptions'' then ''{'' in the first column is used as a',
|
Also note that this does not include a '{' or '}' in the first column. When
|
||||||
\ 'paragraph boundary |posix|.',
|
the '{' flag is in 'cpoptions' then '{' in the first column is used as a
|
||||||
\ '{',
|
paragraph boundary |posix|.
|
||||||
\ 'This is no paragraph',
|
{
|
||||||
\ 'unless the ''{'' is set',
|
This is no paragraph
|
||||||
\ 'in ''cpoptions''',
|
unless the '{' is set
|
||||||
\ '}',
|
in 'cpoptions'
|
||||||
\ '.IP',
|
}
|
||||||
\ 'The nroff macros IP separates a paragraph',
|
.IP
|
||||||
\ 'That means, it must be a ''.''',
|
The nroff macros IP separates a paragraph
|
||||||
\ 'followed by IP',
|
That means, it must be a '.'
|
||||||
\ '.LPIt does not matter, if afterwards some',
|
followed by IP
|
||||||
\ 'more characters follow.',
|
.LPIt does not matter, if afterwards some
|
||||||
\ '.SHAlso section boundaries from the nroff',
|
more characters follow.
|
||||||
\ 'macros terminate a paragraph. That means',
|
.SHAlso section boundaries from the nroff
|
||||||
\ 'a character like this:',
|
macros terminate a paragraph. That means
|
||||||
\ '.NH',
|
a character like this:
|
||||||
\ 'End of text here']
|
.NH
|
||||||
|
End of text here
|
||||||
|
[DATA]
|
||||||
|
|
||||||
new
|
new
|
||||||
call append(0, text)
|
call append(0, text)
|
||||||
1
|
1
|
||||||
norm! 0d2}
|
norm! 0d2}
|
||||||
call assert_equal(['.IP',
|
|
||||||
\ 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', 'followed by IP',
|
let expected =<< trim [DATA]
|
||||||
\ '.LPIt does not matter, if afterwards some', 'more characters follow.', '.SHAlso section boundaries from the nroff',
|
.IP
|
||||||
\ 'macros terminate a paragraph. That means', 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$'))
|
The nroff macros IP separates a paragraph
|
||||||
|
That means, it must be a '.'
|
||||||
|
followed by IP
|
||||||
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
.SHAlso section boundaries from the nroff
|
||||||
|
macros terminate a paragraph. That means
|
||||||
|
a character like this:
|
||||||
|
.NH
|
||||||
|
End of text here
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
norm! 0d}
|
norm! 0d}
|
||||||
call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.',
|
|
||||||
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means',
|
let expected =<< trim [DATA]
|
||||||
\ 'a character like this:', '.NH', 'End of text here', ''], getline(1, '$'))
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
.SHAlso section boundaries from the nroff
|
||||||
|
macros terminate a paragraph. That means
|
||||||
|
a character like this:
|
||||||
|
.NH
|
||||||
|
End of text here
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
$
|
$
|
||||||
norm! d{
|
norm! d{
|
||||||
call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.',
|
|
||||||
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', 'a character like this:', ''], getline(1, '$'))
|
let expected =<< trim [DATA]
|
||||||
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
.SHAlso section boundaries from the nroff
|
||||||
|
macros terminate a paragraph. That means
|
||||||
|
a character like this:
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
norm! d{
|
norm! d{
|
||||||
call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', ''], getline(1,'$'))
|
|
||||||
|
let expected =<< trim [DATA]
|
||||||
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
" Test with { in cpooptions
|
" Test with { in cpooptions
|
||||||
%d
|
%d
|
||||||
call append(0, text)
|
call append(0, text)
|
||||||
set cpo+={
|
set cpo+={
|
||||||
1
|
1
|
||||||
norm! 0d2}
|
norm! 0d2}
|
||||||
call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}',
|
|
||||||
\ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''',
|
let expected =<< trim [DATA]
|
||||||
\ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.',
|
{
|
||||||
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means',
|
This is no paragraph
|
||||||
\ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$'))
|
unless the '{' is set
|
||||||
|
in 'cpoptions'
|
||||||
|
}
|
||||||
|
.IP
|
||||||
|
The nroff macros IP separates a paragraph
|
||||||
|
That means, it must be a '.'
|
||||||
|
followed by IP
|
||||||
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
.SHAlso section boundaries from the nroff
|
||||||
|
macros terminate a paragraph. That means
|
||||||
|
a character like this:
|
||||||
|
.NH
|
||||||
|
End of text here
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
$
|
$
|
||||||
norm! d}
|
norm! d}
|
||||||
call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}',
|
|
||||||
\ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''',
|
let expected =<< trim [DATA]
|
||||||
\ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.',
|
{
|
||||||
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means',
|
This is no paragraph
|
||||||
\ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$'))
|
unless the '{' is set
|
||||||
|
in 'cpoptions'
|
||||||
|
}
|
||||||
|
.IP
|
||||||
|
The nroff macros IP separates a paragraph
|
||||||
|
That means, it must be a '.'
|
||||||
|
followed by IP
|
||||||
|
.LPIt does not matter, if afterwards some
|
||||||
|
more characters follow.
|
||||||
|
.SHAlso section boundaries from the nroff
|
||||||
|
macros terminate a paragraph. That means
|
||||||
|
a character like this:
|
||||||
|
.NH
|
||||||
|
End of text here
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
norm! gg}
|
norm! gg}
|
||||||
norm! d5}
|
norm! d5}
|
||||||
call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$'))
|
|
||||||
|
let expected =<< trim [DATA]
|
||||||
|
{
|
||||||
|
This is no paragraph
|
||||||
|
unless the '{' is set
|
||||||
|
in 'cpoptions'
|
||||||
|
}
|
||||||
|
|
||||||
|
[DATA]
|
||||||
|
call assert_equal(expected, getline(1, '$'))
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
set cpo-={
|
set cpo-={
|
||||||
|
@@ -4,34 +4,34 @@ if !has('profile')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
func Test_profile_func()
|
func Test_profile_func()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'profile start Xprofile_func.log',
|
profile start Xprofile_func.log
|
||||||
\ 'profile func Foo*"',
|
profile func Foo*
|
||||||
\ "func! Foo1()",
|
func! Foo1()
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo2()",
|
func! Foo2()
|
||||||
\ " let l:count = 100",
|
let l:count = 100
|
||||||
\ " while l:count > 0",
|
while l:count > 0
|
||||||
\ " let l:count = l:count - 1",
|
let l:count = l:count - 1
|
||||||
\ " endwhile",
|
endwhile
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo3()",
|
func! Foo3()
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Bar()",
|
func! Bar()
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "call Foo1()",
|
call Foo1()
|
||||||
\ "call Foo1()",
|
call Foo1()
|
||||||
\ "profile pause",
|
profile pause
|
||||||
\ "call Foo1()",
|
call Foo1()
|
||||||
\ "profile continue",
|
profile continue
|
||||||
\ "call Foo2()",
|
call Foo2()
|
||||||
\ "call Foo3()",
|
call Foo3()
|
||||||
\ "call Bar()",
|
call Bar()
|
||||||
\ "if !v:profiling",
|
if !v:profiling
|
||||||
\ " delfunc Foo2",
|
delfunc Foo2
|
||||||
\ "endif",
|
endif
|
||||||
\ "delfunc Foo3",
|
delfunc Foo3
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call writefile(lines, 'Xprofile_func.vim')
|
call writefile(lines, 'Xprofile_func.vim')
|
||||||
call system(v:progpath
|
call system(v:progpath
|
||||||
@@ -86,38 +86,38 @@ func Test_profile_func()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_profile_func_with_ifelse()
|
func Test_profile_func_with_ifelse()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ "func! Foo1()",
|
func! Foo1()
|
||||||
\ " if 1",
|
if 1
|
||||||
\ " let x = 0",
|
let x = 0
|
||||||
\ " elseif 1",
|
elseif 1
|
||||||
\ " let x = 1",
|
let x = 1
|
||||||
\ " else",
|
else
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endif",
|
endif
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo2()",
|
func! Foo2()
|
||||||
\ " if 0",
|
if 0
|
||||||
\ " let x = 0",
|
let x = 0
|
||||||
\ " elseif 1",
|
elseif 1
|
||||||
\ " let x = 1",
|
let x = 1
|
||||||
\ " else",
|
else
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endif",
|
endif
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo3()",
|
func! Foo3()
|
||||||
\ " if 0",
|
if 0
|
||||||
\ " let x = 0",
|
let x = 0
|
||||||
\ " elseif 0",
|
elseif 0
|
||||||
\ " let x = 1",
|
let x = 1
|
||||||
\ " else",
|
else
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endif",
|
endif
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "call Foo1()",
|
call Foo1()
|
||||||
\ "call Foo2()",
|
call Foo2()
|
||||||
\ "call Foo3()",
|
call Foo3()
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call writefile(lines, 'Xprofile_func.vim')
|
call writefile(lines, 'Xprofile_func.vim')
|
||||||
call system(v:progpath
|
call system(v:progpath
|
||||||
@@ -196,41 +196,41 @@ func Test_profile_func_with_ifelse()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_profile_func_with_trycatch()
|
func Test_profile_func_with_trycatch()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ "func! Foo1()",
|
func! Foo1()
|
||||||
\ " try",
|
try
|
||||||
\ " let x = 0",
|
let x = 0
|
||||||
\ " catch",
|
catch
|
||||||
\ " let x = 1",
|
let x = 1
|
||||||
\ " finally",
|
finally
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endtry",
|
endtry
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo2()",
|
func! Foo2()
|
||||||
\ " try",
|
try
|
||||||
\ " throw 0",
|
throw 0
|
||||||
\ " catch",
|
catch
|
||||||
\ " let x = 1",
|
let x = 1
|
||||||
\ " finally",
|
finally
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endtry",
|
endtry
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "func! Foo3()",
|
func! Foo3()
|
||||||
\ " try",
|
try
|
||||||
\ " throw 0",
|
throw 0
|
||||||
\ " catch",
|
catch
|
||||||
\ " throw 1",
|
throw 1
|
||||||
\ " finally",
|
finally
|
||||||
\ " let x = 2",
|
let x = 2
|
||||||
\ " endtry",
|
endtry
|
||||||
\ "endfunc",
|
endfunc
|
||||||
\ "call Foo1()",
|
call Foo1()
|
||||||
\ "call Foo2()",
|
call Foo2()
|
||||||
\ "try",
|
try
|
||||||
\ " call Foo3()",
|
call Foo3()
|
||||||
\ "catch",
|
catch
|
||||||
\ "endtry",
|
endtry
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call writefile(lines, 'Xprofile_func.vim')
|
call writefile(lines, 'Xprofile_func.vim')
|
||||||
call system(v:progpath
|
call system(v:progpath
|
||||||
@@ -309,15 +309,15 @@ func Test_profile_func_with_trycatch()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_profile_file()
|
func Test_profile_file()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'func! Foo()',
|
func! Foo()
|
||||||
\ 'endfunc',
|
endfunc
|
||||||
\ 'for i in range(10)',
|
for i in range(10)
|
||||||
\ ' " a comment',
|
" a comment
|
||||||
\ ' call Foo()',
|
call Foo()
|
||||||
\ 'endfor',
|
endfor
|
||||||
\ 'call Foo()',
|
call Foo()
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
call writefile(lines, 'Xprofile_file.vim')
|
call writefile(lines, 'Xprofile_file.vim')
|
||||||
call system(v:progpath
|
call system(v:progpath
|
||||||
@@ -448,26 +448,27 @@ func Test_profile_truncate_mbyte()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_profdel_func()
|
func Test_profdel_func()
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'profile start Xprofile_file.log',
|
profile start Xprofile_file.log
|
||||||
\ 'func! Foo1()',
|
func! Foo1()
|
||||||
\ 'endfunc',
|
endfunc
|
||||||
\ 'func! Foo2()',
|
func! Foo2()
|
||||||
\ 'endfunc',
|
endfunc
|
||||||
\ 'func! Foo3()',
|
func! Foo3()
|
||||||
\ 'endfunc',
|
endfunc
|
||||||
\ '',
|
|
||||||
\ 'profile func Foo1',
|
profile func Foo1
|
||||||
\ 'profile func Foo2',
|
profile func Foo2
|
||||||
\ 'call Foo1()',
|
call Foo1()
|
||||||
\ 'call Foo2()',
|
call Foo2()
|
||||||
\ '',
|
|
||||||
\ 'profile func Foo3',
|
profile func Foo3
|
||||||
\ 'profdel func Foo2',
|
profdel func Foo2
|
||||||
\ 'profdel func Foo3',
|
profdel func Foo3
|
||||||
\ 'call Foo1()',
|
call Foo1()
|
||||||
\ 'call Foo2()',
|
call Foo2()
|
||||||
\ 'call Foo3()' ]
|
call Foo3()
|
||||||
|
[CODE]
|
||||||
call writefile(lines, 'Xprofile_file.vim')
|
call writefile(lines, 'Xprofile_file.vim')
|
||||||
call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
|
call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
|
||||||
call assert_equal(0, v:shell_error)
|
call assert_equal(0, v:shell_error)
|
||||||
@@ -494,14 +495,15 @@ endfunc
|
|||||||
func Test_profdel_star()
|
func Test_profdel_star()
|
||||||
" Foo() is invoked once before and once after 'profdel *'.
|
" Foo() is invoked once before and once after 'profdel *'.
|
||||||
" So profiling should report it only once.
|
" So profiling should report it only once.
|
||||||
let lines = [
|
let lines =<< trim [CODE]
|
||||||
\ 'profile start Xprofile_file.log',
|
profile start Xprofile_file.log
|
||||||
\ 'func! Foo()',
|
func! Foo()
|
||||||
\ 'endfunc',
|
endfunc
|
||||||
\ 'profile func Foo',
|
profile func Foo
|
||||||
\ 'call Foo()',
|
call Foo()
|
||||||
\ 'profdel *',
|
profdel *
|
||||||
\ 'call Foo()' ]
|
call Foo()
|
||||||
|
[CODE]
|
||||||
call writefile(lines, 'Xprofile_file.vim')
|
call writefile(lines, 'Xprofile_file.vim')
|
||||||
call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
|
call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
|
||||||
call assert_equal(0, v:shell_error)
|
call assert_equal(0, v:shell_error)
|
||||||
|
@@ -818,68 +818,68 @@ func Test_efm1()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l = [
|
let l =<< trim [DATA]
|
||||||
\ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.',
|
"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
|
||||||
\ '"Xtestfile", line 6 col 19; this is an error',
|
"Xtestfile", line 6 col 19; this is an error
|
||||||
\ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c',
|
gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c
|
||||||
\ 'Xtestfile:9: parse error before `asd''',
|
Xtestfile:9: parse error before `asd'
|
||||||
\ 'make: *** [vim] Error 1',
|
make: *** [vim] Error 1
|
||||||
\ 'in file "Xtestfile" linenr 10: there is an error',
|
in file "Xtestfile" linenr 10: there is an error
|
||||||
\ '',
|
|
||||||
\ '2 returned',
|
2 returned
|
||||||
\ '"Xtestfile", line 11 col 1; this is an error',
|
"Xtestfile", line 11 col 1; this is an error
|
||||||
\ '"Xtestfile", line 12 col 2; this is another error',
|
"Xtestfile", line 12 col 2; this is another error
|
||||||
\ '"Xtestfile", line 14:10; this is an error in column 10',
|
"Xtestfile", line 14:10; this is an error in column 10
|
||||||
\ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time',
|
=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time
|
||||||
\ '"Xtestfile", linenr 16: yet another problem',
|
"Xtestfile", linenr 16: yet another problem
|
||||||
\ 'Error in "Xtestfile" at line 17:',
|
Error in "Xtestfile" at line 17:
|
||||||
\ 'x should be a dot',
|
x should be a dot
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
|
||||||
\ ' ^',
|
^
|
||||||
\ 'Error in "Xtestfile" at line 18:',
|
Error in "Xtestfile" at line 18:
|
||||||
\ 'x should be a dot',
|
x should be a dot
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
|
||||||
\ '.............^',
|
.............^
|
||||||
\ 'Error in "Xtestfile" at line 19:',
|
Error in "Xtestfile" at line 19:
|
||||||
\ 'x should be a dot',
|
x should be a dot
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
|
||||||
\ '--------------^',
|
--------------^
|
||||||
\ 'Error in "Xtestfile" at line 20:',
|
Error in "Xtestfile" at line 20:
|
||||||
\ 'x should be a dot',
|
x should be a dot
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
|
||||||
\ ' ^',
|
^
|
||||||
\ '',
|
|
||||||
\ 'Does anyone know what is the problem and how to correction it?',
|
Does anyone know what is the problem and how to correction it?
|
||||||
\ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?',
|
"Xtestfile", line 21 col 9: What is the title of the quickfix window?
|
||||||
\ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?'
|
"Xtestfile", line 22 col 9: What is the title of the quickfix window?
|
||||||
\ ]
|
[DATA]
|
||||||
|
|
||||||
call writefile(l, 'Xerrorfile1')
|
call writefile(l, 'Xerrorfile1')
|
||||||
call writefile(l[:-2], 'Xerrorfile2')
|
call writefile(l[:-2], 'Xerrorfile2')
|
||||||
|
|
||||||
let m = [
|
let m =<< trim [DATA]
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21',
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22'
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
|
||||||
\ ]
|
[DATA]
|
||||||
call writefile(m, 'Xtestfile')
|
call writefile(m, 'Xtestfile')
|
||||||
|
|
||||||
let save_efm = &efm
|
let save_efm = &efm
|
||||||
@@ -1092,21 +1092,23 @@ func Test_efm2()
|
|||||||
call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l)
|
call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l)
|
||||||
|
|
||||||
" Test for %P, %Q and %t format specifiers
|
" Test for %P, %Q and %t format specifiers
|
||||||
let lines=["[Xtestfile1]",
|
let lines =<< trim [DATA]
|
||||||
\ "(1,17) error: ';' missing",
|
[Xtestfile1]
|
||||||
\ "(21,2) warning: variable 'z' not defined",
|
(1,17) error: ';' missing
|
||||||
\ "(67,3) error: end of file found before string ended",
|
(21,2) warning: variable 'z' not defined
|
||||||
\ "--",
|
(67,3) error: end of file found before string ended
|
||||||
\ "",
|
--
|
||||||
\ "[Xtestfile2]",
|
|
||||||
\ "--",
|
[Xtestfile2]
|
||||||
\ "",
|
--
|
||||||
\ "[Xtestfile3]",
|
|
||||||
\ "NEW compiler v1.1",
|
[Xtestfile3]
|
||||||
\ "(2,2) warning: variable 'x' not defined",
|
NEW compiler v1.1
|
||||||
\ "(67,3) warning: 's' already defined",
|
(2,2) warning: variable 'x' not defined
|
||||||
\ "--"
|
(67,3) warning: 's' already defined
|
||||||
\]
|
--
|
||||||
|
[DATA]
|
||||||
|
|
||||||
set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r
|
set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r
|
||||||
" To exercise the push/pop file functionality in quickfix, the test files
|
" To exercise the push/pop file functionality in quickfix, the test files
|
||||||
" need to be created.
|
" need to be created.
|
||||||
@@ -1128,11 +1130,13 @@ func Test_efm2()
|
|||||||
call delete('Xtestfile3')
|
call delete('Xtestfile3')
|
||||||
|
|
||||||
" Tests for %E, %C and %Z format specifiers
|
" Tests for %E, %C and %Z format specifiers
|
||||||
let lines = ["Error 275",
|
let lines =<< trim [DATA]
|
||||||
\ "line 42",
|
Error 275
|
||||||
\ "column 3",
|
line 42
|
||||||
\ "' ' expected after '--'"
|
column 3
|
||||||
\]
|
' ' expected after '--'
|
||||||
|
[DATA]
|
||||||
|
|
||||||
set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m
|
set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m
|
||||||
cgetexpr lines
|
cgetexpr lines
|
||||||
let l = getqflist()
|
let l = getqflist()
|
||||||
@@ -1143,9 +1147,11 @@ func Test_efm2()
|
|||||||
call assert_equal("\n' ' expected after '--'", l[0].text)
|
call assert_equal("\n' ' expected after '--'", l[0].text)
|
||||||
|
|
||||||
" Test for %>
|
" Test for %>
|
||||||
let lines = ["Error in line 147 of foo.c:",
|
let lines =<< trim [DATA]
|
||||||
\"unknown variable 'i'"
|
Error in line 147 of foo.c:
|
||||||
\]
|
unknown variable 'i'
|
||||||
|
[DATA]
|
||||||
|
|
||||||
set efm=unknown\ variable\ %m,%E%>Error\ in\ line\ %l\ of\ %f:,%Z%m
|
set efm=unknown\ variable\ %m,%E%>Error\ in\ line\ %l\ of\ %f:,%Z%m
|
||||||
cgetexpr lines
|
cgetexpr lines
|
||||||
let l = getqflist()
|
let l = getqflist()
|
||||||
@@ -1154,21 +1160,22 @@ func Test_efm2()
|
|||||||
call assert_equal("\nunknown variable 'i'", l[0].text)
|
call assert_equal("\nunknown variable 'i'", l[0].text)
|
||||||
|
|
||||||
" Test for %A, %C and other formats
|
" Test for %A, %C and other formats
|
||||||
let lines = [
|
let lines =<< trim [DATA]
|
||||||
\"==============================================================",
|
==============================================================
|
||||||
\"FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)",
|
FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)
|
||||||
\"--------------------------------------------------------------",
|
--------------------------------------------------------------
|
||||||
\"Traceback (most recent call last):",
|
Traceback (most recent call last):
|
||||||
\' File "unittests/dbfacadeTest.py", line 89, in testFoo',
|
File "unittests/dbfacadeTest.py", line 89, in testFoo
|
||||||
\" self.assertEquals(34, dtid)",
|
self.assertEquals(34, dtid)
|
||||||
\' File "/usr/lib/python2.2/unittest.py", line 286, in',
|
File "/usr/lib/python2.2/unittest.py", line 286, in
|
||||||
\" failUnlessEqual",
|
failUnlessEqual
|
||||||
\" raise self.failureException, \\",
|
raise self.failureException, \\
|
||||||
\"AssertionError: 34 != 33",
|
AssertionError: 34 != 33
|
||||||
\"",
|
|
||||||
\"--------------------------------------------------------------",
|
--------------------------------------------------------------
|
||||||
\"Ran 27 tests in 0.063s"
|
Ran 27 tests in 0.063s
|
||||||
\]
|
[DATA]
|
||||||
|
|
||||||
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
|
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
|
||||||
cgetexpr lines
|
cgetexpr lines
|
||||||
let l = getqflist()
|
let l = getqflist()
|
||||||
|
@@ -19,25 +19,27 @@ func Test_after_comes_later()
|
|||||||
if !has('packages')
|
if !has('packages')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let before = [
|
let before =<< trim [CODE]
|
||||||
\ 'set nocp viminfo+=nviminfo',
|
set nocp viminfo+=nviminfo
|
||||||
\ 'set guioptions+=M',
|
set guioptions+=M
|
||||||
\ 'let $HOME = "/does/not/exist"',
|
let $HOME = "/does/not/exist"
|
||||||
\ 'set loadplugins',
|
set loadplugins
|
||||||
\ 'set rtp=Xhere,Xafter,Xanother',
|
set rtp=Xhere,Xafter,Xanother
|
||||||
\ 'set packpath=Xhere,Xafter',
|
set packpath=Xhere,Xafter
|
||||||
\ 'set nomore',
|
set nomore
|
||||||
\ 'let g:sequence = ""',
|
let g:sequence = ""
|
||||||
\ ]
|
[CODE]
|
||||||
let after = [
|
|
||||||
\ 'redir! > Xtestout',
|
let after =<< trim [CODE]
|
||||||
\ 'scriptnames',
|
redir! > Xtestout
|
||||||
\ 'redir END',
|
scriptnames
|
||||||
\ 'redir! > Xsequence',
|
redir END
|
||||||
\ 'echo g:sequence',
|
redir! > Xsequence
|
||||||
\ 'redir END',
|
echo g:sequence
|
||||||
\ 'quit',
|
redir END
|
||||||
\ ]
|
quit
|
||||||
|
[CODE]
|
||||||
|
|
||||||
call mkdir('Xhere/plugin', 'p')
|
call mkdir('Xhere/plugin', 'p')
|
||||||
call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim')
|
call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim')
|
||||||
call mkdir('Xanother/plugin', 'p')
|
call mkdir('Xanother/plugin', 'p')
|
||||||
@@ -76,15 +78,16 @@ func Test_pack_in_rtp_when_plugins_run()
|
|||||||
if !has('packages')
|
if !has('packages')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let before = [
|
let before =<< trim [CODE]
|
||||||
\ 'set nocp viminfo+=nviminfo',
|
set nocp viminfo+=nviminfo
|
||||||
\ 'set guioptions+=M',
|
set guioptions+=M
|
||||||
\ 'let $HOME = "/does/not/exist"',
|
let $HOME = "/does/not/exist"
|
||||||
\ 'set loadplugins',
|
set loadplugins
|
||||||
\ 'set rtp=Xhere',
|
set rtp=Xhere
|
||||||
\ 'set packpath=Xhere',
|
set packpath=Xhere
|
||||||
\ 'set nomore',
|
set nomore
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
let after = [
|
let after = [
|
||||||
\ 'quit',
|
\ 'quit',
|
||||||
\ ]
|
\ ]
|
||||||
@@ -131,11 +134,12 @@ func Test_help_arg()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_compatible_args()
|
func Test_compatible_args()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([string(&compatible)], "Xtestout")',
|
call writefile([string(&compatible)], "Xtestout")
|
||||||
\ 'set viminfo+=nviminfo',
|
set viminfo+=nviminfo
|
||||||
\ 'quit',
|
quit
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '-C')
|
if RunVim([], after, '-C')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal('1', lines[0])
|
call assert_equal('1', lines[0])
|
||||||
@@ -152,14 +156,15 @@ endfunc
|
|||||||
" Test the -o[N] and -O[N] arguments to open N windows split
|
" Test the -o[N] and -O[N] arguments to open N windows split
|
||||||
" horizontally or vertically.
|
" horizontally or vertically.
|
||||||
func Test_o_arg()
|
func Test_o_arg()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([winnr("$"),
|
call writefile([winnr("$"),
|
||||||
\ winheight(1), winheight(2), &lines,
|
\ winheight(1), winheight(2), &lines,
|
||||||
\ winwidth(1), winwidth(2), &columns,
|
\ winwidth(1), winwidth(2), &columns,
|
||||||
\ bufname(winbufnr(1)), bufname(winbufnr(2))],
|
\ bufname(winbufnr(1)), bufname(winbufnr(2))],
|
||||||
\ "Xtestout")',
|
\ "Xtestout")
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '-o2')
|
if RunVim([], after, '-o2')
|
||||||
" Open 2 windows split horizontally. Expect:
|
" Open 2 windows split horizontally. Expect:
|
||||||
" - 2 windows
|
" - 2 windows
|
||||||
@@ -228,10 +233,11 @@ endfunc
|
|||||||
|
|
||||||
" Test the -p[N] argument to open N tabpages.
|
" Test the -p[N] argument to open N tabpages.
|
||||||
func Test_p_arg()
|
func Test_p_arg()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
|
call writefile(split(execute("tabs"), "\n"), "Xtestout")
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '-p2')
|
if RunVim([], after, '-p2')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(4, len(lines))
|
call assert_equal(4, len(lines))
|
||||||
@@ -273,12 +279,12 @@ endfunc
|
|||||||
" Test the '-q [errorfile]' argument.
|
" Test the '-q [errorfile]' argument.
|
||||||
func Test_q_arg()
|
func Test_q_arg()
|
||||||
let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
|
let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")',
|
call writefile([&errorfile, string(getpos("."))], "Xtestout")
|
||||||
\ 'copen',
|
copen
|
||||||
\ 'w >> Xtestout',
|
w >> Xtestout
|
||||||
\ 'qall'
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
" Test with default argument '-q'.
|
" Test with default argument '-q'.
|
||||||
call assert_equal('errors.err', &errorfile)
|
call assert_equal('errors.err', &errorfile)
|
||||||
@@ -335,10 +341,11 @@ endfunc
|
|||||||
" -M resets 'modifiable' and 'write'
|
" -M resets 'modifiable' and 'write'
|
||||||
" -R sets 'readonly'
|
" -R sets 'readonly'
|
||||||
func Test_m_M_R()
|
func Test_m_M_R()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")',
|
call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['1', '1', '0', '200'], lines)
|
call assert_equal(['1', '1', '0', '200'], lines)
|
||||||
@@ -361,10 +368,11 @@ endfunc
|
|||||||
|
|
||||||
" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
|
" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
|
||||||
func Test_A_F_H_arg()
|
func Test_A_F_H_arg()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
|
call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
" Use silent Ex mode to avoid the hit-Enter prompt for the warning that
|
" Use silent Ex mode to avoid the hit-Enter prompt for the warning that
|
||||||
" 'encoding' is not utf-8.
|
" 'encoding' is not utf-8.
|
||||||
if has('arabic') && &encoding == 'utf-8' && RunVim([], after, '-e -s -A')
|
if has('arabic') && &encoding == 'utf-8' && RunVim([], after, '-e -s -A')
|
||||||
@@ -481,10 +489,11 @@ func Test_invalid_args()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_file_args()
|
func Test_file_args()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile(argv(), "Xtestout")',
|
call writefile(argv(), "Xtestout")
|
||||||
\ 'qall',
|
qall
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, '')
|
if RunVim([], after, '')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(0, len(lines))
|
call assert_equal(0, len(lines))
|
||||||
@@ -546,10 +555,11 @@ func Test_startuptime()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_read_stdin()
|
func Test_read_stdin()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'write Xtestout',
|
write Xtestout
|
||||||
\ 'quit!',
|
quit!
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVimPiped([], after, '-', 'echo something | ')
|
if RunVimPiped([], after, '-', 'echo something | ')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
" MS-Windows adds a space after the word
|
" MS-Windows adds a space after the word
|
||||||
@@ -559,10 +569,11 @@ func Test_read_stdin()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_shell()
|
func Test_set_shell()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'call writefile([&shell], "Xtestout")',
|
call writefile([&shell], "Xtestout")
|
||||||
\ 'quit!',
|
quit!
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
let $SHELL = '/bin/with space/sh'
|
let $SHELL = '/bin/with space/sh'
|
||||||
if RunVimPiped([], after, '', '')
|
if RunVimPiped([], after, '', '')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
@@ -613,20 +624,22 @@ endfunc
|
|||||||
func Test_zzz_startinsert()
|
func Test_zzz_startinsert()
|
||||||
" Test :startinsert
|
" Test :startinsert
|
||||||
call writefile(['123456'], 'Xtestout')
|
call writefile(['123456'], 'Xtestout')
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ ':startinsert',
|
:startinsert
|
||||||
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
|
call feedkeys("foobar\<c-o>:wq\<cr>","t")
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, 'Xtestout')
|
if RunVim([], after, 'Xtestout')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['foobar123456'], lines)
|
call assert_equal(['foobar123456'], lines)
|
||||||
endif
|
endif
|
||||||
" Test :startinsert!
|
" Test :startinsert!
|
||||||
call writefile(['123456'], 'Xtestout')
|
call writefile(['123456'], 'Xtestout')
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ ':startinsert!',
|
:startinsert!
|
||||||
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
|
call feedkeys("foobar\<c-o>:wq\<cr>","t")
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if RunVim([], after, 'Xtestout')
|
if RunVim([], after, 'Xtestout')
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
call assert_equal(['123456foobar'], lines)
|
call assert_equal(['123456foobar'], lines)
|
||||||
|
@@ -1012,18 +1012,19 @@ endfunc
|
|||||||
" Run Vim, start a terminal in that Vim without the kill argument,
|
" Run Vim, start a terminal in that Vim without the kill argument,
|
||||||
" check that :qall does not exit, :qall! does.
|
" check that :qall does not exit, :qall! does.
|
||||||
func Test_terminal_qall_exit()
|
func Test_terminal_qall_exit()
|
||||||
let after = [
|
let after =<< trim [CODE]
|
||||||
\ 'term',
|
term
|
||||||
\ 'let buf = bufnr("%")',
|
let buf = bufnr("%")
|
||||||
\ 'while term_getline(buf, 1) =~ "^\\s*$"',
|
while term_getline(buf, 1) =~ "^\\s*$"
|
||||||
\ ' sleep 10m',
|
sleep 10m
|
||||||
\ 'endwhile',
|
endwhile
|
||||||
\ 'set nomore',
|
set nomore
|
||||||
\ 'au VimLeavePre * call writefile(["too early"], "Xdone")',
|
au VimLeavePre * call writefile(["too early"], "Xdone")
|
||||||
\ 'qall',
|
qall
|
||||||
\ 'au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")',
|
au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")
|
||||||
\ 'cquit',
|
cquit
|
||||||
\ ]
|
[CODE]
|
||||||
|
|
||||||
if !RunVim([], after, '')
|
if !RunVim([], after, '')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@@ -95,9 +95,13 @@ func Test_xxd()
|
|||||||
%d
|
%d
|
||||||
exe '0r! ' . s:xxd_cmd . ' -i XXDfile'
|
exe '0r! ' . s:xxd_cmd . ' -i XXDfile'
|
||||||
$d
|
$d
|
||||||
let expected = ['unsigned char XXDfile[] = {',
|
let expected =<< trim [CODE]
|
||||||
\ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};',
|
unsigned char XXDfile[] = {
|
||||||
\ 'unsigned int XXDfile_len = 11;']
|
0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
|
||||||
|
};
|
||||||
|
unsigned int XXDfile_len = 11;
|
||||||
|
[CODE]
|
||||||
|
|
||||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||||
|
|
||||||
" Test 8: Print C include capitalized
|
" Test 8: Print C include capitalized
|
||||||
@@ -107,9 +111,12 @@ func Test_xxd()
|
|||||||
%d
|
%d
|
||||||
exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
|
exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
|
||||||
$d
|
$d
|
||||||
let expected = ['unsigned char XXDFILE[] = {',
|
let expected =<< trim [CODE]
|
||||||
\ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};',
|
unsigned char XXDFILE[] = {
|
||||||
\ 'unsigned int XXDFILE_LEN = 11;']
|
0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
|
||||||
|
};
|
||||||
|
unsigned int XXDFILE_LEN = 11;
|
||||||
|
[CODE]
|
||||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@@ -767,6 +767,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 */
|
||||||
|
/**/
|
||||||
|
1362,
|
||||||
/**/
|
/**/
|
||||||
1361,
|
1361,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user