mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #10580 from blueyed/tests-cat
tests: use "cat" also on Windows
This commit is contained in:
commit
809613c952
@ -159,7 +159,7 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('allows interactive commands', function()
|
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'))
|
neq(0, eval('j'))
|
||||||
nvim('command', 'call jobsend(j, "abc\\n")')
|
nvim('command', 'call jobsend(j, "abc\\n")')
|
||||||
eq({'notification', 'stdout', {0, {'abc', ''}}}, next_msg())
|
eq({'notification', 'stdout', {0, {'abc', ''}}}, next_msg())
|
||||||
@ -187,7 +187,6 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('preserves NULs', function()
|
it('preserves NULs', function()
|
||||||
if helpers.pending_win32(pending) then return end -- TODO: Need `cat`.
|
|
||||||
-- Make a file with NULs in it.
|
-- Make a file with NULs in it.
|
||||||
local filename = helpers.tmpname()
|
local filename = helpers.tmpname()
|
||||||
write_file(filename, "abc\0def\n")
|
write_file(filename, "abc\0def\n")
|
||||||
@ -206,7 +205,6 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it("will not buffer data if it doesn't end in newlines", function()
|
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"
|
if os.getenv("TRAVIS") and os.getenv("CC") == "gcc-4.9"
|
||||||
and helpers.os_name() == "osx" then
|
and helpers.os_name() == "osx" then
|
||||||
-- XXX: Hangs Travis macOS since e9061117a5b8f195c3f26a5cb94e18ddd7752d86.
|
-- XXX: Hangs Travis macOS since e9061117a5b8f195c3f26a5cb94e18ddd7752d86.
|
||||||
@ -223,7 +221,6 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('preserves newlines', function()
|
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', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||||
nvim('command', 'call jobsend(j, "a\\n\\nc\\n\\n\\n\\nb\\n\\n")')
|
nvim('command', 'call jobsend(j, "a\\n\\nc\\n\\n\\n\\nb\\n\\n")')
|
||||||
eq({'notification', 'stdout',
|
eq({'notification', 'stdout',
|
||||||
@ -231,7 +228,6 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('preserves NULs', function()
|
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', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||||
nvim('command', 'call jobsend(j, ["\n123\n", "abc\\nxyz\n", ""])')
|
nvim('command', 'call jobsend(j, ["\n123\n", "abc\\nxyz\n", ""])')
|
||||||
eq({'notification', 'stdout', {0, {'\n123\n', 'abc\nxyz\n', ''}}},
|
eq({'notification', 'stdout', {0, {'\n123\n', 'abc\nxyz\n', ''}}},
|
||||||
@ -242,7 +238,6 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('avoids sending final newline', function()
|
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', "let j = jobstart(['cat', '-'], g:job_opts)")
|
||||||
nvim('command', 'call jobsend(j, ["some data", "without\nfinal nl"])')
|
nvim('command', 'call jobsend(j, ["some data", "without\nfinal nl"])')
|
||||||
eq({'notification', 'stdout', {0, {'some data', 'without\nfinal nl'}}},
|
eq({'notification', 'stdout', {0, {'some data', 'without\nfinal nl'}}},
|
||||||
@ -253,14 +248,14 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('closes the job streams with jobclose', function()
|
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")')
|
nvim('command', 'call jobclose(j, "stdin")')
|
||||||
eq({'notification', 'stdout', {0, {''}}}, next_msg())
|
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)
|
end)
|
||||||
|
|
||||||
it("disallows jobsend on a job that closed stdin", function()
|
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")')
|
nvim('command', 'call jobclose(j, "stdin")')
|
||||||
eq(false, pcall(function()
|
eq(false, pcall(function()
|
||||||
nvim('command', 'call jobsend(j, ["some data"])')
|
nvim('command', 'call jobsend(j, ["some data"])')
|
||||||
@ -273,7 +268,7 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('disallows jobstop twice on the same job', function()
|
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'))
|
neq(0, eval('j'))
|
||||||
eq(true, pcall(eval, "jobstop(j)"))
|
eq(true, pcall(eval, "jobstop(j)"))
|
||||||
eq(false, pcall(eval, "jobstop(j)"))
|
eq(false, pcall(eval, "jobstop(j)"))
|
||||||
@ -284,7 +279,7 @@ describe('jobs', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can get the pid value using getpid', function()
|
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)')
|
local pid = eval('jobpid(j)')
|
||||||
neq(NIL, meths.get_proc(pid))
|
neq(NIL, meths.get_proc(pid))
|
||||||
nvim('command', 'call jobstop(j)')
|
nvim('command', 'call jobstop(j)')
|
||||||
@ -759,7 +754,7 @@ describe('jobs', function()
|
|||||||
it('cannot have both rpc and pty options', function()
|
it('cannot have both rpc and pty options', function()
|
||||||
command("let g:job_opts.pty = v:true")
|
command("let g:job_opts.pty = v:true")
|
||||||
command("let g:job_opts.rpc = 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)
|
ok(string.find(err, "E475: Invalid argument: job cannot have both 'pty' and 'rpc' options set") ~= nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ end
|
|||||||
local function set_shell_powershell()
|
local function set_shell_powershell()
|
||||||
source([[
|
source([[
|
||||||
set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
|
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
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user