Merge pull request #21292 from zeertzjq/vim-8.2.1195

vim-patch:8.2.{1195,1197,2240,3108,3109,3495,3499,3526,5145}
This commit is contained in:
zeertzjq 2022-12-05 10:22:47 +08:00 committed by GitHub
commit 1c6f7e5933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 9 deletions

View File

@ -123,6 +123,14 @@ func CheckCanRunGui()
endif
endfunc
" Command to Check for an environment variable
command -nargs=1 CheckEnv call CheckEnv(<f-args>)
func CheckEnv(name)
if empty(eval('$' .. a:name))
throw 'Skipped: Environment variable ' .. a:name .. ' is not set'
endif
endfunc
" Command to check that we are using the GUI
command CheckGui call CheckGui()
func CheckGui()
@ -163,6 +171,22 @@ func CheckNotAsan()
endif
endfunc
" Command to check for not running under valgrind
command CheckNotValgrind call CheckNotValgrind()
func CheckNotValgrind()
if RunningWithValgrind()
throw 'Skipped: does not work well with valgrind'
endif
endfunc
" Command to check for X11 based GUI
command CheckX11BasedGui call CheckX11BasedGui()
func CheckX11BasedGui()
if !g:x11_based_gui
throw 'Skipped: requires X11 based GUI'
endif
endfunc
" Command to check for satisfying any of the conditions.
" e.g. CheckAnyOf Feature:bsd Feature:sun Linux
command -nargs=+ CheckAnyOf call CheckAnyOf(<f-args>)

View File

@ -285,6 +285,12 @@ func GetVimCommand(...)
return cmd
endfunc
" Return one when it looks like the tests are run with valgrind, which means
" that everything is much slower.
func RunningWithValgrind()
return GetVimCommand() =~ '\<valgrind\>'
endfunc
" Get the command to run Vim, with --clean instead of "-u NONE".
func GetVimCommandClean()
let cmd = GetVimCommand()

View File

@ -13,9 +13,7 @@ source shared.vim
func Check_X11_Connection()
if has('x11')
if empty($DISPLAY)
throw 'Skipped: $DISPLAY is not set'
endif
CheckEnv DISPLAY
try
call remote_send('xxx', '')
catch
@ -142,19 +140,19 @@ func Test_client_server()
" Edit multiple files using --remote
call system(cmd .. ' --remote Xfile1 Xfile2 Xfile3')
call assert_equal("Xfile1\nXfile2\nXfile3\n", remote_expr(name, 'argv()'))
call assert_match(".*Xfile1\n.*Xfile2\n.*Xfile3\n", remote_expr(name, 'argv()'))
eval name->remote_send(":%bw!\<CR>")
" Edit files in separate tab pages
call system(cmd .. ' --remote-tab Xfile1 Xfile2 Xfile3')
call WaitForAssert({-> assert_equal('3', remote_expr(name, 'tabpagenr("$")'))})
call assert_equal('Xfile2', remote_expr(name, 'bufname(tabpagebuflist(2)[0])'))
call assert_match('.*\<Xfile2', remote_expr(name, 'bufname(tabpagebuflist(2)[0])'))
eval name->remote_send(":%bw!\<CR>")
" Edit a file using --remote-wait
eval name->remote_send(":source $VIMRUNTIME/plugin/rrhelper.vim\<CR>")
call system(cmd .. ' --remote-wait +enew Xfile1')
call assert_equal("Xfile1", remote_expr(name, 'bufname("#")'))
call assert_match('.*\<Xfile1', remote_expr(name, 'bufname("#")'))
eval name->remote_send(":%bw!\<CR>")
" Edit files using --remote-tab-wait
@ -184,8 +182,10 @@ func Test_client_server()
call assert_fails('call remote_startserver([])', 'E730:')
call assert_fails("let x = remote_peek([])", 'E730:')
call assert_fails("let x = remote_read('vim10')", ['E573:.*vim10'])
call assert_fails("call server2client('abc', 'xyz')", ['E573:.*abc'])
call assert_fails("let x = remote_read('vim10')",
\ has('unix') ? ['E573:.*vim10'] : 'E277:')
call assert_fails("call server2client('abc', 'xyz')",
\ has('unix') ? ['E573:.*abc'] : 'E258:')
endfunc
" Uncomment this line to get a debugging log

View File

@ -117,6 +117,7 @@ func Test_exit_error_reading_input()
CheckNotMSWindows
" The early exit causes memory not to be freed somehow
CheckNotAsan
CheckNotValgrind
call writefile([":au VimLeave * call writefile(['l = ' .. v:exiting], 'Xtestout')", ":tabnew", "q:"], 'Xscript', 'b')

View File

@ -522,7 +522,14 @@ func Test_geometry()
[CODE]
if RunVim([], after, '-f -g -geometry 31x13+41+43')
let lines = readfile('Xtest_geometry')
call assert_equal(['31', '13', '41', '43', '[41, 43]'], lines)
" Depending on the GUI library and the windowing system the final size
" might be a bit different, allow for some tolerance. Tuned based on
" actual failures.
call assert_inrange(31, 35, str2nr(lines[0]))
call assert_equal('13', lines[1])
call assert_equal('41', lines[2])
call assert_equal('43', lines[3])
call assert_equal('[41, 43]', lines[4])
endif
endif