diff src/testdir/shared.vim @ 13304:013c44d9dc09 v8.0.1526

patch 8.0.1526: no test using a screen dump yet commit https://github.com/vim/vim/commit/da65058a9c4774dc534c7ae98d24c58b5db669fa Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 20 15:51:40 2018 +0100 patch 8.0.1526: no test using a screen dump yet Problem: No test using a screen dump yet. Solution: Add a test for C syntax highlighting. Add helper functions.
author Christian Brabandt <cb@256bit.org>
date Tue, 20 Feb 2018 16:00:06 +0100
parents 7f27e9769f62
children 33a2277b8d4d
line wrap: on
line diff
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -178,17 +178,20 @@ endfunc
 " The Makefile writes it as the first line in the "vimcmd" file.
 func GetVimProg()
   if !filereadable('vimcmd')
-    return ''
+    " Assume the script was sourced instead of running "make".
+    return '../vim'
   endif
   return readfile('vimcmd')[0]
 endfunc
 
 " Get the command to run Vim, with -u NONE and --not-a-term arguments.
 " If there is an argument use it instead of "NONE".
-" Returns an empty string on error.
 func GetVimCommand(...)
   if !filereadable('vimcmd')
-    return ''
+    echo 'Cannot read the "vimcmd" file, falling back to ../vim.'
+    let lines = ['../vim']
+  else
+    let lines = readfile('vimcmd')
   endif
   if a:0 == 0
     let name = 'NONE'
@@ -199,7 +202,6 @@ func GetVimCommand(...)
   " "vimcmd" file, including environment options.
   " Other Makefiles just write the executable in the first line, so fall back
   " to that if there is no second line.
-  let lines = readfile('vimcmd')
   let cmd = get(lines, 1, lines[0])
   let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
   if cmd !~ '-u '. name
@@ -210,6 +212,14 @@ func GetVimCommand(...)
   return cmd
 endfunc
 
+" Get the command to run Vim, with --clean.
+func GetVimCommandClean()
+  let cmd = GetVimCommand()
+  let cmd = substitute(cmd, '-u NONE', '--clean', '')
+  let cmd = substitute(cmd, '--not-a-term', '', '')
+  return cmd
+endfunc
+
 " Run Vim, using the "vimcmd" file and "-u NORC".
 " "before" is a list of Vim commands to be executed before loading plugins.
 " "after" is a list of Vim commands to be executed after loading plugins.