mirror of
https://github.com/neovim/neovim.git
synced 2025-11-08 11:35:10 +00:00
Merge pull request #6050 from jamessan/fix-xclip-tests
Fix xclip tests to cleanup on their own
This commit is contained in:
@@ -30,8 +30,10 @@ describe('system()', function()
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
describe('command passed as a List', function()
|
describe('command passed as a List', function()
|
||||||
local printargs_path = helpers.nvim_dir..'/printargs-test'
|
local function printargs_path()
|
||||||
|
return helpers.nvim_dir..'/printargs-test'
|
||||||
.. (helpers.os_name() == 'windows' and '.exe' or '')
|
.. (helpers.os_name() == 'windows' and '.exe' or '')
|
||||||
|
end
|
||||||
|
|
||||||
it('sets v:shell_error if cmd[0] is not executable', function()
|
it('sets v:shell_error if cmd[0] is not executable', function()
|
||||||
call('system', { 'this-should-not-exist' })
|
call('system', { 'this-should-not-exist' })
|
||||||
@@ -63,16 +65,16 @@ describe('system()', function()
|
|||||||
|
|
||||||
it('quotes arguments correctly #5280', function()
|
it('quotes arguments correctly #5280', function()
|
||||||
local out = call('system',
|
local out = call('system',
|
||||||
{ printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })
|
{ printargs_path(), [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })
|
||||||
|
|
||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
eq([[arg1=1;arg2=2 "3;arg3=4 ' 5;arg4=6 ' 7';]], out)
|
eq([[arg1=1;arg2=2 "3;arg3=4 ' 5;arg4=6 ' 7';]], out)
|
||||||
|
|
||||||
out = call('system', { printargs_path, [['1]], [[2 "3]] })
|
out = call('system', { printargs_path(), [['1]], [[2 "3]] })
|
||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
eq([[arg1='1;arg2=2 "3;]], out)
|
eq([[arg1='1;arg2=2 "3;]], out)
|
||||||
|
|
||||||
out = call('system', { printargs_path, "A\nB" })
|
out = call('system', { printargs_path(), "A\nB" })
|
||||||
eq(0, eval('v:shell_error'))
|
eq(0, eval('v:shell_error'))
|
||||||
eq("arg1=A\nB;", out)
|
eq("arg1=A\nB;", out)
|
||||||
end)
|
end)
|
||||||
@@ -266,7 +268,7 @@ describe('system()', function()
|
|||||||
pending('missing `xclip`', function() end)
|
pending('missing `xclip`', function() end)
|
||||||
else
|
else
|
||||||
it('will exit properly after passing input', function()
|
it('will exit properly after passing input', function()
|
||||||
eq('', eval([[system('xclip -i -selection clipboard', 'clip-data')]]))
|
eq('', eval([[system('xclip -i -loops 1 -selection clipboard', 'clip-data')]]))
|
||||||
eq('clip-data', eval([[system('xclip -o -selection clipboard')]]))
|
eq('clip-data', eval([[system('xclip -o -selection clipboard')]]))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -440,7 +442,7 @@ describe('systemlist()', function()
|
|||||||
else
|
else
|
||||||
it('will exit properly after passing input', function()
|
it('will exit properly after passing input', function()
|
||||||
eq({}, eval(
|
eq({}, eval(
|
||||||
"systemlist('xclip -i -selection clipboard', ['clip', 'data'])"))
|
"systemlist('xclip -i -loops 1 -selection clipboard', ['clip', 'data'])"))
|
||||||
eq({'clip', 'data'}, eval(
|
eq({'clip', 'data'}, eval(
|
||||||
"systemlist('xclip -o -selection clipboard')"))
|
"systemlist('xclip -o -selection clipboard')"))
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user