Mercurial > vim
comparison src/testdir/shared.vim @ 9794:fd32f719d34f v7.4.2172
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 6 22:31:42 2016 +0200
patch 7.4.2172
Problem: No test for "vim --help".
Solution: Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 06 Aug 2016 22:45:04 +0200 |
parents | 3fdf6caf42f7 |
children | 4ef933b816e7 |
comparison
equal
deleted
inserted
replaced
9793:f0921034ac5e | 9794:fd32f719d34f |
---|---|
124 " Run Vim, using the "vimcmd" file and "-u NORC". | 124 " Run Vim, using the "vimcmd" file and "-u NORC". |
125 " "before" is a list of commands to be executed before loading plugins. | 125 " "before" is a list of commands to be executed before loading plugins. |
126 " "after" is a list of commands to be executed after loading plugins. | 126 " "after" is a list of commands to be executed after loading plugins. |
127 " Plugins are not loaded, unless 'loadplugins' is set in "before". | 127 " Plugins are not loaded, unless 'loadplugins' is set in "before". |
128 " Return 1 if Vim could be executed. | 128 " Return 1 if Vim could be executed. |
129 func RunVim(before, after) | 129 func RunVim(before, after, arguments) |
130 if !filereadable('vimcmd') | 130 if !filereadable('vimcmd') |
131 return 0 | 131 return 0 |
132 endif | 132 endif |
133 call writefile(a:before, 'Xbefore.vim') | 133 let args = a:arguments |
134 call writefile(a:after, 'Xafter.vim') | 134 if len(a:before) > 0 |
135 call writefile(a:before, 'Xbefore.vim') | |
136 let args .= ' --cmd "so Xbefore.vim"' | |
137 endif | |
138 if len(a:after) > 0 | |
139 call writefile(a:after, 'Xafter.vim') | |
140 let args .= ' -S Xafter.vim' | |
141 endif | |
135 | 142 |
136 let cmd = readfile('vimcmd')[0] | 143 let cmd = readfile('vimcmd')[0] |
137 let cmd = substitute(cmd, '-u \f\+', '-u NONE', '') | 144 let cmd = substitute(cmd, '-u \f\+', '-u NONE', '') |
138 if cmd !~ '-u NONE' | 145 if cmd !~ '-u NONE' |
139 let cmd = cmd . ' -u NONE' | 146 let cmd = cmd . ' -u NONE' |
140 endif | 147 endif |
141 exe "silent !" . cmd . " --cmd \"so Xbefore.vim\" -S Xafter.vim" | 148 exe "silent !" . cmd . ' ' . args |
142 | 149 |
143 call delete('Xbefore.vim') | 150 if len(a:before) > 0 |
144 call delete('Xafter.vim') | 151 call delete('Xbefore.vim') |
152 endif | |
153 if len(a:after) > 0 | |
154 call delete('Xafter.vim') | |
155 endif | |
145 return 1 | 156 return 1 |
146 endfunc | 157 endfunc |