diff src/testdir/test_autocmd.vim @ 11961:0240e7e3d736 v8.0.0861

patch 8.0.0861: still many old style tests commit https://github.com/vim/vim/commit/4a137b45864310060410f34cb9c7d0f0231bb256 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 4 22:37:11 2017 +0200 patch 8.0.0861: still many old style tests Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Fri, 04 Aug 2017 22:45:04 +0200
parents 1395a3b6978d
children d2e367d9de1f
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -613,3 +613,22 @@ func Test_OptionSet_diffmode_close()
   call test_override('starting', 0)
   "delfunc! AutoCommandOptionSet
 endfunc
+
+" Test for Bufleave autocommand that deletes the buffer we are about to edit.
+func Test_BufleaveWithDelete()
+  new | edit Xfile1
+
+  augroup test_bufleavewithdelete
+      autocmd!
+      autocmd BufLeave Xfile1 bwipe Xfile2
+  augroup END
+
+  call assert_fails('edit Xfile2', 'E143:')
+  call assert_equal('Xfile1', bufname('%'))
+
+  autocmd! test_bufleavewithdelete BufLeave Xfile1
+  augroup! test_bufleavewithdelete
+
+  new
+  bwipe! Xfile1
+endfunc