diff options
-rw-r--r-- | src/testdir/test_autocmd.vim | 102 | ||||
-rw-r--r-- | src/testdir/test_balloon.vim | 16 | ||||
-rw-r--r-- | src/testdir/test_bufline.vim | 35 | ||||
-rw-r--r-- | src/testdir/test_cindent.vim | 60 | ||||
-rw-r--r-- | src/testdir/test_conceal.vim | 50 | ||||
-rw-r--r-- | src/testdir/test_exit.vim | 66 | ||||
-rw-r--r-- | src/testdir/test_fold.vim | 23 | ||||
-rw-r--r-- | src/testdir/test_goto.vim | 405 | ||||
-rw-r--r-- | src/testdir/test_join.vim | 147 | ||||
-rw-r--r-- | src/testdir/test_mksession_utf8.vim | 57 | ||||
-rw-r--r-- | src/testdir/test_normal.vim | 183 | ||||
-rw-r--r-- | src/testdir/test_profile.vim | 266 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 199 | ||||
-rw-r--r-- | src/testdir/test_startup.vim | 171 | ||||
-rw-r--r-- | src/testdir/test_terminal.vim | 25 | ||||
-rw-r--r-- | src/testdir/test_xxd.vim | 19 | ||||
-rw-r--r-- | src/version.c | 2 |
17 files changed, 991 insertions, 835 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index b22718aee6..0a4177cd77 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -423,18 +423,20 @@ func Test_autocmd_bufwipe_in_SessLoadPost() set noswapfile mksession! - let content = ['set nocp noswapfile', - \ 'let v:swapchoice="e"', - \ 'augroup test_autocmd_sessionload', - \ 'autocmd!', - \ 'autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"', - \ 'augroup END', - \ '', - \ 'func WriteErrors()', - \ ' call writefile([execute("messages")], "Xerrors")', - \ 'endfunc', - \ 'au VimLeave * call WriteErrors()', - \ ] + let content =<< trim [CODE] + set nocp noswapfile + let v:swapchoice="e" + augroup test_autocmd_sessionload + autocmd! + autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!" + augroup END + + func WriteErrors() + call writefile([execute("messages")], "Xerrors") + endfunc + au VimLeave * call WriteErrors() + [CODE] + call writefile(content, 'Xvimrc') call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) @@ -452,27 +454,29 @@ func Test_autocmd_bufwipe_in_SessLoadPost2() set noswapfile mksession! - let content = ['set nocp noswapfile', - \ 'function! DeleteInactiveBufs()', - \ ' tabfirst', - \ ' let tabblist = []', - \ ' for i in range(1, tabpagenr(''$''))', - \ ' call extend(tabblist, tabpagebuflist(i))', - \ ' endfor', - \ ' for b in range(1, bufnr(''$''))', - \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', - \ ' exec ''bwipeout '' . b', - \ ' endif', - \ ' endfor', - \ ' echomsg "SessionLoadPost DONE"', - \ 'endfunction', - \ 'au SessionLoadPost * call DeleteInactiveBufs()', - \ '', - \ 'func WriteErrors()', - \ ' call writefile([execute("messages")], "Xerrors")', - \ 'endfunc', - \ 'au VimLeave * call WriteErrors()', - \ ] + let content =<< trim [CODE] + set nocp noswapfile + function! DeleteInactiveBufs() + tabfirst + let tabblist = [] + for i in range(1, tabpagenr(''$'')) + call extend(tabblist, tabpagebuflist(i)) + endfor + for b in range(1, bufnr(''$'')) + if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'') + exec ''bwipeout '' . b + endif + endfor + echomsg "SessionLoadPost DONE" + endfunction + au SessionLoadPost * call DeleteInactiveBufs() + + func WriteErrors() + call writefile([execute("messages")], "Xerrors") + endfunc + au VimLeave * call WriteErrors() + [CODE] + call writefile(content, 'Xvimrc') call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) @@ -933,21 +937,23 @@ func Test_bufunload_all() call writefile(['Test file Xxx1'], 'Xxx1')" call writefile(['Test file Xxx2'], 'Xxx2')" - let content = [ - \ "func UnloadAllBufs()", - \ " let i = 1", - \ " while i <= bufnr('$')", - \ " if i != bufnr('%') && bufloaded(i)", - \ " exe i . 'bunload'", - \ " endif", - \ " let i += 1", - \ " endwhile", - \ "endfunc", - \ "au BufUnload * call UnloadAllBufs()", - \ "au VimLeave * call writefile(['Test Finished'], 'Xout')", - \ "edit Xxx1", - \ "split Xxx2", - \ "q"] + let content =<< trim [CODE] + func UnloadAllBufs() + let i = 1 + while i <= bufnr('$') + if i != bufnr('%') && bufloaded(i) + exe i . 'bunload' + endif + let i += 1 + endwhile + endfunc + au BufUnload * call UnloadAllBufs() + au VimLeave * call writefile(['Test Finished'], 'Xout') + edit Xxx1 + split Xxx2 + q + [CODE] + call writefile(content, 'Xtest') call delete('Xout') diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index 57d8dcce30..39c2602be6 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -8,14 +8,14 @@ if !CanRunVimInTerminal() finish endif -let s:common_script = [ - \ 'call setline(1, ["one one one", "two tXo two", "three three three"])', - \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100', - \ 'func MyBalloonExpr()', - \ ' return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text', - \ 'endfun', - \ 'redraw', - \ ] +let s:common_script =<< [CODE] + call setline(1, ["one one one", "two tXo two", "three three three"]) + set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100 + func MyBalloonExpr() + return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text + endfun + redraw +[CODE] func Test_balloon_eval_term() " Use <Ignore> after <MouseMove> to return from vgetc() without removing diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim index 9c29a05e70..dbcd2e0fd6 100644 --- a/src/testdir/test_bufline.vim +++ b/src/testdir/test_bufline.vim @@ -93,23 +93,24 @@ func Test_appendbufline() endfunc func Test_appendbufline_no_E315() - let after = [ - \ 'set stl=%f ls=2', - \ 'new', - \ 'let buf = bufnr("%")', - \ 'quit', - \ 'vsp', - \ 'exec "buffer" buf', - \ 'wincmd w', - \ 'call appendbufline(buf, 0, "abc")', - \ 'redraw', - \ 'while getbufline(buf, 1)[0] =~ "^\\s*$"', - \ ' sleep 10m', - \ 'endwhile', - \ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")', - \ 'au VimLeavePre * call writefile(["done"], "Xdone")', - \ 'qall!', - \ ] + let after =<< trim [CODE] + set stl=%f ls=2 + new + let buf = bufnr("%") + quit + vsp + exec "buffer" buf + wincmd w + call appendbufline(buf, 0, "abc") + redraw + while getbufline(buf, 1)[0] =~ "^\\s*$" + sleep 10m + endwhile + au VimLeavePre * call writefile([v:errmsg], "Xerror") + au VimLeavePre * call writefile(["done"], "Xdone") + qall! + [CODE] + if !RunVim([], after, '--clean') return endif diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim index 3b57360ace..4b1198a206 100644 --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -18,25 +18,25 @@ endfunc func Test_cino_extern_c() " Test for cino-E - let without_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ 'int func_a(void);', - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let without_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] - let with_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ "\tint func_a(void);", - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let with_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] new setlocal cindent cinoptions=E0 call setline(1, without_ind) @@ -89,16 +89,32 @@ func Test_cindent_expr() return v:lnum == 1 ? shiftwidth() : 0 endfunc 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 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 - 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 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! endfunc diff --git a/src/testdir/test_conceal.vim b/src/testdir/test_conceal.vim index 685c891759..66384e1c15 100644 --- a/src/testdir/test_conceal.vim +++ b/src/testdir/test_conceal.vim @@ -11,21 +11,23 @@ if !CanRunVimInTerminal() endif func Test_conceal_two_windows() - call writefile([ - \ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]', - \ 'call setline(1, lines)', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=', - \ 'exe "normal /here\r"', - \ 'new', - \ 'call setline(1, lines)', - \ 'call setline(4, "Second window")', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=nc', - \ 'exe "normal /here\r"', - \ ], 'XTest_conceal') + let code =<< trim [CODE] + let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"] + call setline(1, lines) + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor= + exe "normal /here\r" + new + call setline(1, lines) + call setline(4, "Second window") + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor=nc + exe "normal /here\r" + [CODE] + + call writefile(code, 'XTest_conceal') " Check that cursor line is concealed let buf = RunVimInTerminal('-S XTest_conceal', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) @@ -113,14 +115,16 @@ endfunc func Test_conceal_with_cursorline() " Opens a help window, where 'conceal' is set, switches to the other window " where 'cursorline' needs to be updated when the cursor moves. - call writefile([ - \ 'set cursorline', - \ 'normal othis is a test', - \ 'new', - \ 'call setline(1, ["one", "two", "three", "four", "five"])', - \ 'set ft=help', - \ 'normal M', - \ ], 'XTest_conceal_cul') + let code =<< trim [CODE] + set cursorline + normal othis is a test + new + call setline(1, ["one", "two", "three", "four", "five"]) + set ft=help + normal M + [CODE] + + call writefile(code, 'XTest_conceal_cul') let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) diff --git a/src/testdir/test_exit.vim b/src/testdir/test_exit.vim index 8f02fd29e3..3797626abf 100644 --- a/src/testdir/test_exit.vim +++ b/src/testdir/test_exit.vim @@ -3,52 +3,56 @@ source shared.vim func Test_exiting() - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'help', - \ 'wincmd w', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + help + wincmd w + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'split', - \ 'new', - \ 'qall', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + split + new + qall + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'augroup nasty', - \ ' au ExitPre * split', - \ 'augroup END', - \ 'quit', - \ 'augroup nasty', - \ ' au! ExitPre', - \ 'augroup END', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout", "a") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + augroup nasty + au ExitPre * split + augroup END + quit + augroup nasty + au! ExitPre + augroup END + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], \ readfile('Xtestout')) diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 67e5a48fe6..9ad82181c3 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -513,17 +513,18 @@ func Test_fold_create_marker_in_C() set fdm=marker fdl=9 set filetype=c - let content = [ - \ '/*', - \ ' * comment', - \ ' * ', - \ ' *', - \ ' */', - \ 'int f(int* p) {', - \ ' *p = 3;', - \ ' return 0;', - \ '}' - \] + let content =<< trim [CODE] + /* + * comment + * + * + */ + int f(int* p) { + *p = 3; + return 0; + } + [CODE] + for c in range(len(content) - 1) bw! call append(0, content) diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index c0235b1707..c00e4e4376 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -15,262 +15,282 @@ func XTest_goto_decl(cmd, lines, line, col) endfunc func Test_gD() - let lines = [ - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 1, 5) endfunc func Test_gD_too() - let lines = [ - \ 'Filename x;', - \ '', - \ 'int Filename', - \ 'int func() {', - \ ' Filename x;', - \ ' return x;', - \ ] + let lines =<< trim [CODE] + Filename x; + + int Filename + int func() { + Filename x; + return x; + [CODE] + call XTest_goto_decl('gD', lines, 1, 10) endfunc func Test_gD_comment() - let lines = [ - \ '/* int x; */', - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + /* int x; */ + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_inline_comment() - let lines = [ - \ 'int y /* , x */;', - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int y /* , x */; + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_string() - let lines = [ - \ 'char *s[] = "x";', - \ 'int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char *s[] = "x"; + int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_string_same_line() - let lines = [ - \ 'char *s[] = "x", int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char *s[] = "x", int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 1, 22) endfunc func Test_gD_char() - let lines = [ - \ "char c = 'x';", - \ 'int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char c = 'x'; + int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gd() - let lines = [ - \ 'int x;', - \ '', - \ 'int func(int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int x; + + int func(int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 14) endfunc func Test_gd_not_local() - let lines = [ - \ 'int func1(void)', - \ '{', - \ ' return x;', - \ '}', - \ '', - \ 'int func2(int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func1(void) + { + return x; + } + + int func2(int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 10) endfunc func Test_gd_kr_style() - let lines = [ - \ 'int func(x)', - \ ' int x;', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(x) + int x; + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 2, 7) endfunc func Test_gd_missing_braces() - let lines = [ - \ 'def func1(a)', - \ ' a + 1', - \ 'end', - \ '', - \ 'a = 1', - \ '', - \ 'def func2()', - \ ' return a', - \ 'end', - \ ] + let lines =<< trim [CODE] + def func1(a) + a + 1 + end + + a = 1 + + def func2() + return a + end + [CODE] + call XTest_goto_decl('gd', lines, 1, 11) endfunc func Test_gd_comment() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' /* int x; */', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + /* int x; */ + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 4, 7) endfunc func Test_gd_comment_in_string() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s ="//"; int x;', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + char *s ="//"; int x; + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 22) endfunc func Test_gd_string_in_comment() set comments= - let lines = [ - \ 'int func(void)', - \ '{', - \ ' /* " */ int x;', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + /* " */ int x; + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 15) set comments& endfunc func Test_gd_inline_comment() - let lines = [ - \ 'int func(/* x is an int */ int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(/* x is an int */ int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 32) endfunc func Test_gd_inline_comment_only() - let lines = [ - \ 'int func(void) /* one lonely x */', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) /* one lonely x */ + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 10) endfunc func Test_gd_inline_comment_body() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' int y /* , x */;', - \ '', - \ ' for (/* int x = 0 */; y < 2; y++);', - \ '', - \ ' int x = 0;', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + int y /* , x */; + + for (/* int x = 0 */; y < 2; y++); + + int x = 0; + + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 7, 7) endfunc func Test_gd_trailing_multiline_comment() - let lines = [ - \ 'int func(int x) /* x is an int */', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(int x) /* x is an int */ + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 14) endfunc func Test_gd_trailing_comment() - let lines = [ - \ 'int func(int x) // x is an int', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(int x) // x is an int + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 14) endfunc func Test_gd_string() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s = "x";', - \ ' int x = 1;', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + char *s = "x"; + int x = 1; + + return x; + } + [CODE] call XTest_goto_decl('gd', lines, 4, 7) endfunc func Test_gd_string_only() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s = "x";', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + char *s = "x"; + + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 5, 10) endfunc @@ -289,24 +309,25 @@ func Test_cursorline_keep_col() endfunc func Test_gd_local_block() - let lines = [ - \ ' int main()', - \ '{', - \ ' char *a = "NOT NULL";', - \ ' if(a)', - \ ' {', - \ ' char *b = a;', - \ ' printf("%s\n", b);', - \ ' }', - \ ' else', - \ ' {', - \ ' char *b = "NULL";', - \ ' return b;', - \ ' }', - \ '', - \ ' return 0;', - \ '}', - \ ] + let lines =<< trim [CODE] + int main() + { + char *a = "NOT NULL"; + if(a) + { + char *b = a; + printf("%s\n", b); + } + else + { + char *b = "NULL"; + return b; + } + + return 0; + } + [CODE] + call XTest_goto_decl('1gd', lines, 11, 11) endfunc diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim index e5ef41ee0a..1b4da6f41a 100644 --- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -98,30 +98,27 @@ ert normal `xyl$p normal `yy2l$p - normal G - let last_line = line('$') - " Expected output - append -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 -. - - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + 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 + zx cvn. as dfg? hjkl iop! ert ernop + zx cvn. as dfg? hjkl iop! ert ernop + [DATA] + + call assert_equal(expected, getline(1, '$')) enew! call append(0, text) @@ -143,31 +140,28 @@ zx cvn. as dfg? hjkl iop! ert ernop normal `xyl$p normal `yy2l$p - normal G - let last_line = line('$') - " Expected output - append -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 ernop - -. - - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + 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 + zx cvn. as dfg? hjkl iop! ert enop + zx cvn. as dfg? hjkl iop! ert ernop + + [DATA] + + call assert_equal(expected, getline(1, '$')) enew! call append(0, text) @@ -180,29 +174,26 @@ zx cvn. as dfg? hjkl iop! ert ernop normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ normal j4Jy3l$pjdG - normal G - let last_line = line('$') - " Expected output - append -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 -. - - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + 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 + zx cvn. as dfg? hjkl iop! ert a + [DATA] + + call assert_equal(expected, getline(1, '$')) set nocompatible set cpoptions&vim @@ -262,11 +253,8 @@ action(); .,+2join exe "normal jj3J\<CR>" - normal G - let last_line = line('$') - " 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. */ @@ -279,9 +267,9 @@ action(); if (condition) // Remove the next comment leader! OK, I will. action(); } -. + [CODE] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) set comments&vim set joinspaces&vim @@ -389,11 +377,8 @@ int i = 7 /* foo *// 3 exe "normal j6J\<CR>" 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 - append + let expected =<< [CODE] { /* 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. } -. +[CODE] - call assert_equal(getline(la |