diff src/testdir/test_terminal.vim @ 14063:f39150ec146e v8.1.0049

patch 8.1.0049: shell cannot tell running in a terminal window commit https://github.com/vim/vim/commit/d7a137fb0d980545dd567bee9c24cf7b9c3a2eae Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 12 18:05:24 2018 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Tue, 12 Jun 2018 18:15:05 +0200
parents 6d9783027174
children 4d3f6bf86bec
line wrap: on
line diff
--- 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