Mercurial > vim
comparison src/testdir/shared.vim @ 11175:9836b701afd9 v8.0.0474
patch 8.0.0474: the client-server feature is not tested
commit https://github.com/vim/vim/commit/15bf76d40be1f1622ff5cc16596c308e76e2ca94
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 18 16:18:37 2017 +0100
patch 8.0.0474: the client-server feature is not tested
Problem: The client-server feature is not tested.
Solution: Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 18 Mar 2017 16:30:04 +0100 |
parents | ca8f2d24a79c |
children | c3227699ad4d |
comparison
equal
deleted
inserted
replaced
11174:1b3fe8c81a43 | 11175:9836b701afd9 |
---|---|
162 | 162 |
163 func s:feedkeys(timer) | 163 func s:feedkeys(timer) |
164 call feedkeys('x', 'nt') | 164 call feedkeys('x', 'nt') |
165 endfunc | 165 endfunc |
166 | 166 |
167 " Get the command to run Vim, with -u NONE and --not-a-term arguments. | |
168 " Returns an empty string on error. | |
169 func GetVimCommand() | |
170 if !filereadable('vimcmd') | |
171 return '' | |
172 endif | |
173 let cmd = readfile('vimcmd')[0] | |
174 let cmd = substitute(cmd, '-u \f\+', '-u NONE', '') | |
175 if cmd !~ '-u NONE' | |
176 let cmd = cmd . ' -u NONE' | |
177 endif | |
178 let cmd .= ' --not-a-term' | |
179 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') | |
180 return cmd | |
181 endfunc | |
182 | |
167 " Run Vim, using the "vimcmd" file and "-u NORC". | 183 " Run Vim, using the "vimcmd" file and "-u NORC". |
168 " "before" is a list of Vim commands to be executed before loading plugins. | 184 " "before" is a list of Vim commands to be executed before loading plugins. |
169 " "after" is a list of Vim commands to be executed after loading plugins. | 185 " "after" is a list of Vim commands to be executed after loading plugins. |
170 " Plugins are not loaded, unless 'loadplugins' is set in "before". | 186 " Plugins are not loaded, unless 'loadplugins' is set in "before". |
171 " Return 1 if Vim could be executed. | 187 " Return 1 if Vim could be executed. |
172 func RunVim(before, after, arguments) | 188 func RunVim(before, after, arguments) |
173 return RunVimPiped(a:before, a:after, a:arguments, '') | 189 return RunVimPiped(a:before, a:after, a:arguments, '') |
174 endfunc | 190 endfunc |
175 | 191 |
176 func RunVimPiped(before, after, arguments, pipecmd) | 192 func RunVimPiped(before, after, arguments, pipecmd) |
177 if !filereadable('vimcmd') | 193 let cmd = GetVimCommand() |
194 if cmd == '' | |
178 return 0 | 195 return 0 |
179 endif | 196 endif |
180 let args = '' | 197 let args = '' |
181 if len(a:before) > 0 | 198 if len(a:before) > 0 |
182 call writefile(a:before, 'Xbefore.vim') | 199 call writefile(a:before, 'Xbefore.vim') |
185 if len(a:after) > 0 | 202 if len(a:after) > 0 |
186 call writefile(a:after, 'Xafter.vim') | 203 call writefile(a:after, 'Xafter.vim') |
187 let args .= ' -S Xafter.vim' | 204 let args .= ' -S Xafter.vim' |
188 endif | 205 endif |
189 | 206 |
190 let cmd = readfile('vimcmd')[0] | |
191 let cmd = substitute(cmd, '-u \f\+', '-u NONE', '') | |
192 if cmd !~ '-u NONE' | |
193 let cmd = cmd . ' -u NONE' | |
194 endif | |
195 let cmd .= ' --not-a-term' | |
196 | |
197 " With pipecmd we can't set VIMRUNTIME. | |
198 if a:pipecmd != '' | |
199 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') | |
200 endif | |
201 | |
202 exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments | 207 exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments |
203 | 208 |
204 if len(a:before) > 0 | 209 if len(a:before) > 0 |
205 call delete('Xbefore.vim') | 210 call delete('Xbefore.vim') |
206 endif | 211 endif |