diff src/testdir/test_autocmd.vim @ 10242:a369d97995ff v8.0.0019

commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 29 20:54:59 2016 +0200 patch 8.0.0019 Problem: Test_command_count is old style. Solution: Turn it into a new style test. (Naruhiko Nishino) Use more assert functions.
author Christian Brabandt <cb@256bit.org>
date Thu, 29 Sep 2016 21:00:05 +0200
parents 0be17a56e65f
children 01a5f64a7a20
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -1,5 +1,13 @@
 " Tests for autocommands
 
+function! s:cleanup_buffers() abort
+  for bnr in range(1, bufnr('$'))
+    if bufloaded(bnr) && bufnr('%') != bnr
+      execute 'bd! ' . bnr
+    endif
+  endfor
+endfunction
+
 func Test_vim_did_enter()
   call assert_false(v:vim_did_enter)
 
@@ -254,6 +262,9 @@ endfunc
 " Tests for autocommands on :close command.
 " This used to be in test13.
 func Test_three_windows()
+  " Clean up buffers, because in some cases this function fails.
+  call s:cleanup_buffers()
+
   " Write three files and open them, each in a window.
   " Then go to next window, with autocommand that deletes the previous one.
   " Do this twice, writing the file.