Merge pull request #20816 from zeertzjq/vim-8.1.1826

vim-patch:8.1.1826,9.0.0019
This commit is contained in:
zeertzjq
2022-10-26 22:38:25 +08:00
committed by GitHub
15 changed files with 71 additions and 59 deletions

View File

@@ -39,6 +39,22 @@ func CheckFunction(name)
endif endif
endfunc endfunc
" Command to check for the presence of an Ex command
command -nargs=1 CheckCommand call CheckCommand(<f-args>)
func CheckCommand(name)
if !exists(':' .. a:name)
throw 'Skipped: ' .. a:name .. ' command not supported'
endif
endfunc
" Command to check for the presence of a shell command
command -nargs=1 CheckExecutable call CheckExecutable(<f-args>)
func CheckExecutable(name)
if !executable(a:name)
throw 'Skipped: ' .. a:name .. ' program not executable'
endif
endfunc
" Command to check for the presence of python. Argument should have been " Command to check for the presence of python. Argument should have been
" obtained with PythonProg() " obtained with PythonProg()
func CheckPython(name) func CheckPython(name)

View File

@@ -4,9 +4,8 @@
" while the test is run, the breakindent caching gets in its way. " while the test is run, the breakindent caching gets in its way.
" It helps to change the tabstop setting and force a redraw (e.g. see " It helps to change the tabstop setting and force a redraw (e.g. see
" Test_breakindent08()) " Test_breakindent08())
if !exists('+breakindent') source check.vim
throw 'Skipped: breakindent option not supported' CheckOption breakindent
endif
source view_util.vim source view_util.vim

View File

@@ -2,6 +2,7 @@
source shared.vim source shared.vim
source screendump.vim source screendump.vim
source check.vim
func Test_setbufline_getbufline() func Test_setbufline_getbufline()
new new
@@ -130,9 +131,8 @@ func Test_deletebufline()
endfunc endfunc
func Test_appendbufline_redraw() func Test_appendbufline_redraw()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
new foo new foo
let winnr = 'foo'->bufwinnr() let winnr = 'foo'->bufwinnr()

View File

@@ -1,5 +1,6 @@
" Test for folding " Test for folding
source check.vim
source view_util.vim source view_util.vim
source screendump.vim source screendump.vim
@@ -727,9 +728,7 @@ func Test_fold_last_line_with_pagedown()
endfunc endfunc
func Test_folds_with_rnu() func Test_folds_with_rnu()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
call writefile([ call writefile([
\ 'set fdm=marker rnu foldcolumn=2', \ 'set fdm=marker rnu foldcolumn=2',

View File

@@ -1745,9 +1745,8 @@ endfunc
func Test_confirm() func Test_confirm()
" requires a UI to be active " requires a UI to be active
throw 'Skipped: use test/functional/vimscript/input_spec.lua' throw 'Skipped: use test/functional/vimscript/input_spec.lua'
if !has('unix') || has('gui_running') CheckUnix
return CheckNotGui
endif
call feedkeys('o', 'L') call feedkeys('o', 'L')
let a = confirm('Press O to proceed') let a = confirm('Press O to proceed')

View File

@@ -536,9 +536,7 @@ func Test_termguicolors()
endfunc endfunc
func Test_cursorline_after_yank() func Test_cursorline_after_yank()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
call writefile([ call writefile([
\ 'set cul rnu', \ 'set cul rnu',
@@ -578,9 +576,7 @@ func Test_put_before_cursorline()
endfunc endfunc
func Test_cursorline_with_visualmode() func Test_cursorline_with_visualmode()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
call writefile([ call writefile([
\ 'set cul', \ 'set cul',

View File

@@ -395,7 +395,9 @@ func Test_motionforce_omap()
endfunc endfunc
func Test_error_in_map_expr() func Test_error_in_map_expr()
if !has('terminal') || (has('win32') && has('gui_running')) " Unlike CheckRunVimInTerminal this does work in a win32 console
CheckFeature terminal
if has('win32') && has('gui_running')
throw 'Skipped: cannot run Vim in a terminal window' throw 'Skipped: cannot run Vim in a terminal window'
endif endif

View File

@@ -322,9 +322,8 @@ func OtherWindowCommon()
endfunc endfunc
func Test_matchdelete_other_window() func Test_matchdelete_other_window()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let buf = OtherWindowCommon() let buf = OtherWindowCommon()
call term_sendkeys(buf, ":call matchdelete(mid, winid)\<CR>") call term_sendkeys(buf, ":call matchdelete(mid, winid)\<CR>")
call VerifyScreenDump(buf, 'Test_matchdelete_1', {}) call VerifyScreenDump(buf, 'Test_matchdelete_1', {})

View File

@@ -432,9 +432,8 @@ endfunc
" Must be executed before other tests that set 'term'. " Must be executed before other tests that set 'term'.
func Test_000_term_option_verbose() func Test_000_term_option_verbose()
if has('nvim') || has('gui_running') throw "Skipped: Nvim does not support setting 'term'"
return CheckNotGui
endif
call CheckWasNotSet('t_cm') call CheckWasNotSet('t_cm')

View File

@@ -677,9 +677,9 @@ func Test_complete_CTRLN_startofbuffer()
endfunc endfunc
func Test_popup_and_window_resize() func Test_popup_and_window_resize()
if !has('terminal') || has('gui_running') CheckFeature terminal
return CheckNotGui
endif
let h = winheight(0) let h = winheight(0)
if h < 15 if h < 15
return return
@@ -948,9 +948,9 @@ func Test_complete_o_tab()
endfunc endfunc
func Test_menu_only_exists_in_terminal() func Test_menu_only_exists_in_terminal()
if !exists(':tlmenu') || has('gui_running') CheckCommand tlmenu
return CheckNotGui
endif
tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+ tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+
aunmenu * aunmenu *
try try

View File

@@ -16,8 +16,9 @@ endfunc
" Test signal WINCH (window resize signal) " Test signal WINCH (window resize signal)
func Test_signal_WINCH() func Test_signal_WINCH()
throw 'skipped: Nvim cannot avoid terminal resize' throw 'skipped: Nvim cannot avoid terminal resize'
if has('gui_running') || !HasSignal('WINCH') CheckNotGui
return if !HasSignal('WINCH')
throw 'Skipped: WINCH signal not supported'
endif endif
" We do not actually want to change the size of the terminal. " We do not actually want to change the size of the terminal.

View File

@@ -267,10 +267,9 @@ endfunc
" Test the -V[N] argument to set the 'verbose' option to [N] " Test the -V[N] argument to set the 'verbose' option to [N]
func Test_V_arg() func Test_V_arg()
if has('gui_running') " Can't catch the output of gvim.
" Can't catch the output of gvim. CheckNotGui
return
endif
let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq') let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
call assert_equal(" verbose=0\n", out) call assert_equal(" verbose=0\n", out)
@@ -543,10 +542,9 @@ endfunc
func Test_invalid_args() func Test_invalid_args()
if !has('unix') || has('gui_running') " must be able to get the output of Vim.
" can't get output of Vim. CheckUnix
return CheckNotGui
endif
for opt in ['-Y', '--does-not-exist'] for opt in ['-Y', '--does-not-exist']
let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
@@ -747,10 +745,9 @@ func Test_progpath()
endfunc endfunc
func Test_silent_ex_mode() func Test_silent_ex_mode()
if !has('unix') || has('gui_running') " must be able to get the output of Vim.
" can't get output of Vim. CheckUnix
return CheckNotGui
endif
" This caused an ml_get error. " This caused an ml_get error.
let out = system(GetVimCommand() . ' -u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq') let out = system(GetVimCommand() . ' -u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
@@ -758,10 +755,9 @@ func Test_silent_ex_mode()
endfunc endfunc
func Test_default_term() func Test_default_term()
if !has('unix') || has('gui_running') " must be able to get the output of Vim.
" can't get output of Vim. CheckUnix
return CheckNotGui
endif
let save_term = $TERM let save_term = $TERM
let $TERM = 'unknownxxx' let $TERM = 'unknownxxx'
@@ -796,6 +792,15 @@ func Test_zzz_startinsert()
call delete('Xtestout') call delete('Xtestout')
endfunc endfunc
func Test_issue_3969()
" Can't catch the output of gvim.
CheckNotGui
" Check that message is not truncated.
let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
call assert_equal('hello', out)
endfunc
func Test_start_with_tabs() func Test_start_with_tabs()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return return

View File

@@ -489,9 +489,8 @@ func Test_conceal()
endfunc endfunc
func Test_bg_detection() func Test_bg_detection()
if has('gui_running') CheckNotGui
return
endif
" auto-detection of &bg, make sure sure it isn't set anywhere before " auto-detection of &bg, make sure sure it isn't set anywhere before
" this test " this test
hi Normal ctermbg=0 hi Normal ctermbg=0

View File

@@ -264,8 +264,9 @@ endfunc
func Test_timer_peek_and_get_char() func Test_timer_peek_and_get_char()
if !has('unix') && !has('gui_running') if !has('unix') && !has('gui_running')
return throw 'Skipped: cannot feed low-level input'
endif endif
call timer_start(0, 'FeedAndPeek') call timer_start(0, 'FeedAndPeek')
let intr = timer_start(100, 'Interrupt') let intr = timer_start(100, 'Interrupt')
let c = getchar() let c = getchar()
@@ -275,9 +276,9 @@ endfunc
func Test_timer_getchar_zero() func Test_timer_getchar_zero()
if has('win32') && !has('gui_running') if has('win32') && !has('gui_running')
" Console: no low-level input throw 'Skipped: cannot feed low-level input'
return
endif endif
CheckFunction reltimefloat
" Measure the elapsed time to avoid a hang when it fails. " Measure the elapsed time to avoid a hang when it fails.
let start = reltime() let start = reltime()

View File

@@ -1747,10 +1747,7 @@ func Test_funccall_garbage_collect()
endfunc endfunc
func Test_function_defined_line() func Test_function_defined_line()
if has('gui_running') CheckNotGui
" Can't catch the output of gvim.
return
endif
let lines =<< trim [CODE] let lines =<< trim [CODE]
" F1 " F1