diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/core/job_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/fixtures/non_executable.txt | 1 |
2 files changed, 17 insertions, 3 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 9d24ba62db..79cc877cac 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -65,9 +65,22 @@ describe('jobs', function() end) it('returns 0 when it fails to start', function() - local status, rv = pcall(eval, "jobstart([])") - eq(false, status) - ok(rv ~= nil) + eq("", eval("v:errmsg")) + execute("let g:test_jobid = jobstart([])") + eq(0, eval("g:test_jobid")) + eq("E474:", string.match(eval("v:errmsg"), "E%d*:")) + end) + + it('returns -1 when target is not executable #5465', function() + local function new_job() return eval([[jobstart(['echo', 'foo'])]]) end + local executable_jobid = new_job() + local nonexecutable_jobid = eval( + "jobstart(['./test/functional/fixtures/non_executable.txt'])") + eq(-1, nonexecutable_jobid) + -- Should _not_ throw an error. + eq("", eval("v:errmsg")) + -- Non-executable job should not increment the job ids. #5465 + eq(executable_jobid + 1, new_job()) end) it('invokes callbacks when the job writes and exits', function() diff --git a/test/functional/fixtures/non_executable.txt b/test/functional/fixtures/non_executable.txt new file mode 100644 index 0000000000..cc27ecc664 --- /dev/null +++ b/test/functional/fixtures/non_executable.txt @@ -0,0 +1 @@ +This file is not an executable |