summaryrefslogtreecommitdiffstats
path: root/src/testdir/term_util.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-01 21:53:50 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-01 21:53:50 +0200
commit1112c0febb509d0cb219f3a2479fd36833507167 (patch)
tree967a7cd924438bef0fae418c5a837f6001aef1ef /src/testdir/term_util.vim
parenta0d072ef8203b225bd46bcd826cb3d2e3c3b941a (diff)
patch 8.2.1114: terminal test sometimes times outv8.2.1114
Problem: Terminal test sometimes times out. Solution: Split the test in two parts.
Diffstat (limited to 'src/testdir/term_util.vim')
-rw-r--r--src/testdir/term_util.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/term_util.vim b/src/testdir/term_util.vim
index 7a73adbe07..17f9752a99 100644
--- a/src/testdir/term_util.vim
+++ b/src/testdir/term_util.vim
@@ -146,4 +146,28 @@ func StopVimInTerminal(buf)
only!
endfunc
+" Open a terminal with a shell, assign the job to g:job and return the buffer
+" number.
+func Run_shell_in_terminal(options)
+ if has('win32')
+ let buf = term_start([&shell,'/k'], a:options)
+ else
+ let buf = term_start(&shell, a:options)
+ endif
+ let g:test_is_flaky = 1
+
+ let termlist = term_list()
+ call assert_equal(1, len(termlist))
+ call assert_equal(buf, termlist[0])
+
+ let g:job = term_getjob(buf)
+ call assert_equal(v:t_job, type(g:job))
+
+ let string = string({'job': buf->term_getjob()})
+ call assert_match("{'job': 'process \\d\\+ run'}", string)
+
+ return buf
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab