diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-21 20:55:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-21 20:55:22 +0100 |
commit | 528ccfbaa1cc805f430a750c551e5a9fd7eb54fe (patch) | |
tree | ad9ff072e6bca789211c011f18b8cf6bfd35ffad | |
parent | 1916673a1696eab66516c3f96bec1f2e4b92f761 (diff) | |
download | vim-git-528ccfbaa1cc805f430a750c551e5a9fd7eb54fe.tar.gz |
patch 8.1.0618: term_getjob() does not return v:null as documentedv8.1.0618
Problem: term_getjob() does not return v:null as documented.
Solution: Do return v:null. (Damien) Add a test.
-rw-r--r-- | src/terminal.c | 7 | ||||
-rw-r--r-- | src/testdir/test_terminal.vim | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c index 20284af53..06d470c56 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -4794,11 +4794,14 @@ f_term_getjob(typval_T *argvars, typval_T *rettv) { buf_T *buf = term_get_buf(argvars, "term_getjob()"); - rettv->v_type = VAR_JOB; - rettv->vval.v_job = NULL; if (buf == NULL) + { + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NULL; return; + } + rettv->v_type = VAR_JOB; rettv->vval.v_job = buf->b_term->tl_job; if (rettv->vval.v_job != NULL) ++rettv->vval.v_job->jv_refcount; diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index d99a925f9..220b1d13e 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1714,3 +1714,8 @@ func Test_stop_in_terminal() call Stop_shell_in_terminal(bufnr) exe bufnr . 'bwipe' endfunc + +func Test_terminal_no_job() + let term = term_start('false', {'term_finish': 'close'}) + call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) +endfunc diff --git a/src/version.c b/src/version.c index 77bfd81e0..1612f9dd1 100644 --- a/src/version.c +++ b/src/version.c @@ -800,6 +800,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 618, +/**/ 617, /**/ 616, |