diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-26 20:43:40 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-26 20:43:40 +0200 |
commit | e99e84497b89e5f91df519790802770920ecf4fe (patch) | |
tree | 00b7113a373bf2346efb361cd36aced5ecf3ccdd /src/testdir/test_autocmd.vim | |
parent | 45a249513f5ed2de0a6f6b5cb6e32015e35644be (diff) |
patch 7.4.2103v7.4.2103
Problem: Can't have "augroup END" right after ":au!".
Solution: Check for the bar character before the command argument.
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r-- | src/testdir/test_autocmd.vim | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 580c42fe4d..b9d5cfe27b 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -19,6 +19,7 @@ if has('timers') call timer_start(100, 'ExitInsertMode') call feedkeys('a', 'x!') call assert_equal(1, g:triggered) + au! CursorHoldI endfunc func Test_cursorhold_insert_ctrl_x() @@ -29,6 +30,7 @@ if has('timers') " CursorHoldI does not trigger after CTRL-X call feedkeys("a\<C-X>", 'x!') call assert_equal(0, g:triggered) + au! CursorHoldI endfunc endif @@ -58,6 +60,7 @@ function Test_bufunload() bwipeout call assert_equal(["bufunload", "bufdelete", "bufwipeout"], s:li) + au! test_bufunload_group augroup! test_bufunload_group endfunc @@ -120,3 +123,31 @@ func Test_win_tab_autocmd() augroup END unlet g:record endfunc + +func s:AddAnAutocmd() + augroup vimBarTest + au BufReadCmd * echo 'hello' + augroup END + call assert_equal(3, len(split(execute('au vimBarTest'), "\n"))) +endfunc + +func Test_early_bar() + " test that a bar is recognized before the {event} + call s:AddAnAutocmd() + augroup vimBarTest | au! | augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + call s:AddAnAutocmd() + augroup vimBarTest| au!| augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + " test that a bar is recognized after the {event} + call s:AddAnAutocmd() + augroup vimBarTest| au!BufReadCmd| augroup END + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) + + " test that a bar is recognized after the {group} + call s:AddAnAutocmd() + au! vimBarTest|echo 'hello' + call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) +endfunc |