annotate src/testdir/test_shell.vim @ 25698:000b37efd5fa v8.2.3385

patch 8.2.3385: escaping for fish shell does not work properly Commit: https://github.com/vim/vim/commit/6e82351130ddb8d13cf3748b47f07cae77886fc7 Author: Jason Cox <dev@jasoncarloscox.com> Date: Sun Aug 29 12:36:49 2021 +0200 patch 8.2.3385: escaping for fish shell does not work properly Problem: Escaping for fish shell does not work properly. Solution: Insert a backslash before a backslash. (Jason Cox, closes https://github.com/vim/vim/issues/8810)
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 Aug 2021 12:45:05 +0200
parents d5e9c05b4811
children 454cbc872368
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test for the shell related options ('shell', 'shellcmdflag', 'shellpipe',
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " 'shellquote', 'shellredir', 'shellxescape', and 'shellxquote')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source check.vim
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 source shared.vim
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 func Test_shell_options()
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
8 " The expected value of 'shellcmdflag', 'shellpipe', 'shellquote',
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
9 " 'shellredir', 'shellxescape', 'shellxquote' for the supported shells.
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let shells = []
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 if has('unix')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 let shells += [['sh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 \ ['ksh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 \ ['mksh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 \ ['zsh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 \ ['zsh-beta', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 \ ['bash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 \ ['fish', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 \ ['ash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 \ ['dash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 \ ['csh', '-c', '|& tee', '', '>&', '', ''],
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
22 \ ['tcsh', '-c', '|& tee', '', '>&', '', ''],
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
23 \ ['pwsh', '-c', '>%s 2>&1', '', '>%s 2>&1', '', '']]
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 endif
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 if has('win32')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 \ ['cmd.exe', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '('],
25068
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
28 \ ['powershell.exe', '-Command', '2>&1 | Out-File -Encoding default',
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
29 \ '', '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'],
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
30 \ ['powershell', '-Command', '2>&1 | Out-File -Encoding default', '',
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
31 \ '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'],
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
32 \ ['pwsh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
33 \ ['pwsh', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ ['sh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ ['ksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ ['mksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ ['pdksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ ['zsh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ ['zsh-beta.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ ['bash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ ['dash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ ['csh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"'],
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ ['tcsh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"']]
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endif
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
46 " start a new Vim instance with 'shell' set to each of the supported shells
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
47 " and check the default shell option settings
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 let after =<< trim END
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 let l = [&shell, &shellcmdflag, &shellpipe, &shellquote]
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 let l += [&shellredir, &shellxescape, &shellxquote]
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call writefile([json_encode(l)], 'Xtestout')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 qall!
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 END
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 for e in shells
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 if RunVim([], after, '--cmd "set shell=' .. e[0] .. '"')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 call assert_equal(e, json_decode(readfile('Xtestout')[0]))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 endif
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 endfor
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
60 " Test shellescape() for each of the shells.
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 for e in shells
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 exe 'set shell=' .. e[0]
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$'
25698
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
64 let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%# \\'"
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
65 let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\# \\'"
25068
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
66 elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
67 \ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
25698
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
68 let str1 = "'cmd \"arg1\" ''arg2'' !%# \\'"
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
69 let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\# \\'"
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
70 elseif e[0] =~# '.*fish$' || e[0] =~# '.*fish.exe$'
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
71 let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\\\'"
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
72 let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\\\'"
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 else
25698
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
74 let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%# \\'"
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
75 let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\# \\'"
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 endif
25698
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
77 call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%# \\"), e[0])
000b37efd5fa patch 8.2.3385: escaping for fish shell does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25527
diff changeset
78 call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%# \\", 1), e[0])
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
79
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
80 " Try running an external command with the shell.
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
81 if executable(e[0])
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
82 " set the shell options for the current 'shell'
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
83 let [&shellcmdflag, &shellpipe, &shellquote, &shellredir,
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
84 \ &shellxescape, &shellxquote] = e[1:6]
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
85 new
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
86 try
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
87 r !echo hello
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
88 call assert_equal('hello', substitute(getline(2), '\W', '', 'g'), e[0])
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
89 catch
25527
d5e9c05b4811 patch 8.2.3300: Lua: can only execute on Vim command at a time
Bram Moolenaar <Bram@vim.org>
parents: 25084
diff changeset
90 call assert_report('Failed to run shell command, shell: ' .. e[0]
d5e9c05b4811 patch 8.2.3300: Lua: can only execute on Vim command at a time
Bram Moolenaar <Bram@vim.org>
parents: 25084
diff changeset
91 \ .. ', caught ' .. v:exception)
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
92 finally
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
93 bwipe!
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
94 endtry
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
95 endif
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 endfor
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
97 set shell& shellcmdflag& shellpipe& shellquote&
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
98 set shellredir& shellxescape& shellxquote&
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 call delete('Xtestout')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 endfunc
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 " Test for the 'shell' option
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 func Test_shell()
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 CheckUnix
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 let save_shell = &shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 set shell=
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 let caught_e91 = 0
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 try
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 catch /E91:/
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 let caught_e91 = 1
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 endtry
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call assert_equal(1, caught_e91)
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 let &shell = save_shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 endfunc
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 " Test for the 'shellquote' option
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 func Test_shellquote()
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 CheckUnix
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 set shellquote=#
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 set verbose=20
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 redir => v
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 silent! !echo Hello
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 redir END
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 set verbose&
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 set shellquote&
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 call assert_match(': "#echo Hello#"', v)
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 endfunc
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
130 " Test for the 'shellescape' option
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 func Test_shellescape()
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 let save_shell = &shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 set shell=bash
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 call assert_equal("'text'", shellescape('text'))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 call assert_equal("'te\"xt'", 'te"xt'->shellescape())
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 call assert_equal("'te'\\''xt'", shellescape("te'xt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 call assert_equal("'te%xt'", shellescape("te%xt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 call assert_equal("'te\\%xt'", shellescape("te%xt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 call assert_equal("'te#xt'", shellescape("te#xt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 call assert_equal("'te\\#xt'", shellescape("te#xt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 call assert_equal("'te!xt'", shellescape("te!xt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 call assert_equal("'te\\!xt'", shellescape("te!xt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 call assert_equal("'te\nxt'", shellescape("te\nxt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 set shell=tcsh
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 call assert_equal("'te\\!xt'", shellescape("te!xt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 let &shell = save_shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 endfunc
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
25068
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
156 " Test for 'shellslash'
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
157 func Test_shellslash()
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
158 CheckOption shellslash
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
159 let save_shellslash = &shellslash
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
160 " The shell and cmdflag, and expected slash in tempname with shellslash set or
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
161 " unset. The assert checks the file separator before the leafname.
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
162 " ".*\\\\[^\\\\]*$"
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
163 let shells = [['cmd', '/c', '\\', '/'],
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
164 \ ['powershell', '-Command', '\\', '/'],
25084
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
165 \ ['pwsh', '-Command', '\\', '/'],
beff72446e2e patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents: 25068
diff changeset
166 \ ['pwsh', '-c', '\\', '/'],
25068
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
167 \ ['sh', '-c', '/', '/']]
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
168 for e in shells
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
169 exe 'set shell=' .. e[0] .. ' | set shellcmdflag=' .. e[1]
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
170 set noshellslash
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
171 let file = tempname()
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
172 call assert_match('^.\+' .. e[2] .. '[^' .. e[2] .. ']\+$', file, e[0] .. ' ' .. e[1] .. ' nossl')
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
173 set shellslash
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
174 let file = tempname()
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
175 call assert_match('^.\+' .. e[3] .. '[^' .. e[3] .. ']\+$', file, e[0] .. ' ' .. e[1] .. ' ssl')
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
176 endfor
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
177 let &shellslash = save_shellslash
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
178 endfunc
0ce24f734615 patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents: 25066
diff changeset
179
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 " Test for 'shellxquote'
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 func Test_shellxquote()
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 CheckUnix
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 let save_shell = &shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 let save_sxq = &shellxquote
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 let save_sxe = &shellxescape
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 call setfperm('Xtestshell', "r-x------")
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 set shell=./Xtestshell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 set shellxquote=\\"
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 call feedkeys(":!pwd\<CR>\<CR>", 'xt')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 call assert_equal(['Cmd: [-c "pwd"]'], readfile('Xlog'))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 set shellxquote=(
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 call feedkeys(":!pwd\<CR>\<CR>", 'xt')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 call assert_equal(['Cmd: [-c (pwd)]'], readfile('Xlog'))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 set shellxquote=\\"(
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 call feedkeys(":!pwd\<CR>\<CR>", 'xt')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 call assert_equal(['Cmd: [-c "(pwd)"]'], readfile('Xlog'))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 set shellxescape=\"&<<()@^
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 set shellxquote=(
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 call feedkeys(":!pwd\"&<<{}@^\<CR>\<CR>", 'xt')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 call assert_equal(['Cmd: [-c (pwd^"^&^<^<{}^@^^)]'], readfile('Xlog'))
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 let &shell = save_shell
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 let &shellxquote = save_sxq
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 let &shellxescape = save_sxe
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 call delete('Xtestshell')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 call delete('Xlog')
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 endfunc
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215
25066
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
216 " Test for using the shell set in the $SHELL environment variable
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
217 func Test_set_shell()
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
218 let after =<< trim [CODE]
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
219 call writefile([&shell], "Xtestout")
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
220 quit!
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
221 [CODE]
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
222
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
223 if has('win32')
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
224 let $SHELL = 'C:\with space\cmd.exe'
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
225 let expected = '"C:\with space\cmd.exe"'
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
226 else
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
227 let $SHELL = '/bin/with space/sh'
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
228 let expected = '/bin/with\ space/sh'
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
229 endif
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
230
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
231 if RunVimPiped([], after, '', '')
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
232 let lines = readfile('Xtestout')
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
233 call assert_equal(expected, lines[0])
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
234 endif
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
235 call delete('Xtestout')
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
236 endfunc
4c366bbf6073 patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents: 25048
diff changeset
237
25048
82ae6fcd86c8 patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 " vim: shiftwidth=2 sts=2 expandtab