mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3061: testing the shell option is incomplete and spread out (#29090)
Problem: Testing the shell option is incomplete and spread out.
Solution: Move shell tests to one file and increase coverage. (Yegappan
Lakshmanan, closes vim/vim#8464)
054794c20f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
parent
f55767afe2
commit
40679c764a
@ -2143,54 +2143,6 @@ func Test_balloon_show()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_shellescape()
|
|
||||||
let save_shell = &shell
|
|
||||||
set shell=bash
|
|
||||||
call assert_equal("'text'", shellescape('text'))
|
|
||||||
call assert_equal("'te\"xt'", 'te"xt'->shellescape())
|
|
||||||
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))
|
|
||||||
|
|
||||||
set shell=fish
|
|
||||||
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\\\\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\\\\%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))
|
|
||||||
|
|
||||||
let &shell = save_shell
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_setbufvar_options()
|
func Test_setbufvar_options()
|
||||||
" This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the
|
" This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the
|
||||||
" window layout and cursor position.
|
" window layout and cursor position.
|
||||||
|
@ -1400,35 +1400,6 @@ func Test_buftype()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for the 'shell' option
|
|
||||||
func Test_shell()
|
|
||||||
throw 'Skipped: Nvim does not have :shell'
|
|
||||||
CheckUnix
|
|
||||||
let save_shell = &shell
|
|
||||||
set shell=
|
|
||||||
let caught_e91 = 0
|
|
||||||
try
|
|
||||||
shell
|
|
||||||
catch /E91:/
|
|
||||||
let caught_e91 = 1
|
|
||||||
endtry
|
|
||||||
call assert_equal(1, caught_e91)
|
|
||||||
let &shell = save_shell
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for the 'shellquote' option
|
|
||||||
func Test_shellquote()
|
|
||||||
CheckUnix
|
|
||||||
set shellquote=#
|
|
||||||
set verbose=20
|
|
||||||
redir => v
|
|
||||||
silent! !echo Hello
|
|
||||||
redir END
|
|
||||||
set verbose&
|
|
||||||
set shellquote&
|
|
||||||
call assert_match(': "#echo Hello#"', v)
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for the 'rightleftcmd' option
|
" Test for the 'rightleftcmd' option
|
||||||
func Test_rightleftcmd()
|
func Test_rightleftcmd()
|
||||||
CheckFeature rightleft
|
CheckFeature rightleft
|
||||||
|
@ -128,6 +128,29 @@ func Test_shellescape()
|
|||||||
call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
|
call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
|
||||||
call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
|
call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
|
||||||
|
|
||||||
|
set shell=fish
|
||||||
|
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\\\\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\\\\%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))
|
||||||
|
|
||||||
let &shell = save_shell
|
let &shell = save_shell
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user