Mercurial > vim
comparison src/testdir/test_startup.vim @ 14788:0aff6e5f3d55 v8.1.0406
patch 8.1.0406: several command line arguments are not tested
commit https://github.com/vim/vim/commit/9e81db9742a35cc972ce5cae204e837093987692
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 18 22:37:31 2018 +0200
patch 8.1.0406: several command line arguments are not tested
Problem: Several command line arguments are not tested.
Solution: Add tests for -A, -F, -H, -p and -V. (Dominique Pelle,
closes #3446)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 18 Sep 2018 22:45:06 +0200 |
parents | 66e241c3a2f0 |
children | 9be43810b5ec |
comparison
equal
deleted
inserted
replaced
14787:fc0f6a82a5b4 | 14788:0aff6e5f3d55 |
---|---|
197 " - sum of both windows width (+ 1 separator) should be equal to the | 197 " - sum of both windows width (+ 1 separator) should be equal to the |
198 " number of columns | 198 " number of columns |
199 " - both windows should have the same height | 199 " - both windows should have the same height |
200 " - window height (+ 2 for the statusline and Ex command) should be equal | 200 " - window height (+ 2 for the statusline and Ex command) should be equal |
201 " to the number of lines | 201 " to the number of lines |
202 " - buffer of both windowns should have no name | 202 " - buffer of both windows should have no name |
203 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') | 203 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') |
204 call assert_equal('2', wn) | 204 call assert_equal('2', wn) |
205 call assert_inrange(0, 1, ww1 - ww2) | 205 call assert_inrange(0, 1, ww1 - ww2) |
206 call assert_equal(string(ww1 + ww2 + 1), cn) | 206 call assert_equal(string(ww1 + ww2 + 1), cn) |
207 call assert_equal(wh1, wh2) | 207 call assert_equal(wh1, wh2) |
218 call assert_equal(string(ww1 + ww2 + 1), cn) | 218 call assert_equal(string(ww1 + ww2 + 1), cn) |
219 call assert_equal(wh1, wh2) | 219 call assert_equal(wh1, wh2) |
220 call assert_equal(string(wh1 + 2), ln) | 220 call assert_equal(string(wh1 + 2), ln) |
221 call assert_equal('foo', bn1) | 221 call assert_equal('foo', bn1) |
222 call assert_equal('bar', bn2) | 222 call assert_equal('bar', bn2) |
223 endif | |
224 | |
225 call delete('Xtestout') | |
226 endfunc | |
227 | |
228 " Test the -p[N] argument to open N tabpages. | |
229 func Test_p_arg() | |
230 let after = [ | |
231 \ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")', | |
232 \ 'qall', | |
233 \ ] | |
234 if RunVim([], after, '-p2') | |
235 let lines = readfile('Xtestout') | |
236 call assert_equal(4, len(lines)) | |
237 call assert_equal('Tab page 1', lines[0]) | |
238 call assert_equal('> [No Name]', lines[1]) | |
239 call assert_equal('Tab page 2', lines[2]) | |
240 call assert_equal(' [No Name]', lines[3]) | |
241 endif | |
242 | |
243 if RunVim([], after, '-p foo bar') | |
244 let lines = readfile('Xtestout') | |
245 call assert_equal(4, len(lines)) | |
246 call assert_equal('Tab page 1', lines[0]) | |
247 call assert_equal('> foo', lines[1]) | |
248 call assert_equal('Tab page 2', lines[2]) | |
249 call assert_equal(' bar', lines[3]) | |
250 endif | |
251 | |
252 call delete('Xtestout') | |
253 endfunc | |
254 | |
255 " Test the -V[N] argument to set the 'version' option to [N] | |
256 func Test_V_arg() | |
257 let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq') | |
258 call assert_equal(" verbose=0\n", out) | |
259 | |
260 let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq') | |
261 call assert_match("^sourcing \"$VIMRUNTIME/defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n verbose=2\n$", out) | |
262 | |
263 let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq') | |
264 call assert_match("\+*\nsourcing \"$VIMRUNTIME/defaults\.vim\"\r\nline 1: \" The default vimrc file\..*\n verbose=15\n\+*", out) | |
265 endfunc | |
266 | |
267 " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). | |
268 func Test_A_F_H_arg() | |
269 let after = [ | |
270 \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")', | |
271 \ 'qall', | |
272 \ ] | |
273 if has('arabic') && RunVim([], after, '-A') | |
274 let lines = readfile('Xtestout') | |
275 call assert_equal(['1', '1', '0', '0'], lines) | |
276 endif | |
277 | |
278 if has('farsi') && RunVim([], after, '-F') | |
279 let lines = readfile('Xtestout') | |
280 call assert_equal(['1', '0', '1', '0'], lines) | |
281 endif | |
282 | |
283 if has('rightleft') && RunVim([], after, '-H') | |
284 let lines = readfile('Xtestout') | |
285 call assert_equal(['1', '0', '0', '1'], lines) | |
223 endif | 286 endif |
224 | 287 |
225 call delete('Xtestout') | 288 call delete('Xtestout') |
226 endfunc | 289 endfunc |
227 | 290 |