To: vim_dev@googlegroups.com Subject: Patch 8.0.1776 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1776 Problem: In tests, when WaitFor() fails it doesn't say why. Solution: Turn a few more WaitFor() into WaitForAssert(). Files: src/testdir/test_popup.vim, src/testdir/test_quotestar.vim, src/testdir/test_search.vim, src/testdir/test_terminal.vim, src/testdir/test_timers.vim *** ../vim-8.0.1775/src/testdir/test_popup.vim 2018-04-17 23:31:01.324223432 +0200 --- src/testdir/test_popup.vim 2018-04-30 13:14:29.005962330 +0200 *************** *** 649,666 **** call term_sendkeys(buf, "\") call term_wait(buf, 100) " popup first entry "!" must be at the top ! call WaitFor({-> term_getline(buf, 1) =~ "^!"}) ! call assert_match('^!\s*$', term_getline(buf, 1)) exe 'resize +' . (h - 1) call term_wait(buf, 100) redraw! " popup shifted down, first line is now empty ! call WaitFor({-> term_getline(buf, 1) == ""}) ! call assert_equal('', term_getline(buf, 1)) sleep 100m " popup is below cursor line and shows first match "!" ! call WaitFor({-> term_getline(buf, term_getcursor(buf)[0] + 1) =~ "^!"}) ! call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1)) " cursor line also shows ! call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) bwipe! --- 649,663 ---- call term_sendkeys(buf, "\") call term_wait(buf, 100) " popup first entry "!" must be at the top ! call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))}) exe 'resize +' . (h - 1) call term_wait(buf, 100) redraw! " popup shifted down, first line is now empty ! call WaitForAssert({-> assert_equal('', term_getline(buf, 1))}) sleep 100m " popup is below cursor line and shows first match "!" ! call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))}) " cursor line also shows ! call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) bwipe! *** ../vim-8.0.1775/src/testdir/test_quotestar.vim 2018-04-11 20:53:45.765218228 +0200 --- src/testdir/test_quotestar.vim 2018-04-30 14:27:41.276846682 +0200 *************** *** 54,87 **** " Make sure a previous server has exited try call remote_send(name, ":qa!\") - call WaitFor('serverlist() !~ "' . name . '"') catch /E241:/ endtry ! call assert_notmatch(name, serverlist()) let cmd .= ' --servername ' . name let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) ! call WaitFor({-> job_status(job) == "run"}) " Takes a short while for the server to be active. ! call WaitFor('serverlist() =~ "' . name . '"') " Wait for the server to be up and answering requests. One second is not " always sufficient. ! call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""') " Clear the *-register of this vim instance and wait for it to be picked up " by the server. let @* = 'no' call remote_foreground(name) ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\") ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') " Check that the *-register of this vim instance is changed as expected. ! call WaitFor('@* == "yes"') " Handle the large selection over 262040 byte. let length = 262044 --- 54,86 ---- " Make sure a previous server has exited try call remote_send(name, ":qa!\") catch /E241:/ endtry ! call WaitForAssert({-> assert_notmatch(name, serverlist())}) let cmd .= ' --servername ' . name let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) ! call WaitForAssert({-> assert_equal("run", job_status(job))}) " Takes a short while for the server to be active. ! call WaitForAssert({-> assert_match(name, serverlist())}) " Wait for the server to be up and answering requests. One second is not " always sufficient. ! call WaitForAssert({-> assert_notequal('', remote_expr(name, "v:version", "", 2))}) " Clear the *-register of this vim instance and wait for it to be picked up " by the server. let @* = 'no' call remote_foreground(name) ! call WaitForAssert({-> assert_equal("no", remote_expr(name, "@*", "", 1))}) " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\") ! call WaitForAssert({-> assert_equal("yes", remote_expr(name, "@*", "", 1))}) " Check that the *-register of this vim instance is changed as expected. ! call WaitForAssert({-> assert_equal("yes", @*)}) " Handle the large selection over 262040 byte. let length = 262044 *************** *** 109,126 **** call remote_send(name, ":gui -f\") endif " Wait for the server in the GUI to be up and answering requests. ! call WaitFor('remote_expr("' . name . '", "has(\"gui_running\")", "", 1) =~ "1"') call remote_send(name, ":let @* = 'maybe'\") ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"') ! call assert_equal('maybe', remote_expr(name, "@*", "", 2)) call assert_equal('maybe', @*) endif call remote_send(name, ":qa!\") try ! call WaitFor({-> job_status(job) == "dead"}) finally if job_status(job) != 'dead' call assert_report('Server did not exit') --- 108,124 ---- call remote_send(name, ":gui -f\") endif " Wait for the server in the GUI to be up and answering requests. ! call WaitForAssert({-> assert_match("1", remote_expr(name, "has('gui_running')", "", 1))}) call remote_send(name, ":let @* = 'maybe'\") ! call WaitForAssert({-> assert_equal("maybe", remote_expr(name, "@*", "", 2))}) call assert_equal('maybe', @*) endif call remote_send(name, ":qa!\") try ! call WaitForAssert({-> assert_equal("dead", job_status(job))}) finally if job_status(job) != 'dead' call assert_report('Server did not exit') *** ../vim-8.0.1775/src/testdir/test_search.vim 2018-04-27 22:17:52.171019734 +0200 --- src/testdir/test_search.vim 2018-04-30 13:22:53.382976302 +0200 *************** *** 494,500 **** call writefile(lines, 'Xsearch.txt') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) ! call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] }) call term_sendkeys(buf, ":set incsearch hlsearch\") call term_sendkeys(buf, ":14vsp\") --- 494,500 ---- call writefile(lines, 'Xsearch.txt') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) ! call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) call term_sendkeys(buf, ":set incsearch hlsearch\") call term_sendkeys(buf, ":14vsp\") *************** *** 619,625 **** call writefile(lines, 'Xsearch.txt') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) ! call WaitFor({-> lines == [term_getline(buf, 1), term_getline(buf, 2)] }) " wait for vim to complete initialization call term_wait(buf) --- 619,625 ---- call writefile(lines, 'Xsearch.txt') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) ! call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) " wait for vim to complete initialization call term_wait(buf) *** ../vim-8.0.1775/src/testdir/test_terminal.vim 2018-04-28 21:34:35.862806140 +0200 --- src/testdir/test_terminal.vim 2018-04-30 14:03:53.641119254 +0200 *************** *** 100,106 **** quit! call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) - call assert_equal('dead', job_status(g:job)) exe buf . 'bwipe' unlet g:job --- 100,105 ---- *************** *** 142,149 **** let g:buf = term_start(cmd, {'exit_cb': function('s:Nasty_exit_cb')}) let g:job = term_getjob(g:buf) ! call WaitFor('job_status(g:job) == "dead"') ! call WaitFor('g:buf == 0') unlet g:buf unlet g:job call delete('Xtext') --- 141,148 ---- let g:buf = term_start(cmd, {'exit_cb': function('s:Nasty_exit_cb')}) let g:job = term_getjob(g:buf) ! call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) ! call WaitForAssert({-> assert_equal(0, g:buf)}) unlet g:buf unlet g:job call delete('Xtext') *************** *** 190,201 **** call term_wait(buf) " On MS-Windows we first get a startup message of two lines, wait for the " "cls" to happen, after that we have one line with three characters. ! call WaitFor({-> len(term_scrape(buf, 1)) == 3}) call Check_123(buf) " Must still work after the job ended. let job = term_getjob(buf) ! call WaitFor({-> job_status(job) == "dead"}) call term_wait(buf) call Check_123(buf) --- 189,200 ---- call term_wait(buf) " On MS-Windows we first get a startup message of two lines, wait for the " "cls" to happen, after that we have one line with three characters. ! call WaitForAssert({-> assert_equal(3, len(term_scrape(buf, 1)))}) call Check_123(buf) " Must still work after the job ended. let job = term_getjob(buf) ! call WaitForAssert({-> assert_equal("dead", job_status(job))}) call term_wait(buf) call Check_123(buf) *************** *** 234,240 **** call assert_equal('s', l[6].chars) let job = term_getjob(buf) ! call WaitFor({-> job_status(job) == "dead"}) call term_wait(buf) exe buf . 'bwipe' --- 233,239 ---- call assert_equal('s', l[6].chars) let job = term_getjob(buf) ! call WaitForAssert({-> assert_equal("dead", job_status(job))}) call term_wait(buf) exe buf . 'bwipe' *************** *** 251,257 **** let buf = term_start(cmd) let job = term_getjob(buf) ! call WaitFor({-> job_status(job) == "dead"}) call term_wait(buf) if has('win32') " TODO: this should not be needed --- 250,256 ---- let buf = term_start(cmd) let job = term_getjob(buf) ! call WaitForAssert({-> assert_equal("dead", job_status(job))}) call term_wait(buf) if has('win32') " TODO: this should not be needed *************** *** 281,287 **** endif let rows = term_getsize(buf)[0] " On MS-Windows there is an empty line, check both last line and above it. ! call WaitFor({-> term_getline(buf, rows - 1) . term_getline(buf, rows - 2) =~ '149'}) let lines = line('$') call assert_inrange(91, 100, lines) --- 280,286 ---- endif let rows = term_getsize(buf)[0] " On MS-Windows there is an empty line, check both last line and above it. ! call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows - 2))}) let lines = line('$') call assert_inrange(91, 100, lines) *************** *** 408,423 **** let buf = bufnr('%') call assert_equal(2, winnr('$')) " Wait for the shell to display a prompt ! call WaitFor({-> term_getline(buf, 1) != ""}) call Stop_shell_in_terminal(buf) ! call WaitFor("winnr('$') == 1", waittime) " shell terminal that does not close automatically terminal ++noclose let buf = bufnr('%') call assert_equal(2, winnr('$')) " Wait for the shell to display a prompt ! call WaitFor({-> term_getline(buf, 1) != ""}) call Stop_shell_in_terminal(buf) call assert_equal(2, winnr('$')) quit --- 407,422 ---- let buf = bufnr('%') call assert_equal(2, winnr('$')) " Wait for the shell to display a prompt ! call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) call Stop_shell_in_terminal(buf) ! call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) " shell terminal that does not close automatically terminal ++noclose let buf = bufnr('%') call assert_equal(2, winnr('$')) " Wait for the shell to display a prompt ! call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) call Stop_shell_in_terminal(buf) call assert_equal(2, winnr('$')) quit *************** *** 426,461 **** exe 'terminal ++close ' . cmd call assert_equal(2, winnr('$')) wincmd p ! call WaitFor("winnr('$') == 1", waittime) call term_start(cmd, {'term_finish': 'close'}) call assert_equal(2, winnr('$')) wincmd p ! call WaitFor("winnr('$') == 1", waittime) call assert_equal(1, winnr('$')) exe 'terminal ++open ' . cmd close! ! call WaitFor("winnr('$') == 2", waittime) ! call assert_equal(2, winnr('$')) bwipe call term_start(cmd, {'term_finish': 'open'}) close! ! call WaitFor("winnr('$') == 2", waittime) ! call assert_equal(2, winnr('$')) bwipe exe 'terminal ++hidden ++open ' . cmd call assert_equal(1, winnr('$')) ! call WaitFor("winnr('$') == 2", waittime) ! call assert_equal(2, winnr('$')) bwipe call term_start(cmd, {'term_finish': 'open', 'hidden': 1}) call assert_equal(1, winnr('$')) ! call WaitFor("winnr('$') == 2", waittime) ! call assert_equal(2, winnr('$')) bwipe call assert_fails("call term_start(cmd, {'term_opencmd': 'open'})", 'E475:') --- 425,456 ---- exe 'terminal ++close ' . cmd call assert_equal(2, winnr('$')) wincmd p ! call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) call term_start(cmd, {'term_finish': 'close'}) call assert_equal(2, winnr('$')) wincmd p ! call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) call assert_equal(1, winnr('$')) exe 'terminal ++open ' . cmd close! ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) bwipe call term_start(cmd, {'term_finish': 'open'}) close! ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) bwipe exe 'terminal ++hidden ++open ' . cmd call assert_equal(1, winnr('$')) ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) bwipe call term_start(cmd, {'term_finish': 'open', 'hidden': 1}) call assert_equal(1, winnr('$')) ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) bwipe call assert_fails("call term_start(cmd, {'term_opencmd': 'open'})", 'E475:') *************** *** 465,472 **** call term_start(cmd, {'term_finish': 'open', 'term_opencmd': '4split | buffer %d'}) close! ! call WaitFor("winnr('$') == 2", waittime) ! call assert_equal(2, winnr('$')) call assert_equal(4, winheight(0)) bwipe endfunc --- 460,466 ---- call term_start(cmd, {'term_finish': 'open', 'term_opencmd': '4split | buffer %d'}) close! ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) call assert_equal(4, winheight(0)) bwipe endfunc *************** *** 477,484 **** endif call mkdir('Xdir') let buf = term_start('pwd', {'cwd': 'Xdir'}) ! call WaitFor('"Xdir" == fnamemodify(getline(1), ":t")') ! call assert_equal('Xdir', fnamemodify(getline(1), ":t")) exe buf . 'bwipe' call delete('Xdir', 'rf') --- 471,477 ---- endif call mkdir('Xdir') let buf = term_start('pwd', {'cwd': 'Xdir'}) ! call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))}) exe buf . 'bwipe' call delete('Xdir', 'rf') *************** *** 490,496 **** endif let buf = Run_shell_in_terminal({}) " Wait for the shell to display a prompt ! call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r") else --- 483,489 ---- endif let buf = Run_shell_in_terminal({}) " Wait for the shell to display a prompt ! call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) if has('win32') call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r") else *************** *** 508,514 **** func Test_terminal_env() let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) " Wait for the shell to display a prompt ! call WaitFor({-> term_getline(buf, 1) != ""}) if has('win32') call term_sendkeys(buf, "echo %TESTENV%\r") else --- 501,507 ---- func Test_terminal_env() let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) " Wait for the shell to display a prompt ! call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) if has('win32') call term_sendkeys(buf, "echo %TESTENV%\r") else *************** *** 516,523 **** endif call term_wait(buf) call Stop_shell_in_terminal(buf) ! call WaitFor('getline(2) == "correct"') ! call assert_equal('correct', getline(2)) exe buf . 'bwipe' endfunc --- 509,515 ---- endif call term_wait(buf) call Stop_shell_in_terminal(buf) ! call WaitForAssert({-> assert_equal('correct', getline(2))}) exe buf . 'bwipe' endfunc *************** *** 539,546 **** call term_wait(buf) " closing window wipes out the terminal buffer a with finished job ! call WaitFor("winnr('$') == 1") ! call assert_equal(1, winnr('$')) call assert_equal("", bufname(buf)) unlet g:job --- 531,537 ---- call term_wait(buf) " closing window wipes out the terminal buffer a with finished job ! call WaitForAssert({-> assert_equal(1, winnr('$'))}) call assert_equal("", bufname(buf)) unlet g:job *************** *** 592,598 **** new call setline(1, ['one', 'two', 'three']) %term wc ! call WaitFor('getline("$") =~ "3"') let nrs = split(getline('$')) call assert_equal(['3', '3', '14'], nrs) bwipe --- 583,589 ---- new call setline(1, ['one', 'two', 'three']) %term wc ! call WaitForAssert({-> assert_match('3', getline("$"))}) let nrs = split(getline('$')) call assert_equal(['3', '3', '14'], nrs) bwipe *************** *** 600,606 **** new call setline(1, ['one', 'two', 'three', 'four']) 2,3term wc ! call WaitFor('getline("$") =~ "2"') let nrs = split(getline('$')) call assert_equal(['2', '2', '10'], nrs) bwipe --- 591,597 ---- new call setline(1, ['one', 'two', 'three', 'four']) 2,3term wc ! call WaitForAssert({-> assert_match('2', getline("$"))}) let nrs = split(getline('$')) call assert_equal(['2', '2', '10'], nrs) bwipe *************** *** 622,628 **** new call setline(1, ['print("hello")']) 1term ++eof= python ! call WaitFor('getline("$") =~ "Z"') call assert_equal('hello', getline(line('$') - 1)) bwipe endif --- 613,619 ---- new call setline(1, ['print("hello")']) 1term ++eof= python ! call WaitForAssert({-> assert_match('Z', getline("$"))}) call assert_equal('hello', getline(line('$') - 1)) bwipe endif *************** *** 646,654 **** else call system('echo "look here" > ' . pty) endif ! call WaitFor({-> term_getline(buf, 1) =~ "look here"}) - call assert_match('look here', term_getline(buf, 1)) bwipe! endfunc --- 637,644 ---- else call system('echo "look here" > ' . pty) endif ! call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))}) bwipe! endfunc *************** *** 660,667 **** call mkdir('Xdir with spaces') call writefile(['x'], 'Xdir with spaces/quoted"file') term ls Xdir\ with\ spaces/quoted\"file ! call WaitFor('term_getline("", 1) =~ "quoted"') ! call assert_match('quoted"file', term_getline('', 1)) call term_wait('') call delete('Xdir with spaces', 'rf') --- 650,656 ---- call mkdir('Xdir with spaces') call writefile(['x'], 'Xdir with spaces/quoted"file') term ls Xdir\ with\ spaces/quoted\"file ! call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) call term_wait('') call delete('Xdir with spaces', 'rf') *************** *** 691,700 **** let cmd = Get_cat_123_cmd() let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) call term_wait(buf) ! call WaitFor('len(readfile("Xfile")) > 0') call assert_match('123', readfile('Xfile')[0]) let g:job = term_getjob(buf) ! call WaitFor('job_status(g:job) == "dead"') call delete('Xfile') bwipe endif --- 680,689 ---- let cmd = Get_cat_123_cmd() let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) call term_wait(buf) ! call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) call assert_match('123', readfile('Xfile')[0]) let g:job = term_getjob(buf) ! call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) call delete('Xfile') bwipe endif *************** *** 703,712 **** call writefile(['one line'], 'Xfile') let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) call term_wait(buf) ! call WaitFor('term_getline(' . buf . ', 1) == "one line"') ! call assert_equal('one line', term_getline(buf, 1)) let g:job = term_getjob(buf) ! call WaitFor('job_status(g:job) == "dead"') bwipe call delete('Xfile') endif --- 692,700 ---- call writefile(['one line'], 'Xfile') let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) call term_wait(buf) ! call WaitForAssert({-> assert_equal('one line', term_getline(buf, 1))}) let g:job = term_getjob(buf) ! call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) bwipe call delete('Xfile') endif *************** *** 726,732 **** call assert_equal('456', maparg('123', 't')) call assert_equal('abxde', maparg('456', 't')) call feedkeys("123", 'tx') ! call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'}) let lnum = term_getcursor(buf)[0] if a:remap call assert_match('abxde', term_getline(buf, lnum)) --- 714,720 ---- call assert_equal('456', maparg('123', 't')) call assert_equal('abxde', maparg('456', 't')) call feedkeys("123", 'tx') ! call WaitForAssert({-> assert_match('abxde\|456', term_getline(buf, term_getcursor(buf)[0]))}) let lnum = term_getcursor(buf)[0] if a:remap call assert_match('abxde', term_getline(buf, lnum)) *************** *** 825,832 **** call assert_equal("\u00a0\u0308", l[3].chars) call term_sendkeys(buf, "exit\r") ! call WaitFor('job_status(g:job) == "dead"') ! call assert_equal('dead', job_status(g:job)) bwipe! unlet g:job let &encoding = save_enc --- 813,819 ---- call assert_equal("\u00a0\u0308", l[3].chars) call term_sendkeys(buf, "exit\r") ! call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) bwipe! unlet g:job let &encoding = save_enc *************** *** 849,855 **** call setline(1, ['one', 'two']) exe 'term ++close ' . cmd wincmd p ! call WaitFor("winnr('$') == 2", waittime) call assert_equal(1, s:called) bwipe! --- 836,842 ---- call setline(1, ['one', 'two']) exe 'term ++close ' . cmd wincmd p ! call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) call assert_equal(1, s:called) bwipe! *************** *** 875,890 **** endif let buf = Run_shell_in_terminal({}) ! call WaitFor({-> term_getline(buf, 1) != ''}) call term_sendkeys(buf, "cat\") ! call WaitFor({-> term_getline(buf, 1) =~ 'cat'}) " Request the cursor position. call term_sendkeys(buf, "\x1b[6n\") " Wait for output from tty to display, below an empty line. ! call WaitFor({-> term_getline(buf, 4) =~ '3;1R'}) " End "cat" gently. call term_sendkeys(buf, "\\") --- 862,877 ---- endif let buf = Run_shell_in_terminal({}) ! call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) call term_sendkeys(buf, "cat\") ! call WaitForAssert({-> assert_match('cat', term_getline(buf, 1))}) " Request the cursor position. call term_sendkeys(buf, "\x1b[6n\") " Wait for output from tty to display, below an empty line. ! call WaitForAssert({-> assert_match('3;1R', term_getline(buf, 4))}) " End "cat" gently. call term_sendkeys(buf, "\\") *************** *** 961,974 **** " Open a terminal window and wait for the prompt to appear call term_sendkeys(buf, ":term\") ! call WaitFor({-> term_getline(buf, 10) =~ '\[running]'}) ! call WaitFor({-> term_getline(buf, 1) !~ '^\s*$'}) " make Vim exit, it will prompt to kill the shell call term_sendkeys(buf, "\:confirm qall\") ! call WaitFor({-> term_getline(buf, 20) =~ 'ancel:'}) call term_sendkeys(buf, "y") ! call WaitFor({-> term_getstatus(buf) == "finished"}) " close the terminal window where Vim was running quit --- 948,961 ---- " Open a terminal window and wait for the prompt to appear call term_sendkeys(buf, ":term\") ! call WaitForAssert({-> assert_match('\[running]', term_getline(buf, 10))}) ! call WaitForAssert({-> assert_notmatch('^\s*$', term_getline(buf, 1))}) " make Vim exit, it will prompt to kill the shell call term_sendkeys(buf, "\:confirm qall\") ! call WaitForAssert({-> assert_match('ancel:', term_getline(buf, 20))}) call term_sendkeys(buf, "y") ! call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) " close the terminal window where Vim was running quit *************** *** 1025,1031 **** let text = " a\u0300 e\u0302 o\u0308" call writefile([text], 'Xcomposing') let buf = RunVimInTerminal('Xcomposing', {}) ! call WaitFor({-> term_getline(buf, 1) =~ text}) call term_dumpwrite(buf, 'Xdump') let dumpline = readfile('Xdump')[0] call assert_match('|à| |ê| |ö', dumpline) --- 1012,1018 ---- let text = " a\u0300 e\u0302 o\u0308" call writefile([text], 'Xcomposing') let buf = RunVimInTerminal('Xcomposing', {}) ! call WaitForAssert({-> assert_match(text, term_getline(buf, 1))}) call term_dumpwrite(buf, 'Xdump') let dumpline = readfile('Xdump')[0] call assert_match('|à| |ê| |ö', dumpline) *************** *** 1235,1241 **** \ "set t_ts=", \ ], 'Xscript') let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) ! call WaitFor({-> expand('%:t') =='Xtextfile'}) call assert_equal(textfile_winid, win_getid()) call StopVimInTerminal(buf) --- 1222,1228 ---- \ "set t_ts=", \ ], 'Xscript') let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) ! call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))}) call assert_equal(textfile_winid, win_getid()) call StopVimInTerminal(buf) *************** *** 1284,1290 **** call WriteApiCall('TryThis') call ch_logfile('Xlog', 'w') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitFor({-> string(readfile('Xlog')) =~ 'Invalid function name: TryThis'}) call StopVimInTerminal(buf) call delete('Xscript') --- 1271,1277 ---- call WriteApiCall('TryThis') call ch_logfile('Xlog', 'w') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitForAssert({-> assert_match('Invalid function name: TryThis', string(readfile('Xlog')))}) call StopVimInTerminal(buf) call delete('Xscript') *************** *** 1309,1315 **** call WriteApiCall('Tapi_Delete') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitFor({-> s:caught_e937 == 1}) call StopVimInTerminal(buf) call delete('Xscript') --- 1296,1302 ---- call WriteApiCall('Tapi_Delete') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitForAssert({-> assert_equal(1, s:caught_e937)}) call StopVimInTerminal(buf) call delete('Xscript') *** ../vim-8.0.1775/src/testdir/test_timers.vim 2018-02-03 15:38:37.537337772 +0100 --- src/testdir/test_timers.vim 2018-04-30 13:59:51.838486308 +0200 *************** *** 143,149 **** func Test_delete_myself() let g:called = 0 let t = timer_start(10, 'StopMyself', {'repeat': -1}) ! call WaitFor('g:called == 2') call assert_equal(2, g:called) call assert_equal([], timer_info(t)) endfunc --- 143,149 ---- func Test_delete_myself() let g:called = 0 let t = timer_start(10, 'StopMyself', {'repeat': -1}) ! call WaitForAssert({-> assert_equal(2, g:called)}) call assert_equal(2, g:called) call assert_equal([], timer_info(t)) endfunc *************** *** 206,212 **** let g:call_count = 0 let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) " Timer will be stopped after failing 3 out of 3 times. ! call WaitFor('g:call_count == 3') sleep 50m call assert_equal(3, g:call_count) endfunc --- 206,212 ---- let g:call_count = 0 let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) " Timer will be stopped after failing 3 out of 3 times. ! call WaitForAssert({-> assert_equal(3, g:call_count)}) sleep 50m call assert_equal(3, g:call_count) endfunc *************** *** 224,230 **** let g:call_count = 0 let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) " Timer will not be stopped. ! call WaitFor('g:call_count == 4') sleep 50m call assert_equal(4, g:call_count) endfunc --- 224,230 ---- let g:call_count = 0 let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) " Timer will not be stopped. ! call WaitForAssert({-> assert_equal(4, g:call_count)}) sleep 50m call assert_equal(4, g:call_count) endfunc *** ../vim-8.0.1775/src/version.c 2018-04-30 10:38:35.772177610 +0200 --- src/version.c 2018-04-30 14:26:08.601387427 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1776, /**/ -- FATHER: One day, lad, all this will be yours ... PRINCE: What - the curtains? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///