diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-12-11 01:38:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-11 01:38:17 +0100 |
commit | 0fe89fc9d777d4b07684c33eb07b304e1e8285e3 (patch) | |
tree | 44f619016c4ba86a87799688c9d94b04c10e1dbd /test | |
parent | 19848dce50c92b8f40dfd98b9a9d7366a829f4b8 (diff) | |
parent | cc7c42ed5dda06b84b9a93f375419b2fcbe7d9ac (diff) | |
download | rneovim-0fe89fc9d777d4b07684c33eb07b304e1e8285e3.tar.gz rneovim-0fe89fc9d777d4b07684c33eb07b304e1e8285e3.tar.bz2 rneovim-0fe89fc9d777d4b07684c33eb07b304e1e8285e3.zip |
Merge #5750 from justinmk/jobstart
jobstart(): Return -1 if cmd is non-executable
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 |