aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/system_spec.lua
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-09-12 03:26:35 +0200
committerGitHub <noreply@github.com>2019-09-12 03:26:35 +0200
commit11fe132dd9c2e7d9613a24bf6f976557a924c3a2 (patch)
treedef7e46a9d42ada3d38b18a307f83ffad826918c /test/functional/eval/system_spec.lua
parent108763171f6d26c098422925e58df585c415324f (diff)
downloadrneovim-11fe132dd9c2e7d9613a24bf6f976557a924c3a2.tar.gz
rneovim-11fe132dd9c2e7d9613a24bf6f976557a924c3a2.tar.bz2
rneovim-11fe132dd9c2e7d9613a24bf6f976557a924c3a2.zip
tests: fix system_spec when run with clipboard manager (#10956)
* tests: move os_kill to functional helpers * tests: fix system_spec when run with clipboard manager Replaces "xclip" with a dedicated helper program. Fixes: https://github.com/neovim/neovim/issues/4900#issuecomment-501866842
Diffstat (limited to 'test/functional/eval/system_spec.lua')
-rw-r--r--test/functional/eval/system_spec.lua37
1 files changed, 9 insertions, 28 deletions
diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua
index 13134bc6e7..0a478fd05c 100644
--- a/test/functional/eval/system_spec.lua
+++ b/test/functional/eval/system_spec.lua
@@ -7,6 +7,7 @@ local eq, call, clear, eval, feed_command, feed, nvim =
local command = helpers.command
local exc_exec = helpers.exc_exec
local iswin = helpers.iswin
+local os_kill = helpers.os_kill
local Screen = require('test.functional.ui.screen')
@@ -23,14 +24,6 @@ local function delete_file(name)
end
end
--- Some tests require the xclip program and a x server.
-local xclip = nil
-do
- if os.getenv('DISPLAY') then
- xclip = (os.execute('command -v xclip > /dev/null 2>&1') == 0)
- end
-end
-
describe('system()', function()
before_each(clear)
@@ -378,15 +371,10 @@ describe('system()', function()
end)
end)
- describe("with a program that doesn't close stdout", function()
- if not xclip then
- pending('missing `xclip`', function() end)
- else
- it('will exit properly after passing input', function()
- eq('', eval([[system('xclip -i -loops 1 -selection clipboard', 'clip-data')]]))
- eq('clip-data', eval([[system('xclip -o -selection clipboard')]]))
- end)
- end
+ it("with a program that doesn't close stdout will exit properly after passing input", function()
+ local out = eval(string.format("system('%s', 'clip-data')", nvim_dir..'/streams-test'))
+ assert(out:sub(0, 5) == 'pid: ', out)
+ os_kill(out:match("%d+"))
end)
end)
@@ -562,16 +550,9 @@ describe('systemlist()', function()
end)
end)
- describe("with a program that doesn't close stdout", function()
- if not xclip then
- pending('missing `xclip`', function() end)
- else
- it('will exit properly after passing input', function()
- eq({}, eval(
- "systemlist('xclip -i -loops 1 -selection clipboard', ['clip', 'data'])"))
- eq({'clip', 'data'}, eval(
- "systemlist('xclip -o -selection clipboard')"))
- end)
- end
+ it("with a program that doesn't close stdout will exit properly after passing input", function()
+ local out = eval(string.format("systemlist('%s', 'clip-data')", nvim_dir..'/streams-test'))
+ assert(out[1]:sub(0, 5) == 'pid: ', out)
+ os_kill(out[1]:match("%d+"))
end)
end)