diff src/testdir/test_autocmd.vim @ 19073:45eb6f37692e v8.2.0097

patch 8.2.0097: crash with autocommand and spellfile Commit: https://github.com/vim/vim/commit/ce6db0273f2c4359f48d75103a42991aa481f14e Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 7 20:11:42 2020 +0100 patch 8.2.0097: crash with autocommand and spellfile Problem: Crash with autocommand and spellfile. (Tim Pope) Solution: Do not pop exestack when not pushed. (closes https://github.com/vim/vim/issues/5450)
author Bram Moolenaar <Bram@vim.org>
date Tue, 07 Jan 2020 20:15:04 +0100
parents b3eb5102447a
children 67fbe280a502
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2335,3 +2335,25 @@ func Test_BufWrite_lockmarks()
   call delete('Xtest')
   call delete('Xtest2')
 endfunc
+
+func Test_FileType_spell()
+  if !isdirectory('/tmp')
+    throw "Skipped: requires /tmp directory"
+  endif
+
+  " this was crashing with an invalid free()
+  setglobal spellfile=/tmp/en.utf-8.add
+  augroup crash
+    autocmd!
+    autocmd BufNewFile,BufReadPost crashfile setf somefiletype
+    autocmd BufNewFile,BufReadPost crashfile set ft=anotherfiletype
+    autocmd FileType anotherfiletype setlocal spell
+  augroup END
+  func! NoCrash() abort
+    edit /tmp/crashfile
+  endfunc
+  call NoCrash()
+
+  au! crash
+  setglobal spellfile=
+endfunc