summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-01 17:39:04 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-01 17:39:04 +0200
commit23324a0b35d18c5caac20b1d543ed2d1f762f5b5 (patch)
treede83b6adcee723a600ee23c0a28bcc28d2babd53 /src/testdir/test_autocmd.vim
parent8617348e2110c2c8387ea448a6258f1effa8d249 (diff)
patch 8.1.2108: cannot close the cmdline window from CmdWinEnterv8.1.2108
Problem: Cannot close the cmdline window from CmdWinEnter. (George Brown) Solution: Reset cmdwin_result earlier. (Christian Brabandt, closes #4980)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index f2c9af50f8..fe77bf5786 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2259,3 +2259,32 @@ func Test_autocmd_SafeState()
call StopVimInTerminal(buf)
call delete('XSafeState')
endfunc
+
+func Test_autocmd_CmdWinEnter()
+ CheckRunVimInTerminal
+ " There is not cmdwin switch, so
+ " test for cmdline_hist
+ " (both are available with small builds)
+ CheckFeature cmdline_hist
+ let lines =<< trim END
+ let b:dummy_var = 'This is a dummy'
+ autocmd CmdWinEnter * quit
+ let winnr = winnr('$')
+ END
+ let filename='XCmdWinEnter'
+ call writefile(lines, filename)
+ let buf = RunVimInTerminal('-S '.filename, #{rows: 6})
+
+ call term_sendkeys(buf, "q:")
+ call term_wait(buf)
+ call term_sendkeys(buf, ":echo b:dummy_var\<cr>")
+ call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 1000)
+ call term_sendkeys(buf, ":echo &buftype\<cr>")
+ call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000)
+ call term_sendkeys(buf, ":echo winnr\<cr>")
+ call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000)
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete(filename)
+endfunc