summaryrefslogtreecommitdiffstats
path: root/src/testdir/screendump.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-28 21:34:40 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-28 21:34:40 +0200
commit50182fa84e20a0547f3e2bd6683ef799fcd27855 (patch)
treee68877870cf854837d637d83208edbd114ce185c /src/testdir/screendump.vim
parent65a5464985f980d2bbbf4e14d39d416dce065ec7 (diff)
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.vim14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim
index af9e371488..7065fa0510 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