diff src/testdir/test_autocmd.vim @ 9682:a98607bb756c v7.4.2117

commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 29 20:50:24 2016 +0200 patch 7.4.2117 Problem: Deleting an augroup that still has autocmds does not give a warning. The next defined augroup takes its place. Solution: Give a warning and prevent the index being used for another group name.
author Christian Brabandt <cb@256bit.org>
date Fri, 29 Jul 2016 21:00:08 +0200
parents 01c9630e80e0
children 65e43481d7de
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -151,3 +151,20 @@ func Test_early_bar()
   au! vimBarTest|echo 'hello'
   call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
 endfunc
+
+func Test_augroup_warning()
+  augroup TheWarning
+    au VimEnter * echo 'entering'
+  augroup END
+  call assert_true(match(execute('au VimEnter'), "TheWarning.*VimEnter") >= 0)
+  redir => res
+  augroup! TheWarning
+  redir END
+  call assert_true(match(res, "W19:") >= 0)
+  call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
+
+  " check "Another" does not take the pace of the deleted entry
+  augroup Another
+  augroup END
+  call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
+endfunc