mirror of
https://github.com/vim/vim.git
synced 2025-10-02 05:04:20 -04:00
patch 8.0.0911: terminal test takes too long
Problem: Terminal test takes too long. Solution: Instead of "sleep 1" use a Python program to briefly sleep.
This commit is contained in:
11
src/testdir/test_short_sleep.py
Normal file
11
src/testdir/test_short_sleep.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# Program that sleeps for 100 msec
|
||||||
|
#
|
||||||
|
# This requires Python 2.6 or later.
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
time.sleep(0.1) # sleep 100 msec
|
@@ -6,6 +6,8 @@ endif
|
|||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
|
|
||||||
|
let s:python = PythonProg()
|
||||||
|
|
||||||
" Open a terminal with a shell, assign the job to g:job and return the buffer
|
" Open a terminal with a shell, assign the job to g:job and return the buffer
|
||||||
" number.
|
" number.
|
||||||
func Run_shell_in_terminal(options)
|
func Run_shell_in_terminal(options)
|
||||||
@@ -319,41 +321,46 @@ func Test_terminal_curwin()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_finish_close()
|
func Test_finish_close()
|
||||||
" TODO: use something that takes much less than a whole second
|
|
||||||
echo 'This will take five seconds...'
|
|
||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
|
|
||||||
if has('win32')
|
if s:python != ''
|
||||||
let cmd = $windir . '\system32\timeout.exe 1'
|
let cmd = s:python . " test_short_sleep.py"
|
||||||
|
let waittime = 500
|
||||||
else
|
else
|
||||||
let cmd = 'sleep 1'
|
echo 'This will take five seconds...'
|
||||||
|
let waittime = 2000
|
||||||
|
if has('win32')
|
||||||
|
let cmd = $windir . '\system32\timeout.exe 1'
|
||||||
|
else
|
||||||
|
let cmd = 'sleep 1'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
exe 'terminal ++close ' . cmd
|
exe 'terminal ++close ' . cmd
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
call assert_equal(2, winnr('$'))
|
call assert_equal(2, winnr('$'))
|
||||||
|
|
||||||
wincmd p
|
wincmd p
|
||||||
sleep 1200 msec
|
call WaitFor("winnr('$') == 1", waittime)
|
||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
|
|
||||||
call term_start(cmd, {'term_finish': 'close'})
|
call term_start(cmd, {'term_finish': 'close'})
|
||||||
call assert_equal(2, winnr('$'))
|
call assert_equal(2, winnr('$'))
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
wincmd p
|
wincmd p
|
||||||
sleep 1200 msec
|
call WaitFor("winnr('$') == 1", waittime)
|
||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
|
|
||||||
exe 'terminal ++open ' . cmd
|
exe 'terminal ++open ' . cmd
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
close
|
close
|
||||||
sleep 1200 msec
|
call WaitFor("winnr('$') == 2", waittime)
|
||||||
call assert_equal(2, winnr('$'))
|
call assert_equal(2, winnr('$'))
|
||||||
bwipe
|
bwipe
|
||||||
|
|
||||||
call term_start(cmd, {'term_finish': 'open'})
|
call term_start(cmd, {'term_finish': 'open'})
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
close
|
close
|
||||||
sleep 1200 msec
|
call WaitFor("winnr('$') == 2", waittime)
|
||||||
call assert_equal(2, winnr('$'))
|
call assert_equal(2, winnr('$'))
|
||||||
|
|
||||||
bwipe
|
bwipe
|
||||||
|
@@ -769,6 +769,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 */
|
||||||
|
/**/
|
||||||
|
911,
|
||||||
/**/
|
/**/
|
||||||
910,
|
910,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user