]> granicus.if.org Git - vim/commitdiff
patch 8.1.0618: term_getjob() does not return v:null as documented v8.1.0618
authorBram Moolenaar <Bram@vim.org>
Fri, 21 Dec 2018 19:55:22 +0000 (20:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 21 Dec 2018 19:55:22 +0000 (20:55 +0100)
Problem:    term_getjob() does not return v:null as documented.
Solution:   Do return v:null. (Damien)  Add a test.

src/terminal.c
src/testdir/test_terminal.vim
src/version.c

index 20284af53189673c361afb77710c5b58d37e5be3..06d470c560d2e4e7af19befc041f3dabc90ed534 100644 (file)
@@ -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;
index d99a925f931cee35010e36ae1eee96aaf2a4a0f9..220b1d13ee1332f7d2e309cfe7a38dff446b0624 100644 (file)
@@ -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
index 77bfd81e06ccec4ae15e1a37fa814a5ee4c88398..1612f9dd1a62a98fab92bfb965d4d00fa90314c0 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    618,
 /**/
     617,
 /**/