summaryrefslogtreecommitdiffstats
path: root/src/testdir/screendump.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/screendump.vim')
-rw-r--r--src/testdir/screendump.vim20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim
index a28cb8cb89..584f9ac714 100644
--- a/src/testdir/screendump.vim
+++ b/src/testdir/screendump.vim
@@ -1,10 +1,23 @@
" Functions shared by tests making screen dumps.
" Only load this script once.
-if exists('*RunVimInTerminal')
+if exists('*CanRunVimInTerminal')
finish
endif
+" Need to be able to run terminal Vim with 256 colors. On MS-Windows the
+" console only has 16 colors and the GUI can't run in a terminal.
+if !has('terminal') || has('win32')
+ func CanRunVimInTerminal()
+ return 0
+ endfunc
+ finish
+endif
+
+func CanRunVimInTerminal()
+ return 1
+endfunc
+
source shared.vim
" Run Vim with "arguments" in a new terminal window.
@@ -41,16 +54,17 @@ func StopVimInTerminal(buf)
endfunc
" Verify that Vim running in terminal buffer "buf" matches the screen dump.
+" "options" is passed to term_dumpwrite().
" The file name used is "dumps/{filename}.dump".
" Will wait for up to a second for the screen dump to match.
-func VerifyScreenDump(buf, filename)
+func VerifyScreenDump(buf, filename, options)
let reference = 'dumps/' . a:filename . '.dump'
let testfile = a:filename . '.dump.failed'
let i = 0
while 1
call delete(testfile)
- call term_dumpwrite(a:buf, testfile)
+ call term_dumpwrite(a:buf, testfile, a:options)
if readfile(reference) == readfile(testfile)
call delete(testfile)
break