Skip to content

Commit 733d259

Browse files
committed
patch 8.2.1498: on slow systems tests can be flaky
Problem: On slow systems tests can be flaky. Solution: Use TermWait() instead of term-wait(). (Yegappan Lakshmanan, closes #6756)
1 parent 17f6754 commit 733d259

8 files changed

Lines changed: 39 additions & 37 deletions

File tree

src/testdir/test_digraph.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,13 @@ func Test_entering_digraph()
504504
CheckRunVimInTerminal
505505
let buf = RunVimInTerminal('', {'rows': 6})
506506
call term_sendkeys(buf, "i\<C-K>")
507-
call term_wait(buf)
507+
call TermWait(buf)
508508
call assert_equal('?', term_getline(buf, 1))
509509
call term_sendkeys(buf, "1")
510-
call term_wait(buf)
510+
call TermWait(buf)
511511
call assert_equal('1', term_getline(buf, 1))
512512
call term_sendkeys(buf, "2")
513-
call term_wait(buf)
513+
call TermWait(buf)
514514
call assert_equal('½', term_getline(buf, 1))
515515
call StopVimInTerminal(buf)
516516
endfunc

src/testdir/test_display.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func Test_display_scroll_at_topline()
250250

251251
let buf = RunVimInTerminal('', #{cols: 20})
252252
call term_sendkeys(buf, ":call setline(1, repeat('a', 21))\<CR>")
253-
call term_wait(buf)
253+
call TermWait(buf)
254254
call term_sendkeys(buf, "O\<Esc>")
255255
call VerifyScreenDump(buf, 'Test_display_scroll_at_topline', #{rows: 4})
256256

src/testdir/test_popupwin.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@ func Test_popupwin_close_prevwin()
25662566
call assert_equal(2, winnr())
25672567
let buf = term_start(&shell, #{hidden: 1})
25682568
call popup_create(buf, {})
2569-
call term_wait(buf, 100)
2569+
call TermWait(buf, 100)
25702570
call popup_clear(1)
25712571
call assert_equal(2, winnr())
25722572

src/testdir/test_termcodes.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,9 +1898,9 @@ func Test_list_builtin_terminals()
18981898
CheckRunVimInTerminal
18991899
let buf = RunVimInTerminal('', #{rows: 14})
19001900
call term_sendkeys(buf, ":set cmdheight=3\<CR>")
1901-
call term_wait(buf, 100)
1901+
call TermWait(buf, 100)
19021902
call term_sendkeys(buf, ":set term=xxx\<CR>")
1903-
call term_wait(buf, 100)
1903+
call TermWait(buf, 100)
19041904
call assert_match('builtin_dumb', term_getline(buf, 11))
19051905
call assert_match('Not found in termcap', term_getline(buf, 12))
19061906
call StopVimInTerminal(buf)

src/testdir/test_terminal.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ func Test_terminal_one_column()
264264
let width = &columns
265265
botright vert term
266266
let buf = bufnr('$')
267-
call term_wait(buf, 100)
267+
call TermWait(buf, 100)
268268
exe "set columns=" .. (width / 2)
269269
redraw
270270
call term_sendkeys(buf, "")
271-
call term_wait(buf, 10)
271+
call TermWait(buf, 10)
272272
exe "set columns=" .. width
273273
exe buf . 'bwipe!'
274274
endfunc
@@ -1221,7 +1221,7 @@ func Test_terminal_dumpwrite_errors()
12211221
CheckRunVimInTerminal
12221222
call assert_fails("call term_dumpwrite({}, 'Xtest.dump')", 'E728:')
12231223
let buf = RunVimInTerminal('', {})
1224-
call term_wait(buf)
1224+
call TermWait(buf)
12251225
call assert_fails("call term_dumpwrite(buf, 'Xtest.dump', '')", 'E715:')
12261226
call assert_fails("call term_dumpwrite(buf, [])", 'E730:')
12271227
call writefile([], 'Xtest.dump')
@@ -1231,7 +1231,7 @@ func Test_terminal_dumpwrite_errors()
12311231
call assert_fails("call term_dumpwrite(buf, test_null_string())", 'E482:')
12321232
call test_garbagecollect_now()
12331233
call StopVimInTerminal(buf)
1234-
call term_wait(buf)
1234+
call TermWait(buf)
12351235
call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E958:')
12361236
call assert_fails('call term_sendkeys([], ":q\<CR>")', 'E745:')
12371237
call assert_equal(0, term_sendkeys(buf, ":q\<CR>"))

src/testdir/test_terminal3.vim

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ func Test_term_mouse()
374374
call term_sendkeys(buf, ":set mouse=a term=xterm ttymouse=sgr\<CR>")
375375
call term_sendkeys(buf, ":set clipboard=\<CR>")
376376
call term_sendkeys(buf, ":set mousemodel=extend\<CR>")
377-
call term_wait(buf)
377+
call TermWait(buf)
378378
redraw!
379379

380380
" Use the mouse to enter the terminal window
@@ -388,9 +388,9 @@ func Test_term_mouse()
388388
call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt')
389389
call test_setmouse(3, 8)
390390
call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>")
391-
call term_wait(buf, 50)
391+
call TermWait(buf, 50)
392392
call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\<CR>")
393-
call term_wait(buf, 50)
393+
call TermWait(buf, 50)
394394
let pos = json_decode(readfile('Xbuf')[0])
395395
call assert_equal([3, 8], pos[1:2])
396396

@@ -400,9 +400,9 @@ func Test_term_mouse()
400400
call term_sendkeys(buf, "\<LeftMouse>")
401401
call test_setmouse(2, 16)
402402
call term_sendkeys(buf, "\<LeftRelease>y")
403-
call term_wait(buf, 50)
403+
call TermWait(buf, 50)
404404
call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
405-
call term_wait(buf, 50)
405+
call TermWait(buf, 50)
406406
call assert_equal('yellow', readfile('Xbuf')[0])
407407

408408
" Test for selecting text using doubleclick
@@ -411,18 +411,18 @@ func Test_term_mouse()
411411
call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>")
412412
call test_setmouse(1, 17)
413413
call term_sendkeys(buf, "\<LeftRelease>y")
414-
call term_wait(buf, 50)
414+
call TermWait(buf, 50)
415415
call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
416-
call term_wait(buf, 50)
416+
call TermWait(buf, 50)
417417
call assert_equal('three four', readfile('Xbuf')[0])
418418

419419
" Test for selecting a line using triple click
420420
call delete('Xbuf')
421421
call test_setmouse(3, 2)
422422
call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>y")
423-
call term_wait(buf, 50)
423+
call TermWait(buf, 50)
424424
call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
425-
call term_wait(buf, 50)
425+
call TermWait(buf, 50)
426426
call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0])
427427

428428
" Test for selecting a block using qudraple click
@@ -431,9 +431,9 @@ func Test_term_mouse()
431431
call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>")
432432
call test_setmouse(3, 13)
433433
call term_sendkeys(buf, "\<LeftRelease>y")
434-
call term_wait(buf, 50)
434+
call TermWait(buf, 50)
435435
call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
436-
call term_wait(buf, 50)
436+
call TermWait(buf, 50)
437437
call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0])
438438

439439
" Test for extending a selection using right click
@@ -442,23 +442,23 @@ func Test_term_mouse()
442442
call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>")
443443
call test_setmouse(2, 16)
444444
call term_sendkeys(buf, "\<RightMouse>\<RightRelease>y")
445-
call term_wait(buf, 50)
445+
call TermWait(buf, 50)
446446
call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
447-
call term_wait(buf, 50)
447+
call TermWait(buf, 50)
448448
call assert_equal("n yellow", readfile('Xbuf')[0])
449449

450450
" Test for pasting text using middle click
451451
call delete('Xbuf')
452452
call term_sendkeys(buf, ":let @r='bright '\<CR>")
453453
call test_setmouse(2, 22)
454454
call term_sendkeys(buf, "\"r\<MiddleMouse>\<MiddleRelease>")
455-
call term_wait(buf, 50)
455+
call TermWait(buf, 50)
456456
call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>")
457-
call term_wait(buf, 50)
457+
call TermWait(buf, 50)
458458
call assert_equal("red bright blue", readfile('Xbuf')[0][-15:])
459459

460460
" cleanup
461-
call term_wait(buf)
461+
call TermWait(buf)
462462
call StopVimInTerminal(buf)
463463
let &mouse = save_mouse
464464
let &term = save_term
@@ -494,14 +494,14 @@ func Test_term_modeless_selection()
494494
let buf = RunVimInTerminal('Xtest_modeless -n', {})
495495
call term_sendkeys(buf, ":set nocompatible\<CR>")
496496
call term_sendkeys(buf, ":set mouse=\<CR>")
497-
call term_wait(buf)
497+
call TermWait(buf)
498498
redraw!
499499

500500
" Use the mouse to enter the terminal window
501501
call win_gotoid(prev_win)
502502
call feedkeys(MouseLeftClickCode(1, 1), 'x')
503503
call feedkeys(MouseLeftReleaseCode(1, 1), 'x')
504-
call term_wait(buf)
504+
call TermWait(buf)
505505
call assert_equal(1, getwininfo(win_getid())[0].terminal)
506506

507507
" Test for copying a modeless selection to clipboard
@@ -514,7 +514,7 @@ func Test_term_modeless_selection()
514514
call assert_equal("d green y", @*)
515515

516516
" cleanup
517-
call term_wait(buf)
517+
call TermWait(buf)
518518
call StopVimInTerminal(buf)
519519
let &mouse = save_mouse
520520
let &term = save_term

src/testdir/test_writefile.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ func Test_write_file_mtime()
268268
call writefile(["Line1", "Line2"], 'Xfile')
269269
let old_ftime = getftime('Xfile')
270270
let buf = RunVimInTerminal('Xfile', #{rows : 10})
271-
call term_wait(buf)
271+
call TermWait(buf)
272272
call term_sendkeys(buf, ":set noswapfile\<CR>")
273-
call term_wait(buf)
273+
call TermWait(buf)
274274

275275
" Modify the file directly. Make sure the file modification time is
276276
" different. Note that on Linux/Unix, the file is considered modified
@@ -286,17 +286,17 @@ func Test_write_file_mtime()
286286

287287
" Try to overwrite the file and check for the prompt
288288
call term_sendkeys(buf, ":w\<CR>")
289-
call term_wait(buf)
289+
call TermWait(buf)
290290
call WaitForAssert({-> assert_equal("WARNING: The file has been changed since reading it!!!", term_getline(buf, 9))})
291291
call assert_equal("Do you really want to write to it (y/n)?",
292292
\ term_getline(buf, 10))
293293
call term_sendkeys(buf, "n\<CR>")
294-
call term_wait(buf)
294+
call TermWait(buf)
295295
call assert_equal(new_ftime, getftime('Xfile'))
296296
call term_sendkeys(buf, ":w\<CR>")
297-
call term_wait(buf)
297+
call TermWait(buf)
298298
call term_sendkeys(buf, "y\<CR>")
299-
call term_wait(buf)
299+
call TermWait(buf)
300300
call WaitForAssert({-> assert_equal('Line2', readfile('Xfile')[1])})
301301

302302
" clean up
@@ -671,7 +671,7 @@ func Test_readwrite_file_with_bom()
671671
set cpoptions-=S
672672
let &fileencoding = save_fileencoding
673673
call delete('Xtest1')
674-
call delete('Xtest2')
674+
call delete('Xfile2')
675675
call delete('Xtest3')
676676
%bw!
677677
endfunc

src/version.c

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

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1498,
757759
/**/
758760
1497,
759761
/**/

0 commit comments

Comments
 (0)