Mercurial > vim
annotate src/testdir/test_shell.vim @ 25135:5731bcaaabcb v8.2.3104
patch 8.2.3104: Vim9: unspecified function type causes type error
Commit: https://github.com/vim/vim/commit/b7480cd8931fa1696265f75c7d4d9fdf0be69e12
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 4 18:28:15 2021 +0200
patch 8.2.3104: Vim9: unspecified function type causes type error
Problem: Vim9: unspecified function type causes type error.
Solution: Don't check type when min_argcount is negative. (issue https://github.com/vim/vim/issues/8492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Jul 2021 18:30:03 +0200 |
parents | beff72446e2e |
children | d5e9c05b4811 |
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$' |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%#'" |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
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$' |
25068
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
68 let str1 = "'cmd \"arg1\" ''arg2'' !%#'" |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
69 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
|
70 else |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%#'" |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\#'" |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 endif |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%#"), e[0]) |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 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
|
76 |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
77 " 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
|
78 if executable(e[0]) |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
79 " 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
|
80 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
|
81 \ &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
|
82 new |
25084
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
83 try |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
84 r !echo hello |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
85 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
|
86 catch |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
87 call assert_report('Failed to run shell command, shell: ' .. e[0]) |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
88 finally |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
89 bwipe! |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
90 endtry |
25066
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
91 endif |
25048
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 endfor |
25066
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
93 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
|
94 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
|
95 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
|
96 endfunc |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 " 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
|
99 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
|
100 CheckUnix |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 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
|
102 set shell= |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 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
|
104 try |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 shell |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 catch /E91:/ |
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 = 1 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 endtry |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 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
|
110 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
|
111 endfunc |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 " 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
|
114 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
|
115 CheckUnix |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 set shellquote=# |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 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
|
118 redir => v |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 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
|
120 redir END |
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& |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 set shellquote& |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 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
|
124 endfunc |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 |
25066
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
126 " 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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 |
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("'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
|
135 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
|
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 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
|
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 |
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\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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 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
|
150 endfunc |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 |
25068
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
152 " 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
|
153 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
|
154 CheckOption shellslash |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
155 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
|
156 " 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
|
157 " 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
|
158 " ".*\\\\[^\\\\]*$" |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
159 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
|
160 \ ['powershell', '-Command', '\\', '/'], |
25084
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
161 \ ['pwsh', '-Command', '\\', '/'], |
beff72446e2e
patch 8.2.3079: Powershell core not supported by default
Bram Moolenaar <Bram@vim.org>
parents:
25068
diff
changeset
|
162 \ ['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
|
163 \ ['sh', '-c', '/', '/']] |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
164 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
|
165 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
|
166 set noshellslash |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
167 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
|
168 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
|
169 set shellslash |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
170 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
|
171 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
|
172 endfor |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
173 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
|
174 endfunc |
0ce24f734615
patch 8.2.3071: shell options are not set properly for PowerShell
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
175 |
25048
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 " 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
|
177 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
|
178 CheckUnix |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 set shellxquote=\\" |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 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
|
190 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
|
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 shellxescape=\"&<<()@^ |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 set shellxquote=( |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 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
|
203 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
|
204 |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 endfunc |
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 |
25066
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
212 " 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
|
213 func Test_set_shell() |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
214 let after =<< trim [CODE] |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
215 call writefile([&shell], "Xtestout") |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
216 quit! |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
217 [CODE] |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
218 |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
219 if has('win32') |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
220 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
|
221 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
|
222 else |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
223 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
|
224 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
|
225 endif |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
226 |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
227 if RunVimPiped([], after, '', '') |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
228 let lines = readfile('Xtestout') |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
229 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
|
230 endif |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
231 call delete('Xtestout') |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
232 endfunc |
4c366bbf6073
patch 8.2.3070: not enough testing for shell use
Bram Moolenaar <Bram@vim.org>
parents:
25048
diff
changeset
|
233 |
25048
82ae6fcd86c8
patch 8.2.3061: testing the shell option is incomplete and spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 " vim: shiftwidth=2 sts=2 expandtab |