aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-02 00:57:49 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:27:56 +0100
commitcbecae46f4b098cd6018055c7f4c70bd147c7938 (patch)
tree738da5fd30a7cbb66a7a6d456461ce3049bcf770 /src/nvim/testdir/test_autocmd.vim
parent4fe4b5abb6845b51af195e77576179ff5281451e (diff)
downloadrneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.tar.gz
rneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.tar.bz2
rneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.zip
vim-patch:8.0.0861: still many old style tests
Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/4a137b45864310060410f34cb9c7d0f0231bb256 vim-patch:8.0.0862: file size test fails on MS-Windows Problem: File size test fails on MS-Windows. Solution: Set fileformat after opening new buffer. Strip CR. https://github.com/vim/vim/commit/07c043af5f054c7dfeb676414f8fa6aeda8f9c2b
Diffstat (limited to 'src/nvim/testdir/test_autocmd.vim')
-rw-r--r--src/nvim/testdir/test_autocmd.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 82c04abf5b..a4ef5de1ba 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -442,3 +442,41 @@ func Test_Cmdline()
au! CmdlineEnter
au! CmdlineLeave
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
+
+" 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