diff src/testdir/test_terminal.vim @ 18450:507348b211b4 v8.1.2219

patch 8.1.2219: no autocommand for open window with terminal Commit: https://github.com/vim/vim/commit/28ed4dfe1f80905fb399c2cde31ace5ee14d8c67 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 26 16:21:40 2019 +0200 patch 8.1.2219: no autocommand for open window with terminal Problem: No autocommand for open window with terminal. Solution: Add TerminalWinOpen. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Oct 2019 16:30:03 +0200
parents 527b7084c556
children 0eeaa9a6e4e7
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -68,6 +68,23 @@ func Test_terminal_basic()
   unlet g:job
 endfunc
 
+func Test_terminal_TerminalWinOpen()
+  au TerminalWinOpen * let b:done = 'yes'
+  let buf = Run_shell_in_terminal({})
+  call assert_equal('yes', b:done)
+  call StopShellInTerminal(buf)
+  " closing window wipes out the terminal buffer with the finished job
+  close
+
+  if has("unix")
+    terminal ++hidden ++open sleep 1
+    sleep 1
+    call assert_fails("echo b:done", 'E121:')
+  endif
+
+  au! TerminalWinOpen
+endfunc
+
 func Test_terminal_make_change()
   let buf = Run_shell_in_terminal({})
   call StopShellInTerminal(buf)