Mercurial > vim
comparison src/testdir/shared.vim @ 13843:619730d0d864 v8.0.1793
patch 8.0.1793: no test for "vim -g"
commit https://github.com/vim/vim/commit/248be5c5de723c4e2715c574fd920b8b1a1dfebb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 5 15:47:19 2018 +0200
patch 8.0.1793: no test for "vim -g"
Problem: No test for "vim -g".
Solution: Add a test for "-g" and "-y".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 05 May 2018 16:00:07 +0200 |
parents | 415185e2c970 |
children | 7ad55ed0a4f3 |
comparison
equal
deleted
inserted
replaced
13842:3dee8c59417f | 13843:619730d0d864 |
---|---|
225 return '../vim' | 225 return '../vim' |
226 endif | 226 endif |
227 return readfile('vimcmd')[0] | 227 return readfile('vimcmd')[0] |
228 endfunc | 228 endfunc |
229 | 229 |
230 let g:valgrind_cnt = 1 | |
231 | |
230 " Get the command to run Vim, with -u NONE and --not-a-term arguments. | 232 " Get the command to run Vim, with -u NONE and --not-a-term arguments. |
231 " If there is an argument use it instead of "NONE". | 233 " If there is an argument use it instead of "NONE". |
232 func GetVimCommand(...) | 234 func GetVimCommand(...) |
233 if !filereadable('vimcmd') | 235 if !filereadable('vimcmd') |
234 echo 'Cannot read the "vimcmd" file, falling back to ../vim.' | 236 echo 'Cannot read the "vimcmd" file, falling back to ../vim.' |
242 let name = a:1 | 244 let name = a:1 |
243 endif | 245 endif |
244 " For Unix Makefile writes the command to use in the second line of the | 246 " For Unix Makefile writes the command to use in the second line of the |
245 " "vimcmd" file, including environment options. | 247 " "vimcmd" file, including environment options. |
246 " Other Makefiles just write the executable in the first line, so fall back | 248 " Other Makefiles just write the executable in the first line, so fall back |
247 " to that if there is no second line. | 249 " to that if there is no second line or it is empty. |
248 let cmd = get(lines, 1, lines[0]) | 250 if len(lines) > 1 && lines[1] != '' |
251 let cmd = lines[1] | |
252 else | |
253 let cmd = lines[0] | |
254 endif | |
255 | |
249 let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') | 256 let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') |
250 if cmd !~ '-u '. name | 257 if cmd !~ '-u '. name |
251 let cmd = cmd . ' -u ' . name | 258 let cmd = cmd . ' -u ' . name |
252 endif | 259 endif |
253 let cmd .= ' --not-a-term' | 260 let cmd .= ' --not-a-term' |
254 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') | 261 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') |
262 | |
263 " If using valgrind, make sure every run uses a different log file. | |
264 if cmd =~ 'valgrind.*--log-file=' | |
265 let cmd = substitute(cmd, '--log-file=\(^\s*\)', '--log-file=\1.' . g:valgrind_cnt, '') | |
266 let g:valgrind_cnt += 1 | |
267 endif | |
268 | |
255 return cmd | 269 return cmd |
256 endfunc | 270 endfunc |
257 | 271 |
258 " Get the command to run Vim, with --clean. | 272 " Get the command to run Vim, with --clean. |
259 func GetVimCommandClean() | 273 func GetVimCommandClean() |
272 return RunVimPiped(a:before, a:after, a:arguments, '') | 286 return RunVimPiped(a:before, a:after, a:arguments, '') |
273 endfunc | 287 endfunc |
274 | 288 |
275 func RunVimPiped(before, after, arguments, pipecmd) | 289 func RunVimPiped(before, after, arguments, pipecmd) |
276 let cmd = GetVimCommand() | 290 let cmd = GetVimCommand() |
277 if cmd == '' | |
278 return 0 | |
279 endif | |
280 let args = '' | 291 let args = '' |
281 if len(a:before) > 0 | 292 if len(a:before) > 0 |
282 call writefile(a:before, 'Xbefore.vim') | 293 call writefile(a:before, 'Xbefore.vim') |
283 let args .= ' --cmd "so Xbefore.vim"' | 294 let args .= ' --cmd "so Xbefore.vim"' |
284 endif | 295 endif |