diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-10 06:59:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-10 06:59:58 +0800 |
commit | 880de9a489be57d07416d1de9f869d4cba1e490c (patch) | |
tree | 9dc186bdb3300bb1a85610b7b9ea007313262d47 | |
parent | d6a1e718813f744b997e1b8fc707cbd47125db5c (diff) | |
download | rneovim-880de9a489be57d07416d1de9f869d4cba1e490c.tar.gz rneovim-880de9a489be57d07416d1de9f869d4cba1e490c.tar.bz2 rneovim-880de9a489be57d07416d1de9f869d4cba1e490c.zip |
test(old): align defaults to Vim after every test (#19301)
This can avoid divergences from Vim in some small places.
-rw-r--r-- | src/nvim/testdir/runtest.vim | 7 | ||||
-rw-r--r-- | src/nvim/testdir/setup.vim | 32 | ||||
-rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_command_count.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_excmd.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_gf.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_ins_complete.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_join.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_window_cmd.vim | 2 |
12 files changed, 37 insertions, 26 deletions
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index cf686d1531..d0a666a049 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -161,10 +161,6 @@ func RunTheTest(test) endtry endif - " Make "Q" switch to Ex mode. - " This does not work for all tests. - nnoremap Q gQ - if a:test =~ 'Test_nocatch_' " Function handles errors itself. This avoids skipping commands after the " error. @@ -195,6 +191,9 @@ func RunTheTest(test) endtry endif + " Align Nvim defaults to Vim. + source setup.vim + " Clear any autocommands and put back the catch-all for SwapExists. au! au SwapExists * call HandleSwapExists() diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index ff1ad30b12..f8db2ea120 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -1,32 +1,42 @@ -" Common preparations for running tests. - -" Only load this once. -if exists('s:did_load') - finish -endif -let s:did_load = 1 - " Align Nvim defaults to Vim. set backspace= +set complete=.,w,b,u,t,i +set directory& set directory^=. set fillchars=vert:\|,fold:- +set formatoptions=tcq set fsync set laststatus=1 set listchars=eol:$ set joinspaces -set nohidden nosmarttab noautoindent noautoread complete-=i noruler noshowcmd +set nohidden nosmarttab noautoindent noautoread noruler noshowcmd set nohlsearch noincsearch -set nrformats+=octal -set shortmess-=F +set nrformats=bin,octal,hex +set shortmess=filnxtToOS set sidescroll=0 set tags=./tags,tags +set undodir& set undodir^=. set wildoptions= set startofline +set sessionoptions& set sessionoptions+=options +set viewoptions& set viewoptions+=options set switchbuf= +" Make "Q" switch to Ex mode. +" This does not work for all tests. +nnoremap Q gQ + +" Common preparations for running tests. + +" Only load this once. +if exists('s:did_load') + finish +endif +let s:did_load = 1 + " Clear Nvim default mappings. mapclear mapclear! diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index fcef57e47a..4b575bdfc3 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1720,7 +1720,7 @@ func Test_Cmd_Autocmds() au BufWriteCmd XtestE call extend(g:lines, getline(0, '$')) wall " will write other window to 'lines' call assert_equal(4, len(g:lines), g:lines) - call assert_equal("\tasdf", g:lines[2]) + call assert_equal("asdf", g:lines[2]) au! BufReadCmd au! BufWriteCmd diff --git a/src/nvim/testdir/test_command_count.vim b/src/nvim/testdir/test_command_count.vim index c7dddf4164..55b230373f 100644 --- a/src/nvim/testdir/test_command_count.vim +++ b/src/nvim/testdir/test_command_count.vim @@ -33,7 +33,7 @@ func Test_command_count_0() delcommand RangeBuffers delcommand RangeBuffersAll - set nohidden + set hidden& set swapfile& endfunc diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index be9a77ee75..8c20c647f1 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -540,7 +540,7 @@ func Test_diffopt_hiddenoff() bwipe! bwipe! - set nohidden diffopt& + set hidden& diffopt& endfunc func Test_diffoff_hidden() @@ -577,7 +577,7 @@ func Test_diffoff_hidden() bwipe! bwipe! - set nohidden diffopt& + set hidden& diffopt& endfunc func Test_setting_cursor() diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index b3052abb24..df2cf97633 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -147,7 +147,6 @@ endfunc " Test for the :insert command func Test_insert_cmd() - set noautoindent " test assumes noautoindent, but it's on by default in Nvim new call setline(1, [' L1']) call feedkeys(":insert\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt') @@ -197,7 +196,6 @@ endfunc " Test for the :change command func Test_change_cmd() - set noautoindent " test assumes noautoindent, but it's on by default in Nvim new call setline(1, [' L1', 'L2', 'L3']) call feedkeys(":change\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt') diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index 7cb9daf59a..403fc24391 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -137,7 +137,7 @@ func Test_gf_visual() bwipe! call delete('Xtest_gf_visual') - set nohidden + set hidden& endfunc func Test_gf_error() diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim index c8104c6b73..e963f308a2 100644 --- a/src/nvim/testdir/test_ins_complete.vim +++ b/src/nvim/testdir/test_ins_complete.vim @@ -95,7 +95,7 @@ func Test_ins_complete() call delete('Xtest11.one') call delete('Xtest11.two') call delete('Xtestdata') - set cpt& cot& def& tags& tagbsearch& nohidden + set cpt& cot& def& tags& tagbsearch& hidden& cd .. call delete('Xdir', 'rf') endfunc diff --git a/src/nvim/testdir/test_join.vim b/src/nvim/testdir/test_join.vim index ecb969d10a..ac6ef8f29f 100644 --- a/src/nvim/testdir/test_join.vim +++ b/src/nvim/testdir/test_join.vim @@ -51,7 +51,7 @@ func Test_join_marks() /^This line/;'}-join call assert_equal([0, 4, 11, 0], getpos("'[")) - call assert_equal([0, 4, 66, 0], getpos("']")) + call assert_equal([0, 4, 67, 0], getpos("']")) enew! endfunc diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 7d1fbe7d3e..7b6cfa6bb4 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -630,7 +630,7 @@ func Test_copy_winopt() call assert_equal(4,&numberwidth) bw! - set nohidden + set hidden& endfunc func Test_shortmess_F() diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index 8579457d9f..f36ff83fdf 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -9,6 +9,10 @@ source view_util.vim source check.vim source term_util.vim +func SetUp() + set laststatus=2 +endfunc + func s:get_statusline() return ScreenLines(&lines - 1, &columns)[0] endfunc diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 0fe5fc59eb..d295e520c7 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -612,7 +612,7 @@ func Test_window_prevwin() " reset q call delete('tmp.txt') - set nohidden autoread&vim + set hidden&vim autoread&vim delfunc Fun_RenewFile endfunc |