mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #19785 from zeertzjq/vim-8.2.1803
vim-patch:8.2.{1803,3345,3392}
This commit is contained in:
commit
6b686e7e1e
@ -5285,8 +5285,8 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
|
|||||||
{ EXPAND_SYNTAX, get_syntax_name, true, true },
|
{ EXPAND_SYNTAX, get_syntax_name, true, true },
|
||||||
{ EXPAND_SYNTIME, get_syntime_arg, true, true },
|
{ EXPAND_SYNTIME, get_syntime_arg, true, true },
|
||||||
{ EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, true },
|
{ EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, true },
|
||||||
{ EXPAND_EVENTS, expand_get_event_name, true, true },
|
{ EXPAND_EVENTS, expand_get_event_name, true, false },
|
||||||
{ EXPAND_AUGROUP, expand_get_augroup_name, true, true },
|
{ EXPAND_AUGROUP, expand_get_augroup_name, true, false },
|
||||||
{ EXPAND_CSCOPE, get_cscope_name, true, true },
|
{ EXPAND_CSCOPE, get_cscope_name, true, true },
|
||||||
{ EXPAND_SIGN, get_sign_name, true, true },
|
{ EXPAND_SIGN, get_sign_name, true, true },
|
||||||
{ EXPAND_PROFILE, get_profile_name, true, true },
|
{ EXPAND_PROFILE, get_profile_name, true, true },
|
||||||
|
@ -87,6 +87,10 @@ func Test_argadd()
|
|||||||
new
|
new
|
||||||
arga
|
arga
|
||||||
call assert_equal(0, len(argv()))
|
call assert_equal(0, len(argv()))
|
||||||
|
|
||||||
|
if has('unix')
|
||||||
|
call assert_fails('argadd `Xdoes_not_exist`', 'E479:')
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_argadd_empty_curbuf()
|
func Test_argadd_empty_curbuf()
|
||||||
@ -420,6 +424,8 @@ func Test_argdelete()
|
|||||||
call assert_equal(['b'], argv())
|
call assert_equal(['b'], argv())
|
||||||
call assert_fails('argdelete', 'E610:')
|
call assert_fails('argdelete', 'E610:')
|
||||||
call assert_fails('1,100argdelete', 'E16:')
|
call assert_fails('1,100argdelete', 'E16:')
|
||||||
|
call assert_fails('argdel /\)/', 'E55:')
|
||||||
|
call assert_fails('1argdel 1', 'E474:')
|
||||||
|
|
||||||
call Reset_arglist()
|
call Reset_arglist()
|
||||||
args a b c d
|
args a b c d
|
||||||
@ -427,6 +433,8 @@ func Test_argdelete()
|
|||||||
argdel
|
argdel
|
||||||
call Assert_argc(['a', 'c', 'd'])
|
call Assert_argc(['a', 'c', 'd'])
|
||||||
%argdel
|
%argdel
|
||||||
|
|
||||||
|
call assert_fails('argdel does_not_exist', 'E480:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_argdelete_completion()
|
func Test_argdelete_completion()
|
||||||
@ -472,13 +480,16 @@ func Test_arglist_autocmd()
|
|||||||
new
|
new
|
||||||
" redefine arglist; go to Xxx1
|
" redefine arglist; go to Xxx1
|
||||||
next! Xxx1 Xxx2 Xxx3
|
next! Xxx1 Xxx2 Xxx3
|
||||||
" open window for all args
|
" open window for all args; Reading Xxx2 will change the arglist and the
|
||||||
|
" third window will get Xxx1:
|
||||||
|
" win 1: Xxx1
|
||||||
|
" win 2: Xxx2
|
||||||
|
" win 3: Xxx1
|
||||||
all
|
all
|
||||||
call assert_equal('test file Xxx1', getline(1))
|
call assert_equal('test file Xxx1', getline(1))
|
||||||
wincmd w
|
wincmd w
|
||||||
wincmd w
|
wincmd w
|
||||||
call assert_equal('test file Xxx1', getline(1))
|
call assert_equal('test file Xxx1', getline(1))
|
||||||
" should now be in Xxx2
|
|
||||||
rewind
|
rewind
|
||||||
call assert_equal('test file Xxx2', getline(1))
|
call assert_equal('test file Xxx2', getline(1))
|
||||||
|
|
||||||
|
@ -912,12 +912,26 @@ func Test_cmdline_complete_various()
|
|||||||
call feedkeys(":doautocmd User MyCmd a.c\<C-A>\<C-B>\"\<CR>", 'xt')
|
call feedkeys(":doautocmd User MyCmd a.c\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||||
call assert_equal("\"doautocmd User MyCmd a.c\<C-A>", @:)
|
call assert_equal("\"doautocmd User MyCmd a.c\<C-A>", @:)
|
||||||
|
|
||||||
|
" completion of autocmd group after comma
|
||||||
|
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
|
" completion for the :augroup command
|
||||||
augroup XTest
|
augroup XTest.test
|
||||||
augroup END
|
augroup END
|
||||||
call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt')
|
call feedkeys(":augroup X\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||||
call assert_equal("\"augroup XTest", @:)
|
call assert_equal("\"augroup XTest.test", @:)
|
||||||
augroup! XTest
|
call feedkeys(":au X\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||||
|
call assert_equal("\"au XTest.test", @:)
|
||||||
|
augroup! XTest.test
|
||||||
|
|
||||||
" completion for the :unlet command
|
" completion for the :unlet command
|
||||||
call feedkeys(":unlet one two\<C-A>\<C-B>\"\<CR>", 'xt')
|
call feedkeys(":unlet one two\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||||
@ -1392,14 +1406,6 @@ func Test_cmdwin_jump_to_win()
|
|||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
endfunc
|
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()
|
func Test_cmdwin_tabpage()
|
||||||
tabedit
|
tabedit
|
||||||
" v8.2.1919 isn't ported yet, so E492 is thrown after E11 here.
|
" v8.2.1919 isn't ported yet, so E492 is thrown after E11 here.
|
||||||
@ -1412,11 +1418,22 @@ func Test_cmdwin_tabpage()
|
|||||||
tabclose!
|
tabclose!
|
||||||
endfunc
|
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
|
" Test for the :! command
|
||||||
func Test_cmd_bang()
|
func Test_cmd_bang()
|
||||||
if !has('unix')
|
CheckUnix
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let lines =<< trim [SCRIPT]
|
let lines =<< trim [SCRIPT]
|
||||||
" Test for no previous command
|
" Test for no previous command
|
||||||
|
@ -649,6 +649,8 @@ func Test_reduce()
|
|||||||
call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E897:')
|
call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E897:')
|
||||||
call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E897:')
|
call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E897:')
|
||||||
call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E897:')
|
call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E897:')
|
||||||
|
call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E117:')
|
||||||
|
call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E39:')
|
||||||
|
|
||||||
let g:lut = [1, 2, 3, 4]
|
let g:lut = [1, 2, 3, 4]
|
||||||
func EvilRemove()
|
func EvilRemove()
|
||||||
|
@ -919,6 +919,33 @@ func Test_spellfile_COMMON()
|
|||||||
call delete('XtestCOMMON-utf8.spl')
|
call delete('XtestCOMMON-utf8.spl')
|
||||||
endfunc
|
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)
|
" Test CIRCUMFIX (see: :help spell-CIRCUMFIX)
|
||||||
func Test_spellfile_CIRCUMFIX()
|
func Test_spellfile_CIRCUMFIX()
|
||||||
" Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests
|
" Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests
|
||||||
|
@ -858,6 +858,44 @@ func Test_substitute_skipped_range()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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.
|
" This was using "old_sub" after it was freed.
|
||||||
func Test_using_old_sub()
|
func Test_using_old_sub()
|
||||||
" set compatible maxfuncdepth=10
|
" set compatible maxfuncdepth=10
|
||||||
|
Loading…
Reference in New Issue
Block a user