patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim

Problem:    MS-Windows: job in terminal can't get back to Vim.
Solution:   set VIM_SERVERNAME in the environment. (Yasuhiro Matsumoto, closes
            #2360)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 295ccf1..cdff5c3 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -434,6 +434,27 @@
   call delete('Xdir', 'rf')
 endfunc
 
+func Test_terminal_servername()
+  if !has('clientserver')
+    return
+  endif
+  let g:buf = Run_shell_in_terminal({})
+  " Wait for the shell to display a prompt
+  call WaitFor('term_getline(g:buf, 1) != ""')
+  if has('win32')
+    call term_sendkeys(g:buf, "echo %VIM_SERVERNAME%\r")
+  else
+    call term_sendkeys(g:buf, "echo $VIM_SERVERNAME\r")
+  endif
+  call term_wait(g:buf)
+  call Stop_shell_in_terminal(g:buf)
+  call WaitFor('getline(2) == v:servername')
+  call assert_equal(v:servername, getline(2))
+
+  exe g:buf . 'bwipe'
+  unlet g:buf
+endfunc
+
 func Test_terminal_env()
   let g:buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}})
   " Wait for the shell to display a prompt