diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-04-28 21:34:40 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-04-28 21:34:40 +0200 |
commit | 50182fa84e20a0547f3e2bd6683ef799fcd27855 (patch) | |
tree | e68877870cf854837d637d83208edbd114ce185c /src/testdir/screendump.vim | |
parent | 65a5464985f980d2bbbf4e14d39d416dce065ec7 (diff) | |
download | vim-git-50182fa84e20a0547f3e2bd6683ef799fcd27855.tar.gz |
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say whyv8.0.1771
Problem: In tests, when WaitFor() fails it doesn't say why. (James McCoy)
Solution: Add WaitForAssert(), which produces an assert error when it fails.
Diffstat (limited to 'src/testdir/screendump.vim')
-rw-r--r-- | src/testdir/screendump.vim | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim index af9e37148..7065fa051 100644 --- a/src/testdir/screendump.vim +++ b/src/testdir/screendump.vim @@ -64,9 +64,15 @@ func RunVimInTerminal(arguments, options) let cols = term_getsize(buf)[1] endif - " Wait for "All" of the ruler in the status line to be shown. - " This can be quite slow (e.g. when using valgrind). - call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}) + " Wait for "All" or "Top" of the ruler in the status line to be shown. This + " can be quite slow (e.g. when using valgrind). + " If it fails then show the terminal contents for debugging. + try + call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}) + catch /timed out after/ + let lines = map(range(1, rows), {key, val -> term_getline(buf, val)}) + call assert_report('RunVimInTerminal() failed, screen contents: ' . join(lines, "<NL>")) + endtry return buf endfunc @@ -75,7 +81,7 @@ endfunc func StopVimInTerminal(buf) call assert_equal("running", term_getstatus(a:buf)) call term_sendkeys(a:buf, "\<Esc>\<Esc>:qa!\<cr>") - call WaitFor('term_getstatus(' . a:buf . ') == "finished"') + call WaitForAssert({-> assert_equal("finished", term_getstatus(a:buf))}) only! endfunc |