# HG changeset patch # User Bram Moolenaar # Date 1597251608 -7200 # Node ID 08940efa6b4eb93d0213eac46ba3c7f2e7a4d575 # Parent 476b6faad4072abdbdc8dd66b0c234188ca8f0a9 patch 8.2.1432: various inconsistencies in test files Commit: https://github.com/vim/vim/commit/6d91bcb4d23b5c6a0be72c384beaf385e2d9d606 Author: Bram Moolenaar Date: Wed Aug 12 18:50:36 2020 +0200 patch 8.2.1432: various inconsistencies in test files Problem: Various inconsistencies in test files. Solution: Add modelines where they were missing. Use Check commands instead of silently skipping over tests. Adjust indents and comments. (Ken Takata, closes #6695) diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim --- a/src/testdir/test_arglist.vim +++ b/src/testdir/test_arglist.vim @@ -242,11 +242,11 @@ endfunc func Test_args_with_quote() " Only on Unix can a file name include a double quote. - if has('unix') - args \"foobar - call assert_equal('"foobar', argv(0)) - %argdelete - endif + CheckUnix + + args \"foobar + call assert_equal('"foobar', argv(0)) + %argdelete endfunc " Test for 0argadd and 0argedit diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -374,3 +374,5 @@ func Test_zz_quit_detected() " Verify that if a test function ends Vim the test script detects this. quit endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim --- a/src/testdir/test_autochdir.vim +++ b/src/testdir/test_autochdir.vim @@ -24,3 +24,5 @@ func Test_set_filename() call chdir(cwd) call delete('samples/Xtest') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -70,9 +70,7 @@ if has('timers') endfunc func Test_cursorhold_insert_with_timer_interrupt() - if !has('job') - return - endif + CheckFeature job " Need to move the cursor. call feedkeys("ggG", "xt") @@ -535,9 +533,7 @@ func s:AutoCommandOptionSet(match) endfunc func Test_OptionSet() - if !has("eval") || !exists("+autochdir") - return - endif + CheckOption autochdir badd test_autocmd.vim @@ -1778,12 +1774,11 @@ func Test_nocatch_wipe_all_buffers() endfunc func Test_nocatch_wipe_dummy_buffer() - if has('quickfix') - " Nasty autocommand: wipe buffer on any event. - au * x bwipe - call assert_fails('lv½ /x', 'E937') - au! - endif + CheckFeature quickfix + " Nasty autocommand: wipe buffer on any event. + au * x bwipe + call assert_fails('lv½ /x', 'E937') + au! endfunc function s:Before_test_dirchanged() @@ -1834,9 +1829,7 @@ function Test_dirchanged_local() endfunc function Test_dirchanged_auto() - if !exists('+autochdir') - return - endif + CheckOption autochdir call s:Before_test_dirchanged() call test_autochdir() autocmd test_dirchanged DirChanged auto call add(s:li, "auto:") @@ -2087,9 +2080,8 @@ endfunc " - FileReadPost decompress the file func Test_ReadWrite_Autocmds() " Run this test only on Unix-like systems and if gzip is available - if !has('unix') || !executable("gzip") - return - endif + CheckUnix + CheckExecutable gzip " Make $GZIP empty, "-v" would cause trouble. let $GZIP = "" diff --git a/src/testdir/test_autoload.vim b/src/testdir/test_autoload.vim --- a/src/testdir/test_autoload.vim +++ b/src/testdir/test_autoload.vim @@ -22,3 +22,5 @@ func Test_autoload_vim9script() call assert_equal('some', auto9#getsome()) call assert_equal(49, auto9#add42(7)) endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -64,3 +64,5 @@ func Test_balloon_eval_term_visual() call StopVimInTerminal(buf) call delete('XTest_beval_visual') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_balloon_gui.vim b/src/testdir/test_balloon_gui.vim --- a/src/testdir/test_balloon_gui.vim +++ b/src/testdir/test_balloon_gui.vim @@ -17,3 +17,5 @@ func Test_balloon_show_gui() sleep 10m call balloon_show('') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_behave.vim b/src/testdir/test_behave.vim --- a/src/testdir/test_behave.vim +++ b/src/testdir/test_behave.vim @@ -27,3 +27,5 @@ endfunc func Test_behave_error() call assert_fails('behave x', 'E475:') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_blockedit.vim b/src/testdir/test_blockedit.vim --- a/src/testdir/test_blockedit.vim +++ b/src/testdir/test_blockedit.vim @@ -1,5 +1,4 @@ " Test for block inserting -" func Test_blockinsert_indent() new diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim --- a/src/testdir/test_breakindent.vim +++ b/src/testdir/test_breakindent.vim @@ -46,9 +46,7 @@ endfunc func Test_breakindent01_vartabs() " like 01 but with vartabs feature - if !has("vartabs") - return - endif + CheckFeature vartabs call s:test_windows('setl briopt=min:0 vts=4') let lines = s:screen_lines(line('.'),8) let expect = [ @@ -75,9 +73,7 @@ func Test_breakindent02() endfunc func Test_breakindent02_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " simple breakindent test with showbreak set call s:test_windows('setl briopt=min:0 sbr=>> vts=4') let lines = s:screen_lines(line('.'),8) @@ -106,9 +102,7 @@ endfunc func Test_breakindent03_vartabs() " simple breakindent test with showbreak set and briopt including sbr - if !has("vartabs") - return - endif + CheckFeature vartabs call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4') let lines = s:screen_lines(line('.'),8) let expect = [ @@ -139,9 +133,7 @@ endfunc func Test_breakindent04_vartabs() " breakindent set with min width 18 - if !has("vartabs") - return - endif + CheckFeature vartabs call s:test_windows('setl sbr= briopt=min:18 vts=4') let lines = s:screen_lines(line('.'),8) let expect = [ @@ -169,9 +161,7 @@ endfunc func Test_breakindent05_vartabs() " breakindent set and shift by 2 - if !has("vartabs") - return - endif + CheckFeature vartabs call s:test_windows('setl briopt=shift:2,min:0 vts=4') let lines = s:screen_lines(line('.'),8) let expect = [ @@ -198,9 +188,7 @@ endfunc func Test_breakindent06_vartabs() " breakindent set and shift by -1 - if !has("vartabs") - return - endif + CheckFeature vartabs call s:test_windows('setl briopt=shift:-1,min:0 vts=4') let lines = s:screen_lines(line('.'),8) let expect = [ @@ -227,9 +215,7 @@ func Test_breakindent07() endfunc func Test_breakindent07_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set and shift by 1, Number set sbr=? and briopt:sbr call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4') let lines = s:screen_lines(line('.'),10) @@ -258,9 +244,7 @@ func Test_breakindent07a() endfunc func Test_breakindent07a_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set and shift by 1, Number set sbr=? and briopt:sbr call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4') let lines = s:screen_lines(line('.'),10) @@ -293,9 +277,7 @@ func Test_breakindent08() endfunc func Test_breakindent08_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4') " make sure, cache is invalidated! @@ -327,9 +309,7 @@ func Test_breakindent08a() endfunc func Test_breakindent08a_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4') let lines = s:screen_lines(line('.'),10) @@ -356,9 +336,7 @@ func Test_breakindent09() endfunc func Test_breakindent09_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set and shift by 1, Number and list set sbr=# call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4') let lines = s:screen_lines(line('.'),10) @@ -390,9 +368,7 @@ func Test_breakindent10() endfunc func Test_breakindent10_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " breakindent set, Number set sbr=~ call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4') " make sure, cache is invalidated! @@ -421,9 +397,7 @@ func Test_breakindent11() endfunc func Test_breakindent11_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " test strdisplaywidth() call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4') let text = getline(2) @@ -447,9 +421,7 @@ func Test_breakindent12() endfunc func Test_breakindent12_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " test breakindent with long indent let s:input = "\t\t\t\t\t{" call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4') @@ -478,9 +450,7 @@ func Test_breakindent13() endfunc func Test_breakindent13_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs let s:input = "" call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8') vert resize 20 @@ -512,9 +482,7 @@ func Test_breakindent14() endfunc func Test_breakindent14_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs let s:input = "" call s:test_windows('setl breakindent briopt= ts=8 vts=8') vert resize 30 @@ -548,9 +516,7 @@ func Test_breakindent15() endfunc func Test_breakindent15_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs let s:input = "" call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8') vert resize 30 @@ -592,9 +558,7 @@ func Test_breakindent16() endfunc func Test_breakindent16_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs " Check that overlong lines are indented correctly. let s:input = "" call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4') @@ -620,9 +584,7 @@ func Test_breakindent16_vartabs() endfunc func Test_breakindent17_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs let s:input = "" call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++') call setline(1, "\t" . repeat('a', 63)) @@ -640,9 +602,7 @@ func Test_breakindent17_vartabs() endfunc func Test_breakindent18_vartabs() - if !has("vartabs") - return - endif + CheckFeature vartabs let s:input = "" call s:test_windows('setl breakindent list listchars=tab:<->') call setline(1, "\t" . repeat('a', 63)) diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim --- a/src/testdir/test_bufline.vim +++ b/src/testdir/test_bufline.vim @@ -202,3 +202,5 @@ func Test_appendbufline_redraw() call StopVimInTerminal(buf) call delete('XscriptMatchCommon') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_bufwintabinfo.vim b/src/testdir/test_bufwintabinfo.vim --- a/src/testdir/test_bufwintabinfo.vim +++ b/src/testdir/test_bufwintabinfo.vim @@ -1,4 +1,5 @@ " Tests for the getbufinfo(), getwininfo() and gettabinfo() functions + source check.vim func Test_getbufwintabinfo() @@ -168,3 +169,5 @@ func Test_getbufinfo_lines() edit Xfoo bw! endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim --- a/src/testdir/test_cd.vim +++ b/src/testdir/test_cd.vim @@ -191,3 +191,5 @@ func Test_cd_completion() call delete('XComplDir2', 'd') call delete('XComplFile') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_changedtick.vim b/src/testdir/test_changedtick.vim --- a/src/testdir/test_changedtick.vim +++ b/src/testdir/test_changedtick.vim @@ -93,3 +93,5 @@ func Test_changedtick_not_incremented_wi bwipe call delete(fname) endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_changelist.vim b/src/testdir/test_changelist.vim --- a/src/testdir/test_changelist.vim +++ b/src/testdir/test_changelist.vim @@ -1,10 +1,10 @@ " Tests for the changelist functionality +source check.vim + " Tests for the getchangelist() function func Test_getchangelist() - if !has("jumplist") - return - endif + CheckFeature jumplist bwipe! enew diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1348,9 +1348,7 @@ endfunction " This caused a crash, because messages were handled while peeking for a " character. func Test_exit_cb_wipes_buf() - if !has('timers') - return - endif + CheckFeature timers set cursorline lazyredraw call test_override('redraw_flag', 1) new diff --git a/src/testdir/test_checkpath.vim b/src/testdir/test_checkpath.vim --- a/src/testdir/test_checkpath.vim +++ b/src/testdir/test_checkpath.vim @@ -102,3 +102,5 @@ func Test_checkpath3() set include& set includeexpr& endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -1,5 +1,4 @@ " Test for cinoptions and cindent -" func Test_cino_hash() " Test that curbuf->b_ind_hash_comment is correctly reset diff --git a/src/testdir/test_cjk_linebreak.vim b/src/testdir/test_cjk_linebreak.vim --- a/src/testdir/test_cjk_linebreak.vim +++ b/src/testdir/test_cjk_linebreak.vim @@ -1,3 +1,5 @@ +" Test for CJK linebreak + scriptencoding utf-8 func Run_cjk_linebreak_after(rigorous) @@ -95,3 +97,5 @@ func Test_cjk_linebreak_join_punct() %d_ endfor endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim --- a/src/testdir/test_clientserver.vim +++ b/src/testdir/test_clientserver.vim @@ -30,7 +30,7 @@ endfunc func Test_client_server() let cmd = GetVimCommand() if cmd == '' - return + throw 'GetVimCommand() failed' endif call Check_X11_Connection() diff --git a/src/testdir/test_close_count.vim b/src/testdir/test_close_count.vim --- a/src/testdir/test_close_count.vim +++ b/src/testdir/test_close_count.vim @@ -1,5 +1,5 @@ +" Tests for :[count]close! command -" Tests for :[count]close! command func Test_close_count() enew! | only @@ -172,3 +172,5 @@ func Test_winclose_command() set nohidden only! endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -86,9 +86,7 @@ func Test_complete_wildmenu() endfunc func Test_map_completion() - if !has('cmdline_compl') - return - endif + CheckFeature cmdline_compl call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) call feedkeys(":map