summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-04 22:37:11 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-04 22:37:11 +0200
commit4a137b45864310060410f34cb9c7d0f0231bb256 (patch)
treefbd29799c3e3fc89ff3e81c022827b5f2b5ebdf7 /src/testdir/test_autocmd.vim
parent6b7355a30ddd294c19cd9be924d487d592ccfae1 (diff)
patch 8.0.0861: still many old style testsv8.0.0861
Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 95b4cb9d45..dede9fa607 100644
--- 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