changeset 22778:3ec5f653f64d v8.2.1937

patch 8.2.1937: Vim9: test for confirm modifier fails in some situations Commit: https://github.com/vim/vim/commit/645cd3eb1fae784579fab11feea634bfaff9af49 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 1 20:04:57 2020 +0100 patch 8.2.1937: Vim9: test for confirm modifier fails in some situations Problem: Vim9: test for confirm modifier fails in some situations. Solution: Add a short wait. Handle failure better.
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Nov 2020 20:15:03 +0100
parents a707e11443ee
children b90c404c6c1a
files src/testdir/term_util.vim src/testdir/test_vim9_cmd.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/term_util.vim
+++ b/src/testdir/term_util.vim
@@ -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
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -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
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1937,
+/**/
     1936,
 /**/
     1935,