aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-27 00:59:27 +0200
committerGitHub <noreply@github.com>2019-07-27 00:59:27 +0200
commit809613c952b16c33e8ed2993b6a623bdf31884e8 (patch)
treea5effbb7a8c367d76ea2bf92a1e32371b512611f
parent2b731a388a0fc2742911f6449b7b7fccf2590550 (diff)
parent53d1801b4913b6c459ec706bcb453128cf691e5f (diff)
downloadrneovim-809613c952b16c33e8ed2993b6a623bdf31884e8.tar.gz
rneovim-809613c952b16c33e8ed2993b6a623bdf31884e8.tar.bz2
rneovim-809613c952b16c33e8ed2993b6a623bdf31884e8.zip
Merge pull request #10580 from blueyed/tests-cat
tests: use "cat" also on Windows
-rw-r--r--test/functional/core/job_spec.lua19
-rw-r--r--test/functional/helpers.lua2
2 files changed, 8 insertions, 13 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 86466415e5..cdff035c63 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -159,7 +159,7 @@ describe('jobs', function()
end)
it('allows interactive commands', function()
- nvim('command', "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
neq(0, eval('j'))
nvim('command', 'call jobsend(j, "abc\\n")')
eq({'notification', 'stdout', {0, {'abc', ''}}}, next_msg())
@@ -187,7 +187,6 @@ describe('jobs', function()
end)
it('preserves NULs', function()
- if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
-- Make a file with NULs in it.
local filename = helpers.tmpname()
write_file(filename, "abc\0def\n")
@@ -206,7 +205,6 @@ describe('jobs', function()
end)
it("will not buffer data if it doesn't end in newlines", function()
- if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
if os.getenv("TRAVIS") and os.getenv("CC") == "gcc-4.9"
and helpers.os_name() == "osx" then
-- XXX: Hangs Travis macOS since e9061117a5b8f195c3f26a5cb94e18ddd7752d86.
@@ -223,7 +221,6 @@ describe('jobs', function()
end)
it('preserves newlines', function()
- if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
nvim('command', 'call jobsend(j, "a\\n\\nc\\n\\n\\n\\nb\\n\\n")')
eq({'notification', 'stdout',
@@ -231,7 +228,6 @@ describe('jobs', function()
end)
it('preserves NULs', function()
- if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
nvim('command', 'call jobsend(j, ["\n123\n", "abc\\nxyz\n", ""])')
eq({'notification', 'stdout', {0, {'\n123\n', 'abc\nxyz\n', ''}}},
@@ -242,7 +238,6 @@ describe('jobs', function()
end)
it('avoids sending final newline', function()
- if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
nvim('command', 'call jobsend(j, ["some data", "without\nfinal nl"])')
eq({'notification', 'stdout', {0, {'some data', 'without\nfinal nl'}}},
@@ -253,14 +248,14 @@ describe('jobs', function()
end)
it('closes the job streams with jobclose', function()
- nvim('command', "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
nvim('command', 'call jobclose(j, "stdin")')
eq({'notification', 'stdout', {0, {''}}}, next_msg())
- eq({'notification', 'exit', {0, iswin() and 1 or 0}}, next_msg())
+ eq({'notification', 'exit', {0, 0}}, next_msg())
end)
it("disallows jobsend on a job that closed stdin", function()
- nvim('command', "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
nvim('command', 'call jobclose(j, "stdin")')
eq(false, pcall(function()
nvim('command', 'call jobsend(j, ["some data"])')
@@ -273,7 +268,7 @@ describe('jobs', function()
end)
it('disallows jobstop twice on the same job', function()
- nvim('command', "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
neq(0, eval('j'))
eq(true, pcall(eval, "jobstop(j)"))
eq(false, pcall(eval, "jobstop(j)"))
@@ -284,7 +279,7 @@ describe('jobs', function()
end)
it('can get the pid value using getpid', function()
- nvim('command', "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
local pid = eval('jobpid(j)')
neq(NIL, meths.get_proc(pid))
nvim('command', 'call jobstop(j)')
@@ -759,7 +754,7 @@ describe('jobs', function()
it('cannot have both rpc and pty options', function()
command("let g:job_opts.pty = v:true")
command("let g:job_opts.rpc = v:true")
- local _, err = pcall(command, "let j = jobstart(has('win32') ? ['find', '/v', ''] : ['cat', '-'], g:job_opts)")
+ local _, err = pcall(command, "let j = jobstart(['cat', '-'], g:job_opts)")
ok(string.find(err, "E475: Invalid argument: job cannot have both 'pty' and 'rpc' options set") ~= nil)
end)
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 2571db99e4..ce7d348747 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -496,7 +496,7 @@ end
local function set_shell_powershell()
source([[
set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
- let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep;'
+ let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep; Remove-Item -Force alias:cat;'
]])
end