summaryrefslogtreecommitdiffstats
path: root/src/testdir/shared.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-18 16:18:37 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-18 16:18:37 +0100
commit15bf76d40be1f1622ff5cc16596c308e76e2ca94 (patch)
treee3e19239a9369f65db8d135b3732ee28ae96cca7 /src/testdir/shared.vim
parent8c34aa09a449a5c1c2d1141b6fafa90f29b3fc12 (diff)
patch 8.0.0474: the client-server feature is not testedv8.0.0474
Problem: The client-server feature is not tested. Solution: Add a test.
Diffstat (limited to 'src/testdir/shared.vim')
-rw-r--r--src/testdir/shared.vim31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 53f5a2e866..e28d162b84 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -164,6 +164,22 @@ func s:feedkeys(timer)
call feedkeys('x', 'nt')
endfunc
+" Get the command to run Vim, with -u NONE and --not-a-term arguments.
+" Returns an empty string on error.
+func GetVimCommand()
+ if !filereadable('vimcmd')
+ return ''
+ endif
+ let cmd = readfile('vimcmd')[0]
+ let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
+ if cmd !~ '-u NONE'
+ let cmd = cmd . ' -u NONE'
+ endif
+ let cmd .= ' --not-a-term'
+ let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
+ 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.
@@ -174,7 +190,8 @@ func RunVim(before, after, arguments)
endfunc
func RunVimPiped(before, after, arguments, pipecmd)
- if !filereadable('vimcmd')
+ let cmd = GetVimCommand()
+ if cmd == ''
return 0
endif
let args = ''
@@ -187,18 +204,6 @@ func RunVimPiped(before, after, arguments, pipecmd)
let args .= ' -S Xafter.vim'
endif
- let cmd = readfile('vimcmd')[0]
- let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
- if cmd !~ '-u NONE'
- let cmd = cmd . ' -u NONE'
- endif
- let cmd .= ' --not-a-term'
-
- " With pipecmd we can't set VIMRUNTIME.
- if a:pipecmd != ''
- let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
- endif
-
exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments
if len(a:before) > 0