mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.1605: terminal test is a bit flaky
Problem: Terminal test is a bit flaky. Solution: Check for the shell prompt. Use more lambda functions.
This commit is contained in:
parent
a903472cfa
commit
012eb66293
@ -432,39 +432,38 @@ func Test_terminal_servername()
|
|||||||
if !has('clientserver')
|
if !has('clientserver')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let g:buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
" Wait for the shell to display a prompt
|
" Wait for the shell to display a prompt
|
||||||
call WaitFor('term_getline(g:buf, 1) != ""')
|
call WaitFor({-> term_getline(buf, 1) != ""})
|
||||||
if has('win32')
|
if has('win32')
|
||||||
call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r")
|
call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r")
|
||||||
else
|
else
|
||||||
call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r")
|
call term_sendkeys(buf, "echo $VIM_SERVERNAME\r")
|
||||||
endif
|
endif
|
||||||
call term_wait(g:buf)
|
call term_wait(buf)
|
||||||
call Stop_shell_in_terminal(g:buf)
|
call Stop_shell_in_terminal(buf)
|
||||||
call WaitFor('getline(2) == v:servername')
|
call WaitFor('getline(2) == v:servername')
|
||||||
call assert_equal(v:servername, getline(2))
|
call assert_equal(v:servername, getline(2))
|
||||||
|
|
||||||
exe g:buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
unlet g:buf
|
unlet buf
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_env()
|
func Test_terminal_env()
|
||||||
let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
|
let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
|
||||||
" Wait for the shell to display a prompt
|
" Wait for the shell to display a prompt
|
||||||
call WaitFor('term_getline(g:buf, 1) != ""')
|
call WaitFor({-> term_getline(buf, 1) != ""})
|
||||||
if has('win32')
|
if has('win32')
|
||||||
call term_sendkeys(g:buf, "echo %TESTENV%\r")
|
call term_sendkeys(buf, "echo %TESTENV%\r")
|
||||||
else
|
else
|
||||||
call term_sendkeys(g:buf, "echo $TESTENV\r")
|
call term_sendkeys(buf, "echo $TESTENV\r")
|
||||||
endif
|
endif
|
||||||
call term_wait(g:buf)
|
call term_wait(buf)
|
||||||
call Stop_shell_in_terminal(g:buf)
|
call Stop_shell_in_terminal(buf)
|
||||||
call WaitFor('getline(2) == "correct"')
|
call WaitFor('getline(2) == "correct"')
|
||||||
call assert_equal('correct', getline(2))
|
call assert_equal('correct', getline(2))
|
||||||
|
|
||||||
exe g:buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
unlet g:buf
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" must be last, we can't go back from GUI to terminal
|
" must be last, we can't go back from GUI to terminal
|
||||||
@ -591,8 +590,7 @@ func Test_terminal_no_cmd()
|
|||||||
else
|
else
|
||||||
call system('echo "look here" > ' . pty)
|
call system('echo "look here" > ' . pty)
|
||||||
endif
|
endif
|
||||||
let g:buf = buf
|
call WaitFor({-> term_getline(buf, 1) =~ "look here"})
|
||||||
call WaitFor('term_getline(g:buf, 1) =~ "look here"')
|
|
||||||
|
|
||||||
call assert_match('look here', term_getline(buf, 1))
|
call assert_match('look here', term_getline(buf, 1))
|
||||||
bwipe!
|
bwipe!
|
||||||
@ -672,8 +670,7 @@ func TerminalTmap(remap)
|
|||||||
call assert_equal('456', maparg('123', 't'))
|
call assert_equal('456', maparg('123', 't'))
|
||||||
call assert_equal('abxde', maparg('456', 't'))
|
call assert_equal('abxde', maparg('456', 't'))
|
||||||
call feedkeys("123", 'tx')
|
call feedkeys("123", 'tx')
|
||||||
let g:buf = buf
|
call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'})
|
||||||
call WaitFor("term_getline(g:buf,term_getcursor(g:buf)[0]) =~ 'abxde\\|456'")
|
|
||||||
let lnum = term_getcursor(buf)[0]
|
let lnum = term_getcursor(buf)[0]
|
||||||
if a:remap
|
if a:remap
|
||||||
call assert_match('abxde', term_getline(buf, lnum))
|
call assert_match('abxde', term_getline(buf, lnum))
|
||||||
@ -816,12 +813,9 @@ func Test_terminal_response_to_control_sequence()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call term_wait(buf)
|
call WaitFor({-> term_getline(buf, 1) != ""})
|
||||||
|
|
||||||
new
|
call writefile(["\x1b[6n"], 'Xescape')
|
||||||
call setline(1, "\x1b[6n")
|
|
||||||
write! Xescape
|
|
||||||
bwipe
|
|
||||||
call term_sendkeys(buf, "cat Xescape\<cr>")
|
call term_sendkeys(buf, "cat Xescape\<cr>")
|
||||||
|
|
||||||
" wait for the response of control sequence from libvterm (and send it to tty)
|
" wait for the response of control sequence from libvterm (and send it to tty)
|
||||||
@ -909,7 +903,7 @@ func Test_terminal_qall_prompt()
|
|||||||
quit
|
quit
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminalopen_autocmd()
|
func Test_terminal_open_autocmd()
|
||||||
augroup repro
|
augroup repro
|
||||||
au!
|
au!
|
||||||
au TerminalOpen * let s:called += 1
|
au TerminalOpen * let s:called += 1
|
||||||
|
@ -766,6 +766,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 */
|
||||||
|
/**/
|
||||||
|
1605,
|
||||||
/**/
|
/**/
|
||||||
1604,
|
1604,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user