Skip to content

Commit c087061

Browse files
committed
patch 8.0.0940: Test_terminal_scrape_multibyte is flaky
Problem: Test_terminal_scrape_multibyte is flaky. (James McCoy) Solution: Use WaitFor() instead of term_wait().
1 parent 51c2368 commit c087061

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

src/testdir/test_terminal.vim

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,10 @@ func Test_terminal_scrape_multibyte()
189189
else
190190
let cmd = "cat Xtext"
191191
endif
192-
let buf = term_start(cmd)
193-
194-
call term_wait(buf)
195-
if has('win32')
196-
" TODO: this should not be needed
197-
sleep 100m
198-
endif
192+
let g:buf = term_start(cmd)
199193

200-
let l = term_scrape(buf, 1)
194+
call WaitFor('term_scrape(g:buf, 1)[0].chars == "l"')
195+
let l = term_scrape(g:buf, 1)
201196
call assert_true(len(l) >= 7)
202197
call assert_equal('l', l[0].chars)
203198
call assert_equal('é', l[1].chars)
@@ -209,11 +204,12 @@ func Test_terminal_scrape_multibyte()
209204
call assert_equal('r', l[5].chars)
210205
call assert_equal('s', l[6].chars)
211206

212-
let g:job = term_getjob(buf)
207+
let g:job = term_getjob(g:buf)
213208
call WaitFor('job_status(g:job) == "dead"')
214-
call term_wait(buf)
209+
call term_wait(g:buf)
215210

216-
exe buf . 'bwipe'
211+
exe g:buf . 'bwipe'
212+
unlet g:buf
217213
call delete('Xtext')
218214
endfunc
219215

@@ -409,16 +405,17 @@ func Test_terminal_env()
409405
if !has('unix')
410406
return
411407
endif
412-
let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
408+
let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
413409
" Wait for the shell to display a prompt
414-
call WaitFor('term_getline(1) != ""')
415-
call term_sendkeys(buf, "echo $TESTENV\r")
416-
call term_wait(buf)
417-
call Stop_shell_in_terminal(buf)
410+
call WaitFor('term_getline(g:buf, 1) != ""')
411+
call term_sendkeys(g:buf, "echo $TESTENV\r")
412+
call term_wait(g:buf)
413+
call Stop_shell_in_terminal(g:buf)
418414
call WaitFor('getline(2) == "correct"')
419415
call assert_equal('correct', getline(2))
420416

421-
exe buf . 'bwipe'
417+
exe g:buf . 'bwipe'
418+
unlet g:buf
422419
endfunc
423420

424421
" must be last, we can't go back from GUI to terminal

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
940,
772774
/**/
773775
939,
774776
/**/

0 commit comments

Comments
 (0)