diff src/testdir/test_swap.vim @ 25120:2d3660601fdb v8.2.3097

patch 8.2.3097: crash when using "quit" at recovery prompt Commit: https://github.com/vim/vim/commit/1d97efce0ce31ddf0dd4c1ae2228ef4caee6880c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 4 13:27:11 2021 +0200 patch 8.2.3097: crash when using "quit" at recovery prompt Problem: Crash when using "quit" at recovery prompt and autocommands are triggered. Solution: Block autocommands when creating an empty buffer to use as the current buffer. (closes #8506)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Jul 2021 13:30:04 +0200
parents a4647ee8e163
children ba16f025f2e2
line wrap: on
line diff
--- a/src/testdir/test_swap.vim
+++ b/src/testdir/test_swap.vim
@@ -360,6 +360,7 @@ func Test_swap_prompt_splitwin()
   let buf = RunVimInTerminal('', {'rows': 20})
   call term_sendkeys(buf, ":set nomore\n")
   call term_sendkeys(buf, ":set noruler\n")
+
   call term_sendkeys(buf, ":split Xfile1\n")
   call TermWait(buf)
   call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
@@ -371,8 +372,19 @@ func Test_swap_prompt_splitwin()
   call TermWait(buf)
   call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
   call StopVimInTerminal(buf)
+
+  " This caused Vim to crash when typing "q".
+  " TODO: it does not actually reproduce the crash.
+  call writefile(['au BufAdd * set virtualedit=all'], 'Xvimrc')
+
+  let buf = RunVimInTerminal('-u Xvimrc Xfile1', {'rows': 20, 'wait_for_ruler': 0})
+  call TermWait(buf)
+  call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:', term_getline(buf, 20))})
+  call term_sendkeys(buf, "q")
+
   %bwipe!
   call delete('Xfile1')
+  call delete('Xvimrc')
 endfunc
 
 func Test_swap_symlink()