summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-16 16:16:10 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-16 16:16:10 +0100
commite751a5f531c1ceb58dacc7c280fdaae0df2c71c7 (patch)
tree2ad9b7d8e5161cdbcba837ec583356bd25c18b2a /src
parent2caad3fbbdbf1486a176c9f6bfbc3d9be90e09f7 (diff)
downloadvim-git-e751a5f531c1ceb58dacc7c280fdaae0df2c71c7.tar.gz
patch 8.1.0603: the :stop command is not testedv8.1.0603
Problem: The :stop command is not tested. Solution: Test :stop using a terminal window.
Diffstat (limited to 'src')
-rw-r--r--src/testdir/shared.vim10
-rw-r--r--src/testdir/test_terminal.vim31
-rw-r--r--src/version.c2
3 files changed, 43 insertions, 0 deletions
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 92aacfa34..4546be7f7 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -345,3 +345,13 @@ func Stop_shell_in_terminal(buf)
let job = term_getjob(a:buf)
call WaitFor({-> job_status(job) == "dead"})
endfunc
+
+" Gets the text of a terminal line, using term_scrape()
+func Get_terminal_text(bufnr, row)
+ let list = term_scrape(a:bufnr, a:row)
+ let text = ''
+ for item in list
+ let text .= item.chars
+ endfor
+ return text
+endfunc
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 70ea3dc94..d99a925f9 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1683,3 +1683,34 @@ func Test_terminal_does_not_truncate_last_newlines()
call delete('Xfile')
endfunc
+
+func Test_stop_in_terminal()
+ " We can't expect this to work on all systems, just test on Linux for now.
+ if !has('unix') || system('uname') !~ 'Linux'
+ return
+ endif
+ term /bin/sh
+ let bufnr = bufnr('')
+ call WaitForAssert({-> assert_equal('running', term_getstatus(bufnr))})
+ let lastrow = term_getsize(bufnr)[0]
+
+ call term_sendkeys(bufnr, GetVimCommandClean() . "\r")
+ call term_sendkeys(bufnr, ":echo 'ready'\r")
+ call WaitForAssert({-> assert_match('ready', Get_terminal_text(bufnr, lastrow))})
+
+ call term_sendkeys(bufnr, ":stop\r")
+ " Not sure where "Stopped" shows up, assume in the first three lines.
+ call WaitForAssert({-> assert_match('Stopped',
+ \ Get_terminal_text(bufnr, 1) .
+ \ Get_terminal_text(bufnr, 2) .
+ \ Get_terminal_text(bufnr, 3))})
+
+ call term_sendkeys(bufnr, "fg\r")
+ call term_sendkeys(bufnr, ":echo 'back again'\r")
+ call WaitForAssert({-> assert_match('back again', Get_terminal_text(bufnr, lastrow))})
+
+ call term_sendkeys(bufnr, ":quit\r")
+ call term_wait(bufnr)
+ call Stop_shell_in_terminal(bufnr)
+ exe bufnr . 'bwipe'
+endfunc
diff --git a/src/version.c b/src/version.c
index f9154cd03..c73a3ed72 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 */
/**/
+ 603,
+/**/
602,
/**/
601,