aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-23 09:19:11 -0500
committerGitHub <noreply@github.com>2020-11-23 09:19:11 -0500
commitb155e6b54c6087fac57ea4278a3431ced7bfc7f6 (patch)
tree2060bc9e28c805bc31fa805334e8ab5139eea4e1 /src/nvim/testdir
parent029b5d036d7eb5a16b8e3a1d37f05f92ecf40499 (diff)
parentdd3583836b80e8eccd483d41125aa24f63d2f038 (diff)
downloadrneovim-b155e6b54c6087fac57ea4278a3431ced7bfc7f6.tar.gz
rneovim-b155e6b54c6087fac57ea4278a3431ced7bfc7f6.tar.bz2
rneovim-b155e6b54c6087fac57ea4278a3431ced7bfc7f6.zip
Merge pull request #11148 from janlazo/vim-8.0.1455
vim-patch:8.0.1455,8.1.{2115,2361}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_highlight.vim2
-rw-r--r--src/nvim/testdir/test_startup.vim21
-rw-r--r--src/nvim/testdir/test_system.vim54
3 files changed, 76 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim
index 00e42733a7..a80a73161f 100644
--- a/src/nvim/testdir/test_highlight.vim
+++ b/src/nvim/testdir/test_highlight.vim
@@ -516,7 +516,7 @@ func Test_termguicolors()
if !exists('+termguicolors')
return
endif
- if has('vtp') && !has('vcon')
+ if has('vtp') && !has('vcon') && !has('gui_running')
" Win32: 'guicolors' doesn't work without virtual console.
call assert_fails('set termguicolors', 'E954:')
return
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim
index 7fe0168356..6214975ef5 100644
--- a/src/nvim/testdir/test_startup.vim
+++ b/src/nvim/testdir/test_startup.vim
@@ -581,6 +581,27 @@ func Test_read_stdin()
call delete('Xtestout')
endfunc
+func Test_set_shell()
+ let after =<< trim [CODE]
+ call writefile([&shell], "Xtestout")
+ quit!
+ [CODE]
+
+ if has('win32')
+ let $SHELL = 'C:\with space\cmd.exe'
+ let expected = '"C:\with space\cmd.exe"'
+ else
+ let $SHELL = '/bin/with space/sh'
+ let expected = '"/bin/with space/sh"'
+ endif
+
+ if RunVimPiped([], after, '', '')
+ let lines = readfile('Xtestout')
+ call assert_equal(expected, lines[0])
+ endif
+ call delete('Xtestout')
+endfunc
+
func Test_progpath()
" Tests normally run with "./vim" or "../vim", these must have been expanded
" to a full path.
diff --git a/src/nvim/testdir/test_system.vim b/src/nvim/testdir/test_system.vim
index d3c0594c03..424cb4abd0 100644
--- a/src/nvim/testdir/test_system.vim
+++ b/src/nvim/testdir/test_system.vim
@@ -1,5 +1,8 @@
" Tests for system() and systemlist()
+source shared.vim
+source check.vim
+
function! Test_System()
if !executable('echo') || !executable('cat') || !executable('wc')
return
@@ -88,3 +91,54 @@ function! Test_system_exmode()
let a = system(v:progpath. cmd)
call assert_notequal(0, v:shell_error)
endfunc
+
+func Test_system_with_shell_quote()
+ throw 'skipped: enable after porting method patches'
+ CheckMSWindows
+
+ call mkdir('Xdir with spaces', 'p')
+ call system('copy "%COMSPEC%" "Xdir with spaces\cmd.exe"')
+
+ let shell_save = &shell
+ let shellxquote_save = &shellxquote
+ try
+ " Set 'shell' always needs noshellslash.
+ let shellslash_save = &shellslash
+ set noshellslash
+ let shell_tests = [
+ \ expand('$COMSPEC'),
+ \ '"' . fnamemodify('Xdir with spaces\cmd.exe', ':p') . '"',
+ \]
+ let &shellslash = shellslash_save
+
+ let sxq_tests = ['', '(', '"']
+
+ " Matrix tests: 'shell' * 'shellxquote'
+ for shell in shell_tests
+ let &shell = shell
+ for sxq in sxq_tests
+ let &shellxquote = sxq
+
+ let msg = printf('shell=%s shellxquote=%s', &shell, &shellxquote)
+
+ try
+ let out = 'echo 123'->system()
+ catch
+ call assert_report(printf('%s: %s', msg, v:exception))
+ continue
+ endtry
+
+ " On Windows we may get a trailing space and CR.
+ if out != "123 \n"
+ call assert_equal("123\n", out, msg)
+ endif
+
+ endfor
+ endfor
+
+ finally
+ let &shell = shell_save
+ let &shellxquote = shellxquote_save
+ call delete('Xdir with spaces', 'rf')
+ endtry
+endfunc