Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
13303:b97157007be1 | 13304:013c44d9dc09 |
---|---|
176 | 176 |
177 " Get $VIMPROG to run Vim executable. | 177 " Get $VIMPROG to run Vim executable. |
178 " The Makefile writes it as the first line in the "vimcmd" file. | 178 " The Makefile writes it as the first line in the "vimcmd" file. |
179 func GetVimProg() | 179 func GetVimProg() |
180 if !filereadable('vimcmd') | 180 if !filereadable('vimcmd') |
181 return '' | 181 " Assume the script was sourced instead of running "make". |
182 return '../vim' | |
182 endif | 183 endif |
183 return readfile('vimcmd')[0] | 184 return readfile('vimcmd')[0] |
184 endfunc | 185 endfunc |
185 | 186 |
186 " Get the command to run Vim, with -u NONE and --not-a-term arguments. | 187 " Get the command to run Vim, with -u NONE and --not-a-term arguments. |
187 " If there is an argument use it instead of "NONE". | 188 " If there is an argument use it instead of "NONE". |
188 " Returns an empty string on error. | |
189 func GetVimCommand(...) | 189 func GetVimCommand(...) |
190 if !filereadable('vimcmd') | 190 if !filereadable('vimcmd') |
191 return '' | 191 echo 'Cannot read the "vimcmd" file, falling back to ../vim.' |
192 let lines = ['../vim'] | |
193 else | |
194 let lines = readfile('vimcmd') | |
192 endif | 195 endif |
193 if a:0 == 0 | 196 if a:0 == 0 |
194 let name = 'NONE' | 197 let name = 'NONE' |
195 else | 198 else |
196 let name = a:1 | 199 let name = a:1 |
197 endif | 200 endif |
198 " For Unix Makefile writes the command to use in the second line of the | 201 " For Unix Makefile writes the command to use in the second line of the |
199 " "vimcmd" file, including environment options. | 202 " "vimcmd" file, including environment options. |
200 " Other Makefiles just write the executable in the first line, so fall back | 203 " Other Makefiles just write the executable in the first line, so fall back |
201 " to that if there is no second line. | 204 " to that if there is no second line. |
202 let lines = readfile('vimcmd') | |
203 let cmd = get(lines, 1, lines[0]) | 205 let cmd = get(lines, 1, lines[0]) |
204 let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') | 206 let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') |
205 if cmd !~ '-u '. name | 207 if cmd !~ '-u '. name |
206 let cmd = cmd . ' -u ' . name | 208 let cmd = cmd . ' -u ' . name |
207 endif | 209 endif |
208 let cmd .= ' --not-a-term' | 210 let cmd .= ' --not-a-term' |
209 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') | 211 let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '') |
212 return cmd | |
213 endfunc | |
214 | |
215 " Get the command to run Vim, with --clean. | |
216 func GetVimCommandClean() | |
217 let cmd = GetVimCommand() | |
218 let cmd = substitute(cmd, '-u NONE', '--clean', '') | |
219 let cmd = substitute(cmd, '--not-a-term', '', '') | |
210 return cmd | 220 return cmd |
211 endfunc | 221 endfunc |
212 | 222 |
213 " Run Vim, using the "vimcmd" file and "-u NORC". | 223 " Run Vim, using the "vimcmd" file and "-u NORC". |
214 " "before" is a list of Vim commands to be executed before loading plugins. | 224 " "before" is a list of Vim commands to be executed before loading plugins. |