Mercurial > vim
comparison src/testdir/test_startup.vim @ 14810:d47c8d294d1a v8.1.0417
patch 8.1.0417: several command line arguments are not tested
commit https://github.com/vim/vim/commit/036b09ca78c5516d2b914ebc9494bf7580b8fed8
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 21 12:54:06 2018 +0200
patch 8.1.0417: several command line arguments are not tested
Problem: Several command line arguments are not tested.
Solution: Add tests for -m, -M, -R and -Vfile. (Dominique Pelle,
closes #3458)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 21 Sep 2018 13:00:07 +0200 |
parents | 9be43810b5ec |
children | 421e120ffb30 |
comparison
equal
deleted
inserted
replaced
14809:d705b469b2ad | 14810:d47c8d294d1a |
---|---|
192 | 192 |
193 if RunVim([], after, '-O2') | 193 if RunVim([], after, '-O2') |
194 " Open 2 windows split vertically. Expect: | 194 " Open 2 windows split vertically. Expect: |
195 " - 2 windows | 195 " - 2 windows |
196 " - both windows should have the same or almost the same width | 196 " - both windows should have the same or almost the same width |
197 " - sum of both windows width (+ 1 separator) should be equal to the | 197 " - sum of both windows width (+ 1 for the separator) should be equal to |
198 " number of columns | 198 " the 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 windows 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') |
267 | 267 |
268 let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq') | 268 let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq') |
269 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out) | 269 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out) |
270 endfunc | 270 endfunc |
271 | 271 |
272 " Test the -V[N]{filename} argument to set the 'verbose' option to N | |
273 " and set 'verbosefile' to filename. | |
274 func Test_V_file_arg() | |
275 if RunVim([], [], ' --clean -X -V2Xverbosefile -c "set verbose? verbosefile?" -cq') | |
276 let out = join(readfile('Xverbosefile'), "\n") | |
277 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\n", out) | |
278 call assert_match("\n verbose=2\n", out) | |
279 call assert_match("\n verbosefile=Xverbosefile", out) | |
280 endif | |
281 | |
282 call delete('Xverbosefile') | |
283 endfunc | |
284 | |
285 " Test the -m, -M and -R arguments: | |
286 " -m resets 'write' | |
287 " -M resets 'modifiable' and 'write' | |
288 " -R sets 'readonly' | |
289 func Test_m_M_R() | |
290 let after = [ | |
291 \ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")', | |
292 \ 'qall', | |
293 \ ] | |
294 if RunVim([], after, '') | |
295 let lines = readfile('Xtestout') | |
296 call assert_equal(['1', '1', '0', '200'], lines) | |
297 endif | |
298 if RunVim([], after, '-m') | |
299 let lines = readfile('Xtestout') | |
300 call assert_equal(['0', '1', '0', '200'], lines) | |
301 endif | |
302 if RunVim([], after, '-M') | |
303 let lines = readfile('Xtestout') | |
304 call assert_equal(['0', '0', '0', '200'], lines) | |
305 endif | |
306 if RunVim([], after, '-R') | |
307 let lines = readfile('Xtestout') | |
308 call assert_equal(['1', '1', '1', '10000'], lines) | |
309 endif | |
310 | |
311 call delete('Xtestout') | |
312 endfunc | |
313 | |
272 " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). | 314 " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). |
273 func Test_A_F_H_arg() | 315 func Test_A_F_H_arg() |
274 let after = [ | 316 let after = [ |
275 \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")', | 317 \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")', |
276 \ 'qall', | 318 \ 'qall', |
428 func Test_zzz_startinsert() | 470 func Test_zzz_startinsert() |
429 " Test :startinsert | 471 " Test :startinsert |
430 call writefile(['123456'], 'Xtestout') | 472 call writefile(['123456'], 'Xtestout') |
431 let after = [ | 473 let after = [ |
432 \ ':startinsert', | 474 \ ':startinsert', |
433 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' | 475 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' |
434 \ ] | 476 \ ] |
435 if RunVim([], after, 'Xtestout') | 477 if RunVim([], after, 'Xtestout') |
436 let lines = readfile('Xtestout') | 478 let lines = readfile('Xtestout') |
437 call assert_equal(['foobar123456'], lines) | 479 call assert_equal(['foobar123456'], lines) |
438 endif | 480 endif |
439 " Test :startinsert! | 481 " Test :startinsert! |
440 call writefile(['123456'], 'Xtestout') | 482 call writefile(['123456'], 'Xtestout') |
441 let after = [ | 483 let after = [ |
442 \ ':startinsert!', | 484 \ ':startinsert!', |
443 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' | 485 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' |
444 \ ] | 486 \ ] |
445 if RunVim([], after, 'Xtestout') | 487 if RunVim([], after, 'Xtestout') |
446 let lines = readfile('Xtestout') | 488 let lines = readfile('Xtestout') |
447 call assert_equal(['123456foobar'], lines) | 489 call assert_equal(['123456foobar'], lines) |
448 endif | 490 endif |