summaryrefslogtreecommitdiff
path: root/src/testdir/test_system.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-07 18:43:44 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-07 18:43:44 +0200
commit0ff5dedf0f69e56320199db7a2aad46be2a1f9b7 (patch)
tree6a951b52ece06eb18f388280df207d64cbd21f34 /src/testdir/test_system.vim
parentb2d0e51366dea6843f991f31a457f5456d162678 (diff)
downloadvim-git-0ff5dedf0f69e56320199db7a2aad46be2a1f9b7.tar.gz
patch 8.2.0712: various code not fully testedv8.2.0712
Problem: Various code not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #6049)
Diffstat (limited to 'src/testdir/test_system.vim')
-rw-r--r--src/testdir/test_system.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/testdir/test_system.vim b/src/testdir/test_system.vim
index e69a04552..d59787389 100644
--- a/src/testdir/test_system.vim
+++ b/src/testdir/test_system.vim
@@ -143,3 +143,41 @@ func Test_system_with_shell_quote()
call delete('Xdir with spaces', 'rf')
endtry
endfunc
+
+" Test for 'shellxquote'
+func Test_Shellxquote()
+ CheckUnix
+
+ let save_shell = &shell
+ let save_sxq = &shellxquote
+ let save_sxe = &shellxescape
+
+ call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell')
+ call setfperm('Xtestshell', "r-x------")
+ set shell=./Xtestshell
+
+ set shellxquote=\\"
+ call feedkeys(":!pwd\<CR>\<CR>", 'xt')
+ call assert_equal(['Cmd: [-c "pwd"]'], readfile('Xlog'))
+
+ set shellxquote=(
+ call feedkeys(":!pwd\<CR>\<CR>", 'xt')
+ call assert_equal(['Cmd: [-c (pwd)]'], readfile('Xlog'))
+
+ set shellxquote=\\"(
+ call feedkeys(":!pwd\<CR>\<CR>", 'xt')
+ call assert_equal(['Cmd: [-c "(pwd)"]'], readfile('Xlog'))
+
+ set shellxescape=\"&<<()@^
+ set shellxquote=(
+ call feedkeys(":!pwd\"&<<{}@^\<CR>\<CR>", 'xt')
+ call assert_equal(['Cmd: [-c (pwd^"^&^<^<{}^@^^)]'], readfile('Xlog'))
+
+ let &shell = save_shell
+ let &shellxquote = save_sxq
+ let &shellxescape = save_sxe
+ call delete('Xtestshell')
+ call delete('Xlog')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab