summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-11 19:54:42 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-11 19:54:42 +0100
commitdf4c9af7e73aa5d0fb5bf4c0e19a39b4e1d73517 (patch)
tree70718d77323e92f36c1363c4a3cf56cdbcbbba24
parent82be4849eed0b8fbee45bc8da99b685ec89af59a (diff)
downloadvim-git-df4c9af7e73aa5d0fb5bf4c0e19a39b4e1d73517.tar.gz
patch 8.2.2329: not all ways Vim can be started are testedv8.2.2329
Problem: Not all ways Vim can be started are tested. Solution: Add a test for different program names. (Dominique Pellé, closes #7651)
-rw-r--r--src/testdir/test_startup.vim76
-rw-r--r--src/version.c2
2 files changed, 78 insertions, 0 deletions
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 72c43eac9..261cb5ef7 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -1002,4 +1002,80 @@ func Test_too_many_edit_args()
call assert_match('^Too many edit arguments: "-"', l[1])
endfunc
+" Test starting vim with various names: vim, ex, view, evim, etc.
+func Test_progname()
+ CheckUnix
+
+ call mkdir('Xprogname', 'p')
+ call writefile(['silent !date',
+ \ 'call writefile([mode(1), '
+ \ .. '&insertmode, &diff, &readonly, &updatecount, '
+ \ .. 'join(split(execute("message"), "\n")[1:])], "Xprogname_out")',
+ \ 'qall'], 'Xprogname_after')
+
+ " +---------------------------------------------- progname
+ " | +--------------------------------- mode(1)
+ " | | +--------------------------- &insertmode
+ " | | | +---------------------- &diff
+ " | | | | +----------------- &readonly
+ " | | | | | +-------- &updatecount
+ " | | | | | | +--- :messages
+ " | | | | | | |
+ let expectations = {
+ \ 'vim': ['n', '0', '0', '0', '200', ''],
+ \ 'gvim': ['n', '0', '0', '0', '200', ''],
+ \ 'ex': ['ce', '0', '0', '0', '200', ''],
+ \ 'exim': ['cv', '0', '0', '0', '200', ''],
+ \ 'view': ['n', '0', '0', '1', '10000', ''],
+ \ 'gview': ['n', '0', '0', '1', '10000', ''],
+ \ 'evim': ['n', '1', '0', '0', '200', ''],
+ \ 'eview': ['n', '1', '0', '1', '10000', ''],
+ \ 'rvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'],
+ \ 'rgvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'],
+ \ 'rview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'],
+ \ 'rgview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'],
+ \ 'vimdiff': ['n', '0', '1', '0', '200', ''],
+ \ 'gvimdiff': ['n', '0', '1', '0', '200', '']}
+
+ let prognames = ['vim', 'gvim', 'ex', 'exim', 'view', 'gview',
+ \ 'evim', 'eview', 'rvim', 'rgvim', 'rview', 'rgview',
+ \ 'vimdiff', 'gvimdiff']
+
+ for progname in prognames
+ if empty($DISPLAY)
+ if progname =~# 'g'
+ " Can't run gvim, gview (etc.) if $DISPLAY is not setup.
+ continue
+ endif
+ if has('gui') && (progname ==# 'evim' || progname ==# 'eview')
+ " evim or eview will start the GUI if there is gui support.
+ " So don't try to start them either if $DISPLAY is not setup.
+ continue
+ endif
+ endif
+
+ exe 'silent !ln -s -f ' ..exepath(GetVimProg()) .. ' Xprogname/' .. progname
+
+ let stdout_stderr = ''
+ if progname =~# 'g'
+ let stdout_stderr = system('Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after')
+ else
+ exe 'sil !Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after'
+ endif
+
+ if progname =~# 'g' && !has('gui')
+ call assert_equal("E25: GUI cannot be used: Not enabled at compile time\n", stdout_stderr, progname)
+ else
+ call assert_equal('', stdout_stderr, progname)
+ call assert_equal(expectations[progname], readfile('Xprogname_out'), progname)
+ endif
+
+ call delete('Xprogname/' .. progname)
+ call delete('Xprogname_out')
+ endfor
+
+ call delete('Xprogname_after')
+ call delete('Xprogname', 'd')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index f56da436b..2a6e1daa0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2329,
+/**/
2328,
/**/
2327,