mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3345: some code not covered by tests
Problem: Some code not covered by tests.
Solution: Add a few more tests. (Dominique Pellé, closes vim/vim#8757)
bfb2bb16bc
This commit is contained in:
parent
535e423a6a
commit
e73517e34e
@ -87,6 +87,10 @@ func Test_argadd()
|
||||
new
|
||||
arga
|
||||
call assert_equal(0, len(argv()))
|
||||
|
||||
if has('unix')
|
||||
call assert_fails('argadd `Xdoes_not_exist`', 'E479:')
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_argadd_empty_curbuf()
|
||||
@ -429,6 +433,8 @@ func Test_argdelete()
|
||||
argdel
|
||||
call Assert_argc(['a', 'c', 'd'])
|
||||
%argdel
|
||||
|
||||
call assert_fails('argdel does_not_exist', 'E480:')
|
||||
endfunc
|
||||
|
||||
func Test_argdelete_completion()
|
||||
|
@ -916,6 +916,14 @@ func Test_cmdline_complete_various()
|
||||
call feedkeys(":doautocmd BufNew,BufEn\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"doautocmd BufNew,BufEnter", @:)
|
||||
|
||||
" completion of file name in :doautocmd
|
||||
call writefile([], 'Xfile1')
|
||||
call writefile([], 'Xfile2')
|
||||
call feedkeys(":doautocmd BufEnter Xfi\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"doautocmd BufEnter Xfile1 Xfile2", @:)
|
||||
call delete('Xfile1')
|
||||
call delete('Xfile2')
|
||||
|
||||
" completion for the :augroup command
|
||||
augroup XTest
|
||||
augroup END
|
||||
@ -1396,14 +1404,6 @@ func Test_cmdwin_jump_to_win()
|
||||
call assert_equal(1, winnr('$'))
|
||||
endfunc
|
||||
|
||||
" Test for backtick expression in the command line
|
||||
func Test_cmd_backtick()
|
||||
%argd
|
||||
argadd `=['a', 'b', 'c']`
|
||||
call assert_equal(['a', 'b', 'c'], argv())
|
||||
%argd
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_tabpage()
|
||||
tabedit
|
||||
" v8.2.1919 isn't ported yet, so E492 is thrown after E11 here.
|
||||
@ -1416,11 +1416,22 @@ func Test_cmdwin_tabpage()
|
||||
tabclose!
|
||||
endfunc
|
||||
|
||||
" Test for backtick expression in the command line
|
||||
func Test_cmd_backtick()
|
||||
CheckNotMSWindows " FIXME: see #19297
|
||||
%argd
|
||||
argadd `=['a', 'b', 'c']`
|
||||
call assert_equal(['a', 'b', 'c'], argv())
|
||||
%argd
|
||||
|
||||
argadd `echo abc def`
|
||||
call assert_equal(['abc def'], argv())
|
||||
%argd
|
||||
endfunc
|
||||
|
||||
" Test for the :! command
|
||||
func Test_cmd_bang()
|
||||
if !has('unix')
|
||||
return
|
||||
endif
|
||||
CheckUnix
|
||||
|
||||
let lines =<< trim [SCRIPT]
|
||||
" Test for no previous command
|
||||
|
@ -919,6 +919,33 @@ func Test_spellfile_COMMON()
|
||||
call delete('XtestCOMMON-utf8.spl')
|
||||
endfunc
|
||||
|
||||
" Test NOSUGGEST (see :help spell-COMMON)
|
||||
func Test_spellfile_NOSUGGEST()
|
||||
call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic')
|
||||
call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff')
|
||||
|
||||
mkspell! XtestNOSUGGEST-utf8.spl XtestNOSUGGEST
|
||||
set spell spelllang=XtestNOSUGGEST-utf8.spl
|
||||
|
||||
for goodword in ['foo', 'Foo', 'FOO', 'fog', 'Fog', 'FOG']
|
||||
call assert_equal(['', ''], spellbadword(goodword), goodword)
|
||||
endfor
|
||||
for badword in ['foO', 'fOO', 'fooo', 'foog', 'foofog', 'fogfoo']
|
||||
call assert_equal([badword, 'bad'], spellbadword(badword))
|
||||
endfor
|
||||
|
||||
call assert_equal(['fog'], spellsuggest('fooo', 1))
|
||||
call assert_equal(['fog'], spellsuggest('fOo', 1))
|
||||
call assert_equal(['fog'], spellsuggest('foG', 1))
|
||||
call assert_equal(['fog'], spellsuggest('fogg', 1))
|
||||
|
||||
set spell& spelllang&
|
||||
call delete('XtestNOSUGGEST.dic')
|
||||
call delete('XtestNOSUGGEST.aff')
|
||||
call delete('XtestNOSUGGEST-utf8.spl')
|
||||
endfunc
|
||||
|
||||
|
||||
" Test CIRCUMFIX (see: :help spell-CIRCUMFIX)
|
||||
func Test_spellfile_CIRCUMFIX()
|
||||
" Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests
|
||||
|
@ -858,6 +858,44 @@ func Test_substitute_skipped_range()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test using the 'gdefault' option (when on, flag 'g' is default on).
|
||||
func Test_substitute_gdefault()
|
||||
new
|
||||
|
||||
" First check without 'gdefault'
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/
|
||||
call assert_equal('FOO bar foo', getline(1))
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/g
|
||||
call assert_equal('FOO bar FOO', getline(1))
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/gg
|
||||
call assert_equal('FOO bar foo', getline(1))
|
||||
|
||||
" Then check with 'gdefault'
|
||||
set gdefault
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/
|
||||
call assert_equal('FOO bar FOO', getline(1))
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/g
|
||||
call assert_equal('FOO bar foo', getline(1))
|
||||
call setline(1, 'foo bar foo')
|
||||
s/foo/FOO/gg
|
||||
call assert_equal('FOO bar FOO', getline(1))
|
||||
|
||||
" Setting 'compatible' should reset 'gdefault'
|
||||
call assert_equal(1, &gdefault)
|
||||
" set compatible
|
||||
set nogdefault
|
||||
call assert_equal(0, &gdefault)
|
||||
set nocompatible
|
||||
call assert_equal(0, &gdefault)
|
||||
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" This was using "old_sub" after it was freed.
|
||||
func Test_using_old_sub()
|
||||
" set compatible maxfuncdepth=10
|
||||
|
Loading…
Reference in New Issue
Block a user