Mercurial > vim
comparison src/testdir/test_startup.vim @ 23574:e310c2a0bb8c v8.2.2329
patch 8.2.2329: not all ways Vim can be started are tested
Commit: https://github.com/vim/vim/commit/df4c9af7e73aa5d0fb5bf4c0e19a39b4e1d73517
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 11 19:54:42 2021 +0100
patch 8.2.2329: not all ways Vim can be started are tested
Problem: Not all ways Vim can be started are tested.
Solution: Add a test for different program names. (Dominique Pell?,
closes #7651)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 11 Jan 2021 20:00:04 +0100 |
parents | 990466a75d3c |
children | 51ba4b49d7f9 |
comparison
equal
deleted
inserted
replaced
23573:e2e2cc5d0856 | 23574:e310c2a0bb8c |
---|---|
1000 CheckEnglish | 1000 CheckEnglish |
1001 let l = systemlist(GetVimProg() .. ' - -') | 1001 let l = systemlist(GetVimProg() .. ' - -') |
1002 call assert_match('^Too many edit arguments: "-"', l[1]) | 1002 call assert_match('^Too many edit arguments: "-"', l[1]) |
1003 endfunc | 1003 endfunc |
1004 | 1004 |
1005 " Test starting vim with various names: vim, ex, view, evim, etc. | |
1006 func Test_progname() | |
1007 CheckUnix | |
1008 | |
1009 call mkdir('Xprogname', 'p') | |
1010 call writefile(['silent !date', | |
1011 \ 'call writefile([mode(1), ' | |
1012 \ .. '&insertmode, &diff, &readonly, &updatecount, ' | |
1013 \ .. 'join(split(execute("message"), "\n")[1:])], "Xprogname_out")', | |
1014 \ 'qall'], 'Xprogname_after') | |
1015 | |
1016 " +---------------------------------------------- progname | |
1017 " | +--------------------------------- mode(1) | |
1018 " | | +--------------------------- &insertmode | |
1019 " | | | +---------------------- &diff | |
1020 " | | | | +----------------- &readonly | |
1021 " | | | | | +-------- &updatecount | |
1022 " | | | | | | +--- :messages | |
1023 " | | | | | | | | |
1024 let expectations = { | |
1025 \ 'vim': ['n', '0', '0', '0', '200', ''], | |
1026 \ 'gvim': ['n', '0', '0', '0', '200', ''], | |
1027 \ 'ex': ['ce', '0', '0', '0', '200', ''], | |
1028 \ 'exim': ['cv', '0', '0', '0', '200', ''], | |
1029 \ 'view': ['n', '0', '0', '1', '10000', ''], | |
1030 \ 'gview': ['n', '0', '0', '1', '10000', ''], | |
1031 \ 'evim': ['n', '1', '0', '0', '200', ''], | |
1032 \ 'eview': ['n', '1', '0', '1', '10000', ''], | |
1033 \ 'rvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], | |
1034 \ 'rgvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], | |
1035 \ 'rview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], | |
1036 \ 'rgview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], | |
1037 \ 'vimdiff': ['n', '0', '1', '0', '200', ''], | |
1038 \ 'gvimdiff': ['n', '0', '1', '0', '200', '']} | |
1039 | |
1040 let prognames = ['vim', 'gvim', 'ex', 'exim', 'view', 'gview', | |
1041 \ 'evim', 'eview', 'rvim', 'rgvim', 'rview', 'rgview', | |
1042 \ 'vimdiff', 'gvimdiff'] | |
1043 | |
1044 for progname in prognames | |
1045 if empty($DISPLAY) | |
1046 if progname =~# 'g' | |
1047 " Can't run gvim, gview (etc.) if $DISPLAY is not setup. | |
1048 continue | |
1049 endif | |
1050 if has('gui') && (progname ==# 'evim' || progname ==# 'eview') | |
1051 " evim or eview will start the GUI if there is gui support. | |
1052 " So don't try to start them either if $DISPLAY is not setup. | |
1053 continue | |
1054 endif | |
1055 endif | |
1056 | |
1057 exe 'silent !ln -s -f ' ..exepath(GetVimProg()) .. ' Xprogname/' .. progname | |
1058 | |
1059 let stdout_stderr = '' | |
1060 if progname =~# 'g' | |
1061 let stdout_stderr = system('Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after') | |
1062 else | |
1063 exe 'sil !Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after' | |
1064 endif | |
1065 | |
1066 if progname =~# 'g' && !has('gui') | |
1067 call assert_equal("E25: GUI cannot be used: Not enabled at compile time\n", stdout_stderr, progname) | |
1068 else | |
1069 call assert_equal('', stdout_stderr, progname) | |
1070 call assert_equal(expectations[progname], readfile('Xprogname_out'), progname) | |
1071 endif | |
1072 | |
1073 call delete('Xprogname/' .. progname) | |
1074 call delete('Xprogname_out') | |
1075 endfor | |
1076 | |
1077 call delete('Xprogname_after') | |
1078 call delete('Xprogname', 'd') | |
1079 endfunc | |
1080 | |
1005 " vim: shiftwidth=2 sts=2 expandtab | 1081 " vim: shiftwidth=2 sts=2 expandtab |