comparison src/testdir/test_startup.vim @ 17657:0da9bc55c31a v8.1.1826

patch 8.1.1826: tests use hand coded feature and option checks commit https://github.com/vim/vim/commit/8c5a278fc508da6dfe50e69b6ee734451aa4eafb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 7 23:07:07 2019 +0200 patch 8.1.1826: tests use hand coded feature and option checks Problem: Tests use hand coded feature and option checks. Solution: Use the commands from check.vim in more tests.
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Aug 2019 23:15:07 +0200
parents 40c4cb095d53
children 85160a3649b9
comparison
equal deleted inserted replaced
17656:2adce9da20d8 17657:0da9bc55c31a
1 " Tests for startup. 1 " Tests for startup.
2 2
3 source shared.vim 3 source shared.vim
4 source screendump.vim 4 source screendump.vim
5 source check.vim
5 6
6 " Check that loading startup.vim works. 7 " Check that loading startup.vim works.
7 func Test_startup_script() 8 func Test_startup_script()
8 set compatible 9 set compatible
9 source $VIMRUNTIME/defaults.vim 10 source $VIMRUNTIME/defaults.vim
260 call delete('Xtestout') 261 call delete('Xtestout')
261 endfunc 262 endfunc
262 263
263 " Test the -V[N] argument to set the 'verbose' option to [N] 264 " Test the -V[N] argument to set the 'verbose' option to [N]
264 func Test_V_arg() 265 func Test_V_arg()
265 if has('gui_running') 266 " Can't catch the output of gvim.
266 " Can't catch the output of gvim. 267 CheckNotGui
267 return 268
268 endif
269 let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq') 269 let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
270 call assert_equal(" verbose=0\n", out) 270 call assert_equal(" verbose=0\n", out)
271 271
272 let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq') 272 let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
273 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n", out) 273 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n", out)
393 393
394 call delete('Xtestout') 394 call delete('Xtestout')
395 endfunc 395 endfunc
396 396
397 func Test_invalid_args() 397 func Test_invalid_args()
398 if !has('unix') || has('gui_running') 398 " must be able to get the output of Vim.
399 " can't get output of Vim. 399 CheckUnix
400 return 400 CheckNotGui
401 endif
402 401
403 for opt in ['-Y', '--does-not-exist'] 402 for opt in ['-Y', '--does-not-exist']
404 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") 403 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
405 call assert_equal(1, v:shell_error) 404 call assert_equal(1, v:shell_error)
406 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) 405 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0])
597 " Only expect "vim" to appear in v:progname. 596 " Only expect "vim" to appear in v:progname.
598 call assert_match('vim\c', v:progname) 597 call assert_match('vim\c', v:progname)
599 endfunc 598 endfunc
600 599
601 func Test_silent_ex_mode() 600 func Test_silent_ex_mode()
602 if !has('unix') || has('gui_running') 601 " must be able to get the output of Vim.
603 " can't get output of Vim. 602 CheckUnix
604 return 603 CheckNotGui
605 endif
606 604
607 " This caused an ml_get error. 605 " This caused an ml_get error.
608 let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq') 606 let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
609 call assert_notmatch('E315:', out) 607 call assert_notmatch('E315:', out)
610 endfunc 608 endfunc
611 609
612 func Test_default_term() 610 func Test_default_term()
613 if !has('unix') || has('gui_running') 611 " must be able to get the output of Vim.
614 " can't get output of Vim. 612 CheckUnix
615 return 613 CheckNotGui
616 endif
617 614
618 let save_term = $TERM 615 let save_term = $TERM
619 let $TERM = 'unknownxxx' 616 let $TERM = 'unknownxxx'
620 let out = system(GetVimCommand() . ' -c''set term'' -c cq') 617 let out = system(GetVimCommand() . ' -c''set term'' -c cq')
621 call assert_match("defaulting to 'ansi'", out) 618 call assert_match("defaulting to 'ansi'", out)
647 endif 644 endif
648 call delete('Xtestout') 645 call delete('Xtestout')
649 endfunc 646 endfunc
650 647
651 func Test_issue_3969() 648 func Test_issue_3969()
652 if has('gui_running') 649 " Can't catch the output of gvim.
653 " Can't catch the output of gvim. 650 CheckNotGui
654 return 651
655 endif
656 " Check that message is not truncated. 652 " Check that message is not truncated.
657 let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq') 653 let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
658 call assert_equal('hello', out) 654 call assert_equal('hello', out)
659 endfunc 655 endfunc
660 656