vim-patch:9.1.0451: No test for escaping '<' with shellescape()

Problem:  No test for escaping '<' with shellescape()
Solution: Add a test.  Use memcpy() in code to make it easier to
          understand.  Fix a typo (zeertzjq).

closes: vim/vim#14876

88c8c547d5
This commit is contained in:
zeertzjq
2024-05-31 05:50:57 +08:00
parent df2c3b204b
commit 2de12e9bd7
3 changed files with 9 additions and 5 deletions

View File

@@ -119,6 +119,10 @@ func Test_shellescape()
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<cword>xt'", shellescape("te<cword>xt"))
call assert_equal("'te\\<cword>xt'", shellescape("te<cword>xt", 1))
call assert_equal("'te<cword>%xt'", shellescape("te<cword>%xt"))
call assert_equal("'te\\<cword>\\%xt'", shellescape("te<cword>%xt", 1))
call assert_equal("'te\nxt'", shellescape("te\nxt"))
call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))