diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-01-14 20:56:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-14 20:56:30 -0500 |
| commit | 0fad952a2b7d90d2c3215e8e3c50ae62233e2158 (patch) | |
| tree | dd4d33f99fb2af6253a5809d6c8dd86ce091f1d6 /src/nvim/testdir/test_startup.vim | |
| parent | 2390a0d3c412060eeeec2c7076a2014e2834eb10 (diff) | |
| parent | d953614e72c266a911bf9752dc25abe4c839a78d (diff) | |
| download | rneovim-0fad952a2b7d90d2c3215e8e3c50ae62233e2158.tar.gz rneovim-0fad952a2b7d90d2c3215e8e3c50ae62233e2158.tar.bz2 rneovim-0fad952a2b7d90d2c3215e8e3c50ae62233e2158.zip | |
Merge pull request #13750 from janlazo/vim-8.2.2329
vim-patch:8.2.{2329,2334}
Diffstat (limited to 'src/nvim/testdir/test_startup.vim')
| -rw-r--r-- | src/nvim/testdir/test_startup.vim | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index e7f332bc4c..e6ad92f483 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -735,4 +735,82 @@ func Test_x_arg() call delete('Xtest_x_arg') 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 expectations = {'nvim': ['n', '0', '0', '0', '200', '']} + + " let prognames = ['vim', 'gvim', 'ex', 'exim', 'view', 'gview', + " \ 'evim', 'eview', 'rvim', 'rgvim', 'rview', 'rgview', + " \ 'vimdiff', 'gvimdiff'] + let prognames = ['nvim'] + + 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 -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 |