mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
test: :terminal when 'shell' uses backslashes
This commit is contained in:
parent
5ca6c9e046
commit
90b213990f
@ -141,15 +141,20 @@ describe(':terminal', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe(':terminal (with fake shell)', function()
|
local function test_terminal_with_fake_shell(backslash)
|
||||||
|
-- shell-test.c is a fake shell that prints its arguments and exits.
|
||||||
|
local shell_path = testprg('shell-test')
|
||||||
|
if backslash then
|
||||||
|
shell_path = shell_path:gsub('/', [[\]])
|
||||||
|
end
|
||||||
|
|
||||||
local screen
|
local screen
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(50, 4)
|
screen = Screen.new(50, 4)
|
||||||
screen:attach({rgb=false})
|
screen:attach({rgb=false})
|
||||||
-- shell-test.c is a fake shell that prints its arguments and exits.
|
nvim('set_option_value', 'shell', shell_path, {})
|
||||||
nvim('set_option_value', 'shell', testprg('shell-test'), {})
|
|
||||||
nvim('set_option_value', 'shellcmdflag', 'EXE', {})
|
nvim('set_option_value', 'shellcmdflag', 'EXE', {})
|
||||||
nvim('set_option_value', 'shellxquote', '', {})
|
nvim('set_option_value', 'shellxquote', '', {})
|
||||||
end)
|
end)
|
||||||
@ -189,7 +194,7 @@ describe(':terminal (with fake shell)', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
|
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
|
||||||
nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {})
|
nvim('set_option_value', 'shell', shell_path ..' -t jeff', {})
|
||||||
terminal_with_fake_shell()
|
terminal_with_fake_shell()
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^jeff $ |
|
^jeff $ |
|
||||||
@ -211,7 +216,7 @@ describe(':terminal (with fake shell)', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("executes a given command through the shell, when 'shell' has arguments", function()
|
it("executes a given command through the shell, when 'shell' has arguments", function()
|
||||||
nvim('set_option_value', 'shell', testprg('shell-test')..' -t jeff', {})
|
nvim('set_option_value', 'shell', shell_path ..' -t jeff', {})
|
||||||
command('set shellxquote=') -- win: avoid extra quotes
|
command('set shellxquote=') -- win: avoid extra quotes
|
||||||
terminal_with_fake_shell('echo hi')
|
terminal_with_fake_shell('echo hi')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -304,4 +309,13 @@ describe(':terminal (with fake shell)', function()
|
|||||||
terminal]])
|
terminal]])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe(':terminal (with fake shell)', function()
|
||||||
|
test_terminal_with_fake_shell(false)
|
||||||
|
if is_os('win') then
|
||||||
|
describe("when 'shell' uses backslashes", function()
|
||||||
|
test_terminal_with_fake_shell(true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user