summaryrefslogtreecommitdiff
path: root/src/testdir/test_terminal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-06-12 18:05:24 +0200
committerBram Moolenaar <Bram@vim.org>2018-06-12 18:05:24 +0200
commitd7a137fb0d980545dd567bee9c24cf7b9c3a2eae (patch)
treecc2884017b1e6e84213aa458a8fd28560de2ab24 /src/testdir/test_terminal.vim
parent07ccf7ce7fb948fd4d080b817e9fbaea9e721dab (diff)
downloadvim-d7a137fb0d980545dd567bee9c24cf7b9c3a2eae.zip
patch 8.1.0049: shell cannot tell running in a terminal window
Problem: Shell cannot tell running in a terminal window. Solution: Add the VIM_TERMINAL environment variable. (Christian Brabandt)
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r--src/testdir/test_terminal.vim15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 3d06eb387..c082b3b73 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -482,18 +482,25 @@ func Test_terminal_servername()
if !has('clientserver')
return
endif
+ call s:test_environment("VIM_SERVERNAME", v:servername)
+endfunc
+
+func Test_terminal_version()
+ call s:test_environment("VIM_TERMINAL", string(v:version))
+endfunc
+
+func s:test_environment(name, value)
let buf = Run_shell_in_terminal({})
" Wait for the shell to display a prompt
call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
if has('win32')
- call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r")
+ call term_sendkeys(buf, "echo %" . a:name . "%\r")
else
- call term_sendkeys(buf, "echo $VIM_SERVERNAME\r")
+ call term_sendkeys(buf, "echo $" . a:name . "\r")
endif
call term_wait(buf)
call Stop_shell_in_terminal(buf)
- call WaitFor('getline(2) == v:servername')
- call assert_equal(v:servername, getline(2))
+ call WaitForAssert({-> assert_equal(a:value, getline(2))})
exe buf . 'bwipe'
unlet buf