diff src/testdir/test_excmd.vim @ 19435:8f8a5a15d00a v8.2.0275

patch 8.2.0275: some Ex code not covered by tests Commit: https://github.com/vim/vim/commit/406cd90f1963ca60813db91c413eef4b1b78ee44 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 18 21:54:41 2020 +0100 patch 8.2.0275: some Ex code not covered by tests Problem: Some Ex code not covered by tests. Solution: Add test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5659)
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Feb 2020 22:00:04 +0100
parents 67fbe280a502
children cb73f4ae6b7c
line wrap: on
line diff
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -238,6 +238,22 @@ func Test_confirm_cmd()
   call assert_equal(['foo4'], readfile('foo'))
   call assert_equal(['bar2'], readfile('bar'))
 
+  " Test for closing a window with a modified buffer
+  let buf = RunVimInTerminal('', {'rows': 20})
+  call term_sendkeys(buf, ":set nomore\n")
+  call term_sendkeys(buf, ":new\n")
+  call term_sendkeys(buf, ":call setline(1, 'abc')\n")
+  call term_sendkeys(buf, ":confirm close\n")
+  call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$',
+        \ term_getline(buf, 20))}, 1000)
+  call term_sendkeys(buf, "C")
+  call term_sendkeys(buf, ":confirm close\n")
+  call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$',
+        \ term_getline(buf, 20))}, 1000)
+  call term_sendkeys(buf, "N")
+  call term_sendkeys(buf, ":quit\n")
+  call StopVimInTerminal(buf)
+
   call delete('foo')
   call delete('bar')
 endfunc