aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-01-22 19:23:29 +0100
committerGitHub <noreply@github.com>2020-01-22 19:23:29 +0100
commit91bd1ddf3b5572076a233d6113c6cb092faa74f2 (patch)
treefd98dbd9591ea59ec5ae5ba06d3439cb3a3d4830 /test
parente53e860759e8b74a98072bc333a49b48649ad6f9 (diff)
parent041ec8997a7f613f2ca13bf339c652f117fcb809 (diff)
downloadrneovim-91bd1ddf3b5572076a233d6113c6cb092faa74f2.tar.gz
rneovim-91bd1ddf3b5572076a233d6113c6cb092faa74f2.tar.bz2
rneovim-91bd1ddf3b5572076a233d6113c6cb092faa74f2.zip
Merge pull request #11740 from Billy4195/fix_jobstop
make jobstop() return 0 instead of throw error for already stopped job
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/job_spec.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index b63b868127..57e6f4fd63 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -306,16 +306,16 @@ describe('jobs', function()
end))
end)
- it('disallows jobsend/stop on a non-existent job', function()
+ it('disallows jobsend on a non-existent job', function()
eq(false, pcall(eval, "jobsend(-1, 'lol')"))
- eq(false, pcall(eval, "jobstop(-1)"))
+ eq(0, eval('jobstop(-1)'))
end)
- it('disallows jobstop twice on the same job', function()
+ it('jobstop twice on the stopped or exited job return 0', function()
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)"))
+ eq(1, eval("jobstop(j)"))
+ eq(0, eval("jobstop(j)"))
end)
it('will not leak memory if we leave a job running', function()
@@ -919,6 +919,13 @@ describe('jobs', function()
end)
end)
+ it('jobstop on same id before stopped', function()
+ nvim('command', 'let j = jobstart(["cat", "-"], g:job_opts)')
+ neq(0, eval('j'))
+
+ eq({1, 0}, eval('[jobstop(j), jobstop(j)]'))
+ end)
+
describe('running tty-test program', function()
if helpers.pending_win32(pending) then return end
local function next_chunk()