]> granicus.if.org Git - vim/commitdiff
patch 8.2.1937: Vim9: test for confirm modifier fails in some situations v8.2.1937
authorBram Moolenaar <Bram@vim.org>
Sun, 1 Nov 2020 19:04:57 +0000 (20:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 1 Nov 2020 19:04:57 +0000 (20:04 +0100)
Problem:    Vim9: test for confirm modifier fails in some situations.
Solution:   Add a short wait.  Handle failure better.

src/testdir/term_util.vim
src/testdir/test_vim9_cmd.vim
src/version.c

index 53735c8d33597c49ea29c6b234ed4567bad0169a..c2a2c350cd3f821a3914444fd0905ea81c0d30b2 100644 (file)
@@ -147,8 +147,13 @@ func StopVimInTerminal(buf)
   " Wait for all the pending updates to terminal to complete
   call TermWait(a:buf)
 
+  " Wait for the terminal to end.
   call WaitForAssert({-> assert_equal("finished", term_getstatus(a:buf))})
-  only!
+
+  " If the buffer still exists forcefully wipe it.
+  if bufexists(a:buf)
+    exe a:buf .. 'bwipe!'
+  endif
 endfunc
 
 " Open a terminal with a shell, assign the job to g:job and return the buffer
index a355af14fe92a45ebfdd593413bdf3fb097a5fbe..a87d9b25a8b35d10ace98d9a558245cb8df9e7fe 100644 (file)
@@ -392,10 +392,14 @@ func Test_command_modifier_confirm()
   call term_sendkeys(buf, ":call Getout()\n")
   call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
   call term_sendkeys(buf, "y")
+  call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
+  call term_sendkeys(buf, "\<CR>")
+  call TermWait(buf)
   call StopVimInTerminal(buf)
 
   call assert_equal(['changed'], readfile('Xfile'))
   call delete('Xfile')
+  call delete('.Xfile.swp')  " in case Vim was killed
   call delete('Xconfirmscript')
 endfunc
 
index 82bb09de7756a8775b81a86b7fbc4756bf50b65c..65050b9a31310ba8b420de81248ab7ca898064a7 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1937,
 /**/
     1936,
 /**/