mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.4078: terminal test for current directory not used on FreeBSD
Problem: Terminal test for current directory not used on FreeBSD. Solution: Make it work on FreeBSD. (Ozaki Kiichi, closes #9516) Add TermWait() inside Run_shell_in_terminal() as a generic solution.
This commit is contained in:
@@ -24,6 +24,7 @@ func StopShellInTerminal(buf)
|
|||||||
call term_sendkeys(a:buf, "exit\r")
|
call term_sendkeys(a:buf, "exit\r")
|
||||||
let job = term_getjob(a:buf)
|
let job = term_getjob(a:buf)
|
||||||
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
||||||
|
call TermWait(a:buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Wrapper around term_wait() to allow more time for re-runs of flaky tests
|
" Wrapper around term_wait() to allow more time for re-runs of flaky tests
|
||||||
@@ -176,6 +177,10 @@ func Run_shell_in_terminal(options)
|
|||||||
let string = string({'job': buf->term_getjob()})
|
let string = string({'job': buf->term_getjob()})
|
||||||
call assert_match("{'job': 'process \\d\\+ run'}", string)
|
call assert_match("{'job': 'process \\d\\+ run'}", string)
|
||||||
|
|
||||||
|
" On slower systems it may take a bit of time before the shell is ready to
|
||||||
|
" accept keys. This mainly matters when using term_sendkeys() next.
|
||||||
|
call TermWait(buf)
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -976,7 +976,6 @@ func Test_map_cmdkey()
|
|||||||
call assert_equal('t', m)
|
call assert_equal('t', m)
|
||||||
call assert_equal('t', mode(1))
|
call assert_equal('t', mode(1))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
close!
|
close!
|
||||||
tunmap <F3>
|
tunmap <F3>
|
||||||
endif
|
endif
|
||||||
|
@@ -26,7 +26,6 @@ func Test_terminal_basic()
|
|||||||
call assert_fails('set modifiable', 'E946:')
|
call assert_fails('set modifiable', 'E946:')
|
||||||
|
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
call assert_equal('n', mode())
|
call assert_equal('n', mode())
|
||||||
call assert_match('%aF[^\n]*finished]', execute('ls'))
|
call assert_match('%aF[^\n]*finished]', execute('ls'))
|
||||||
call assert_match('%aF[^\n]*finished]', execute('ls F'))
|
call assert_match('%aF[^\n]*finished]', execute('ls F'))
|
||||||
@@ -48,7 +47,6 @@ func Test_terminal_no_name()
|
|||||||
call assert_equal("", bufname(buf))
|
call assert_equal("", bufname(buf))
|
||||||
call assert_match('\[No Name\]', execute('file'))
|
call assert_match('\[No Name\]', execute('file'))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_TerminalWinOpen()
|
func Test_terminal_TerminalWinOpen()
|
||||||
@@ -71,7 +69,6 @@ endfunc
|
|||||||
func Test_terminal_make_change()
|
func Test_terminal_make_change()
|
||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
|
|
||||||
setlocal modifiable
|
setlocal modifiable
|
||||||
exe "normal Axxx\<Esc>"
|
exe "normal Axxx\<Esc>"
|
||||||
@@ -109,7 +106,6 @@ endfunc
|
|||||||
|
|
||||||
func Test_terminal_split_quit()
|
func Test_terminal_split_quit()
|
||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call TermWait(buf)
|
|
||||||
split
|
split
|
||||||
quit!
|
quit!
|
||||||
call TermWait(buf)
|
call TermWait(buf)
|
||||||
@@ -363,7 +359,6 @@ func Test_terminal_scrollback()
|
|||||||
call assert_inrange(91, 100, lines)
|
call assert_inrange(91, 100, lines)
|
||||||
|
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
set termwinscroll&
|
set termwinscroll&
|
||||||
call delete('Xtext')
|
call delete('Xtext')
|
||||||
@@ -751,7 +746,6 @@ func Test_terminal_noblock()
|
|||||||
|
|
||||||
let g:job = term_getjob(buf)
|
let g:job = term_getjob(buf)
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
unlet g:job
|
unlet g:job
|
||||||
bwipe
|
bwipe
|
||||||
endfunc
|
endfunc
|
||||||
@@ -934,7 +928,6 @@ func TerminalTmap(remap)
|
|||||||
|
|
||||||
call term_sendkeys(buf, "\r")
|
call term_sendkeys(buf, "\r")
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
|
|
||||||
tunmap 123
|
tunmap 123
|
||||||
tunmap 456
|
tunmap 456
|
||||||
@@ -952,7 +945,6 @@ func Test_terminal_wall()
|
|||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
wall
|
wall
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
unlet g:job
|
unlet g:job
|
||||||
endfunc
|
endfunc
|
||||||
@@ -961,7 +953,6 @@ func Test_terminal_wqall()
|
|||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call assert_fails('wqall', 'E948:')
|
call assert_fails('wqall', 'E948:')
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
unlet g:job
|
unlet g:job
|
||||||
endfunc
|
endfunc
|
||||||
@@ -2001,7 +1992,6 @@ func Test_terminal_ansicolors_default()
|
|||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call assert_equal(colors, term_getansicolors(buf))
|
call assert_equal(colors, term_getansicolors(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
call assert_equal([], term_getansicolors(buf))
|
call assert_equal([], term_getansicolors(buf))
|
||||||
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
@@ -2026,7 +2016,6 @@ func Test_terminal_ansicolors_global()
|
|||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
|
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
unlet g:terminal_ansi_colors
|
unlet g:terminal_ansi_colors
|
||||||
@@ -2060,7 +2049,6 @@ func Test_terminal_ansicolors_func()
|
|||||||
call assert_fails('call term_setansicolors(buf, {})', 'E714:')
|
call assert_fails('call term_setansicolors(buf, {})', 'E714:')
|
||||||
|
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
call assert_equal(0, term_setansicolors(buf, []))
|
call assert_equal(0, term_setansicolors(buf, []))
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -49,7 +49,6 @@ func Test_terminal_termwinsize_option_zero()
|
|||||||
let win = bufwinid(buf)
|
let win = bufwinid(buf)
|
||||||
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
|
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
|
|
||||||
set termwinsize=7x0
|
set termwinsize=7x0
|
||||||
@@ -57,7 +56,6 @@ func Test_terminal_termwinsize_option_zero()
|
|||||||
let win = bufwinid(buf)
|
let win = bufwinid(buf)
|
||||||
call assert_equal([7, winwidth(win)], term_getsize(buf))
|
call assert_equal([7, winwidth(win)], term_getsize(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
|
|
||||||
set termwinsize=0x33
|
set termwinsize=0x33
|
||||||
@@ -65,7 +63,6 @@ func Test_terminal_termwinsize_option_zero()
|
|||||||
let win = bufwinid(buf)
|
let win = bufwinid(buf)
|
||||||
call assert_equal([winheight(win), 33], term_getsize(buf))
|
call assert_equal([winheight(win), 33], term_getsize(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
|
|
||||||
set termwinsize=
|
set termwinsize=
|
||||||
@@ -95,7 +92,6 @@ func Test_terminal_termwinsize_minimum()
|
|||||||
call assert_equal(30, winwidth(win))
|
call assert_equal(30, winwidth(win))
|
||||||
|
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
|
|
||||||
set termwinsize=0*0
|
set termwinsize=0*0
|
||||||
@@ -103,7 +99,6 @@ func Test_terminal_termwinsize_minimum()
|
|||||||
let win = bufwinid(buf)
|
let win = bufwinid(buf)
|
||||||
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
|
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
|
|
||||||
set termwinsize=
|
set termwinsize=
|
||||||
@@ -287,7 +282,6 @@ func Test_zz1_terminal_in_gui()
|
|||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
let buf = Run_shell_in_terminal({'term_finish': 'close'})
|
let buf = Run_shell_in_terminal({'term_finish': 'close'})
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
|
|
||||||
" closing window wipes out the terminal buffer a with finished job
|
" closing window wipes out the terminal buffer a with finished job
|
||||||
call WaitForAssert({-> assert_equal(1, winnr('$'))})
|
call WaitForAssert({-> assert_equal(1, winnr('$'))})
|
||||||
@@ -572,7 +566,6 @@ func Test_term_gettty()
|
|||||||
call assert_equal('', term_gettty(buf + 1))
|
call assert_equal('', term_gettty(buf + 1))
|
||||||
|
|
||||||
call StopShellInTerminal(buf)
|
call StopShellInTerminal(buf)
|
||||||
call TermWait(buf)
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -779,8 +779,6 @@ endfunc
|
|||||||
func Test_terminal_sync_shell_dir()
|
func Test_terminal_sync_shell_dir()
|
||||||
CheckUnix
|
CheckUnix
|
||||||
" The test always use sh (see src/testdir/unix.vim).
|
" The test always use sh (see src/testdir/unix.vim).
|
||||||
" However, BSD's sh doesn't seem to play well with OSC 7 escape sequence.
|
|
||||||
CheckNotBSD
|
|
||||||
|
|
||||||
set asd
|
set asd
|
||||||
" , is
|
" , is
|
||||||
@@ -789,15 +787,15 @@ func Test_terminal_sync_shell_dir()
|
|||||||
let chars = ",a"
|
let chars = ",a"
|
||||||
" "," is url-encoded as '%2C'
|
" "," is url-encoded as '%2C'
|
||||||
let chars_url = "%2Ca"
|
let chars_url = "%2Ca"
|
||||||
let tmpfolder = fnamemodify(tempname(),':h').'/'.chars
|
let tmpfolder = fnamemodify(tempname(),':h') .. '/' .. chars
|
||||||
let tmpfolder_url = fnamemodify(tempname(),':h').'/'.chars_url
|
let tmpfolder_url = fnamemodify(tempname(),':h') .. '/' .. chars_url
|
||||||
call mkdir(tmpfolder, "p")
|
call mkdir(tmpfolder, "p")
|
||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call term_sendkeys(buf, "echo -ne $'\\e\]7;file://".tmpfolder_url."\\a'\<CR>")
|
call term_sendkeys(buf, "echo $'\\e\]7;file://" .. tmpfolder_url .. "\\a'\<CR>")
|
||||||
"call term_sendkeys(buf, "cd ".tmpfolder."\<CR>")
|
"call term_sendkeys(buf, "cd " .. tmpfolder .. "\<CR>")
|
||||||
call TermWait(buf)
|
call TermWait(buf)
|
||||||
if has("mac")
|
if has("mac")
|
||||||
let expected = "/private".tmpfolder
|
let expected = "/private" .. tmpfolder
|
||||||
else
|
else
|
||||||
let expected = tmpfolder
|
let expected = tmpfolder
|
||||||
endif
|
endif
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4078,
|
||||||
/**/
|
/**/
|
||||||
4077,
|
4077,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user