aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2018-06-17 06:20:42 -0400
committerJustin M. Keyes <justinkz@gmail.com>2018-06-17 12:20:42 +0200
commit367343ae6e1e269f49ea29ac767628f9e4e825ac (patch)
treeee545baa63555bd063c855f372800102176abdef /src/nvim/testdir/test_functions.vim
parentb006771cba7b9db6f0b4214b2251e3dd742a1228 (diff)
downloadrneovim-367343ae6e1e269f49ea29ac767628f9e4e825ac.tar.gz
rneovim-367343ae6e1e269f49ea29ac767628f9e4e825ac.tar.bz2
rneovim-367343ae6e1e269f49ea29ac767628f9e4e825ac.zip
vim-patch:8.0.0625: shellescape() always escapes a newline (#8573)
Problem: shellescape() always escapes a newline, which does not work with some shells. (Harm te Hennepe) Solution: Only escape a newline when the "special" argument is non-zero. (Christian Brabandt, closes vim/vim#1590) https://github.com/vim/vim/commit/206155280def51160a9d81d983aed639015ffb44
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 8a82493ab6..8847653498 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -766,3 +766,28 @@ func Test_balloon_show()
call balloon_show('hi!')
endif
endfunc
+
+func Test_shellescape()
+ let save_shell = &shell
+ set shell=bash
+ call assert_equal("'text'", shellescape('text'))
+ call assert_equal("'te\"xt'", shellescape('te"xt'))
+ call assert_equal("'te'\\''xt'", shellescape("te'xt"))
+
+ call assert_equal("'te%xt'", shellescape("te%xt"))
+ call assert_equal("'te\\%xt'", shellescape("te%xt", 1))
+ call assert_equal("'te#xt'", shellescape("te#xt"))
+ call assert_equal("'te\\#xt'", shellescape("te#xt", 1))
+ call assert_equal("'te!xt'", shellescape("te!xt"))
+ call assert_equal("'te\\!xt'", shellescape("te!xt", 1))
+
+ call assert_equal("'te\nxt'", shellescape("te\nxt"))
+ call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))
+ set shell=tcsh
+ call assert_equal("'te\\!xt'", shellescape("te!xt"))
+ call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1))
+ call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
+ call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
+
+ let &shell = save_shell
+endfunc