summaryrefslogtreecommitdiff
path: root/src/testdir/test_terminal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-11 16:55:36 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-11 16:55:36 +0100
commitb852c3e64d319d6ec47dd780c8654ae095e1d8c2 (patch)
tree8253a1081afe78e1af8e24e1f034910ce19d295d /src/testdir/test_terminal.vim
parent12a96de430779b88795fac87a2be666d9f661d1e (diff)
downloadvim-git-b852c3e64d319d6ec47dd780c8654ae095e1d8c2.tar.gz
patch 8.0.1596: no autocommand specifically for opening a terminal windowv8.0.1596
Problem: No autocommand specifically for opening a terminal window. Solution: Add TerminalOpen. (?, closes #2484)
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r--src/testdir/test_terminal.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 0178e3b88..d8e40d1c3 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -908,3 +908,37 @@ func Test_terminal_qall_prompt()
" close the terminal window where Vim was running
quit
endfunc
+
+func Test_terminalopen_autocmd()
+ augroup repro
+ au!
+ au TerminalOpen * let s:called += 1
+ augroup END
+
+ let s:called = 0
+
+ " Open a terminal window with :terminal
+ terminal
+ call assert_equal(1, s:called)
+ bwipe!
+
+ " Open a terminal window with term_start()
+ call term_start(&shell)
+ call assert_equal(2, s:called)
+ bwipe!
+
+ " Open a hidden terminal buffer with :terminal
+ terminal ++hidden
+ call assert_equal(3, s:called)
+ for buf in term_list()
+ exe buf . "bwipe!"
+ endfor
+
+ " Open a hidden terminal buffer with term_start()
+ let buf = term_start(&shell, {'hidden': 1})
+ call assert_equal(4, s:called)
+ exe buf . "bwipe!"
+
+ unlet s:called
+ au! repro
+endfunction