annotate src/testdir/test_autocmd.vim @ 10575:01a5f64a7a20 v8.0.0177

patch 8.0.0177: BufEnter autocommand not fired for a directory commit https://github.com/vim/vim/commit/e13b9afe1283f5ae43232b5992372a0eb570666c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 13 22:01:02 2017 +0100 patch 8.0.0177: BufEnter autocommand not fired for a directory Problem: When opening a buffer on a directory and inside a try/catch then the BufEnter event is not triggered. Solution: Return NOTDONE from readfile() for a directory and deal with the three possible return values. (Justin M. Keyes, closes #1375, closes #1353)
author Christian Brabandt <cb@256bit.org>
date Fri, 13 Jan 2017 22:15:03 +0100
parents a369d97995ff
children 7f355d8cd634
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8738
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for autocommands
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
10242
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
3 function! s:cleanup_buffers() abort
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
4 for bnr in range(1, bufnr('$'))
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
5 if bufloaded(bnr) && bufnr('%') != bnr
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
6 execute 'bd! ' . bnr
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
7 endif
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
8 endfor
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
9 endfunction
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
10
8738
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 func Test_vim_did_enter()
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_false(v:vim_did_enter)
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " This script will never reach the main loop, can't check if v:vim_did_enter
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " becomes one.
e770986c855a commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
8947
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
17
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
18 if has('timers')
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
19 func ExitInsertMode(id)
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
20 call feedkeys("\<Esc>")
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
21 endfunc
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
22
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
23 func Test_cursorhold_insert()
10151
0be17a56e65f commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents: 10141
diff changeset
24 " Need to move the cursor.
0be17a56e65f commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents: 10141
diff changeset
25 call feedkeys("ggG", "xt")
0be17a56e65f commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents: 10141
diff changeset
26
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
27 let g:triggered = 0
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
28 au CursorHoldI * let g:triggered += 1
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
29 set updatetime=20
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
30 call timer_start(100, 'ExitInsertMode')
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
31 call feedkeys('a', 'x!')
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
32 call assert_equal(1, g:triggered)
9653
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
33 au! CursorHoldI
10141
b67088aae933 commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents: 10114
diff changeset
34 set updatetime&
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
35 endfunc
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
36
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
37 func Test_cursorhold_insert_ctrl_x()
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
38 let g:triggered = 0
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
39 au CursorHoldI * let g:triggered += 1
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
40 set updatetime=20
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
41 call timer_start(100, 'ExitInsertMode')
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
42 " CursorHoldI does not trigger after CTRL-X
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
43 call feedkeys("a\<C-X>", 'x!')
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
44 call assert_equal(0, g:triggered)
9653
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
45 au! CursorHoldI
10141
b67088aae933 commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents: 10114
diff changeset
46 set updatetime&
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
47 endfunc
8947
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
48 endif
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
49
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
50 function Test_bufunload()
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
51 augroup test_bufunload_group
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
52 autocmd!
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
53 autocmd BufUnload * call add(s:li, "bufunload")
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
54 autocmd BufDelete * call add(s:li, "bufdelete")
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
55 autocmd BufWipeout * call add(s:li, "bufwipeout")
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
56 augroup END
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
57
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
58 let s:li=[]
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
59 new
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
60 setlocal bufhidden=
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
61 bunload
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
62 call assert_equal(["bufunload", "bufdelete"], s:li)
8947
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
63
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
64 let s:li=[]
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
65 new
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
66 setlocal bufhidden=delete
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
67 bunload
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
68 call assert_equal(["bufunload", "bufdelete"], s:li)
8947
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
69
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
70 let s:li=[]
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
71 new
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
72 setlocal bufhidden=unload
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
73 bwipeout
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
74 call assert_equal(["bufunload", "bufdelete", "bufwipeout"], s:li)
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
75
9653
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
76 au! test_bufunload_group
9106
97a9538c37ff commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents: 8947
diff changeset
77 augroup! test_bufunload_group
8947
c07caeb90a35 commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents: 8738
diff changeset
78 endfunc
9450
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
79
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
80 " SEGV occurs in older versions. (At least 7.4.2005 or older)
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
81 function Test_autocmd_bufunload_with_tabnext()
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
82 tabedit
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
83 tabfirst
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
84
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
85 augroup test_autocmd_bufunload_with_tabnext_group
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
86 autocmd!
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
87 autocmd BufUnload <buffer> tabnext
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
88 augroup END
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
89
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
90 quit
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
91 call assert_equal(2, tabpagenr('$'))
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
92
10106
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
93 autocmd! test_autocmd_bufunload_with_tabnext_group
9450
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
94 augroup! test_autocmd_bufunload_with_tabnext_group
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
95 tablast
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
96 quit
073aebdba121 commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents: 9106
diff changeset
97 endfunc
9595
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
98
10114
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
99 function Test_autocmd_bufwinleave_with_tabfirst()
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
100 tabedit
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
101 augroup sample
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
102 autocmd!
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
103 autocmd BufWinLeave <buffer> tabfirst
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
104 augroup END
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
105 call setline(1, ['a', 'b', 'c'])
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
106 edit! a.txt
10151
0be17a56e65f commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents: 10141
diff changeset
107 tabclose
10114
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
108 endfunc
aa2219afd1c2 commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents: 10106
diff changeset
109
10106
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
110 " SEGV occurs in older versions. (At least 7.4.2321 or older)
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
111 function Test_autocmd_bufunload_avoiding_SEGV_01()
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
112 split aa.txt
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
113 let lastbuf = bufnr('$')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
114
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
115 augroup test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
116 autocmd!
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
117 exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
118 augroup END
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
119
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
120 call assert_fails('edit bb.txt', 'E937:')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
121
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
122 autocmd! test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
123 augroup! test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
124 bwipe! aa.txt
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
125 bwipe! bb.txt
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
126 endfunc
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
127
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
128 " SEGV occurs in older versions. (At least 7.4.2321 or older)
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
129 function Test_autocmd_bufunload_avoiding_SEGV_02()
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
130 setlocal buftype=nowrite
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
131 let lastbuf = bufnr('$')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
132
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
133 augroup test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
134 autocmd!
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
135 exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
136 augroup END
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
137
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
138 normal! i1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
139 call assert_fails('edit a.txt', 'E517:')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
140 call feedkeys("\<CR>")
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
141
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
142 autocmd! test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
143 augroup! test_autocmd_bufunload
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
144 bwipe! a.txt
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
145 endfunc
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
146
9595
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
147 func Test_win_tab_autocmd()
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
148 let g:record = []
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
149
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
150 augroup testing
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
151 au WinNew * call add(g:record, 'WinNew')
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
152 au WinEnter * call add(g:record, 'WinEnter')
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
153 au WinLeave * call add(g:record, 'WinLeave')
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
154 au TabNew * call add(g:record, 'TabNew')
9599
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
155 au TabClosed * call add(g:record, 'TabClosed')
9595
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
156 au TabEnter * call add(g:record, 'TabEnter')
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
157 au TabLeave * call add(g:record, 'TabLeave')
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
158 augroup END
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
159
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
160 split
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
161 tabnew
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
162 close
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
163 close
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
164
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
165 call assert_equal([
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
166 \ 'WinLeave', 'WinNew', 'WinEnter',
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
167 \ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',
9599
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
168 \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter',
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
169 \ 'WinLeave', 'WinEnter'
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
170 \ ], g:record)
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
171
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
172 let g:record = []
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
173 tabnew somefile
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
174 tabnext
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
175 bwipe somefile
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
176
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
177 call assert_equal([
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
178 \ 'WinLeave', 'TabLeave', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter',
9595
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
179 \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter',
9599
42a8a81decdf commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents: 9595
diff changeset
180 \ 'TabClosed'
9595
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
181 \ ], g:record)
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
182
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
183 augroup testing
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
184 au!
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
185 augroup END
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
186 unlet g:record
0190d5de215f commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents: 9450
diff changeset
187 endfunc
9653
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
188
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
189 func s:AddAnAutocmd()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
190 augroup vimBarTest
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
191 au BufReadCmd * echo 'hello'
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
192 augroup END
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
193 call assert_equal(3, len(split(execute('au vimBarTest'), "\n")))
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
194 endfunc
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
195
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
196 func Test_early_bar()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
197 " test that a bar is recognized before the {event}
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
198 call s:AddAnAutocmd()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
199 augroup vimBarTest | au! | augroup END
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
200 call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
201
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
202 call s:AddAnAutocmd()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
203 augroup vimBarTest| au!| augroup END
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
204 call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
205
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
206 " test that a bar is recognized after the {event}
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
207 call s:AddAnAutocmd()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
208 augroup vimBarTest| au!BufReadCmd| augroup END
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
209 call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
210
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
211 " test that a bar is recognized after the {group}
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
212 call s:AddAnAutocmd()
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
213 au! vimBarTest|echo 'hello'
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
214 call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
01c9630e80e0 commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents: 9599
diff changeset
215 endfunc
9682
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
216
10058
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
217 func RemoveGroup()
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
218 autocmd! StartOK
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
219 augroup! StartOK
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
220 endfunc
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
221
9682
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
222 func Test_augroup_warning()
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
223 augroup TheWarning
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
224 au VimEnter * echo 'entering'
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
225 augroup END
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
226 call assert_true(match(execute('au VimEnter'), "TheWarning.*VimEnter") >= 0)
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
227 redir => res
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
228 augroup! TheWarning
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
229 redir END
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
230 call assert_true(match(res, "W19:") >= 0)
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
231 call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
232
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
233 " check "Another" does not take the pace of the deleted entry
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
234 augroup Another
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
235 augroup END
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
236 call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
10141
b67088aae933 commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents: 10114
diff changeset
237 augroup! Another
10058
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
238
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
239 " no warning for postpone aucmd delete
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
240 augroup StartOK
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
241 au VimEnter * call RemoveGroup()
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
242 augroup END
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
243 call assert_true(match(execute('au VimEnter'), "StartOK.*VimEnter") >= 0)
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
244 redir => res
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
245 doautocmd VimEnter
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
246 redir END
65e43481d7de commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents: 9682
diff changeset
247 call assert_true(match(res, "W19:") < 0)
10086
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
248 au! VimEnter
9682
a98607bb756c commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents: 9653
diff changeset
249 endfunc
10084
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
250
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
251 func Test_augroup_deleted()
10086
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
252 " This caused a crash before E936 was introduced
10084
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
253 augroup x
10086
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
254 call assert_fails('augroup! x', 'E936:')
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
255 au VimEnter * echo
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
256 augroup end
10084
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
257 augroup! x
10086
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
258 call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
1de911ef1edf commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents: 10084
diff changeset
259 au! VimEnter
10084
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
260 endfunc
3e410e6e1986 commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents: 10058
diff changeset
261
10106
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
262 " Tests for autocommands on :close command.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
263 " This used to be in test13.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
264 func Test_three_windows()
10242
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
265 " Clean up buffers, because in some cases this function fails.
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
266 call s:cleanup_buffers()
a369d97995ff commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents: 10151
diff changeset
267
10106
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
268 " Write three files and open them, each in a window.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
269 " Then go to next window, with autocommand that deletes the previous one.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
270 " Do this twice, writing the file.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
271 e! Xtestje1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
272 call setline(1, 'testje1')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
273 w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
274 sp Xtestje2
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
275 call setline(1, 'testje2')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
276 w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
277 sp Xtestje3
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
278 call setline(1, 'testje3')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
279 w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
280 wincmd w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
281 au WinLeave Xtestje2 bwipe
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
282 wincmd w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
283 call assert_equal('Xtestje1', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
284
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
285 au WinLeave Xtestje1 bwipe Xtestje3
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
286 close
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
287 call assert_equal('Xtestje1', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
288
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
289 " Test deleting the buffer on a Unload event. If this goes wrong there
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
290 " will be the ATTENTION prompt.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
291 e Xtestje1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
292 au!
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
293 au! BufUnload Xtestje1 bwipe
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
294 call assert_fails('e Xtestje3', 'E937:')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
295 call assert_equal('Xtestje3', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
296
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
297 e Xtestje2
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
298 sp Xtestje1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
299 call assert_fails('e', 'E937:')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
300 call assert_equal('Xtestje2', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
301
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
302 " Test changing buffers in a BufWipeout autocommand. If this goes wrong
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
303 " there are ml_line errors and/or a Crash.
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
304 au!
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
305 only
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
306 e Xanother
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
307 e Xtestje1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
308 bwipe Xtestje2
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
309 bwipe Xtestje3
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
310 au BufWipeout Xtestje1 buf Xtestje1
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
311 bwipe
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
312 call assert_equal('Xanother', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
313
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
314 only
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
315 help
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
316 wincmd w
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
317 1quit
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
318 call assert_equal('Xanother', expand('%'))
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
319
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
320 au!
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
321 call delete('Xtestje1')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
322 call delete('Xtestje2')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
323 call delete('Xtestje3')
58e6dd1d8be3 commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents: 10086
diff changeset
324 endfunc
10575
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
325
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
326 func Test_BufEnter()
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
327 au! BufEnter
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
328 au Bufenter * let val = val . '+'
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
329 let g:val = ''
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
330 split NewFile
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
331 call assert_equal('+', g:val)
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
332 bwipe!
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
333 call assert_equal('++', g:val)
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
334
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
335 " Also get BufEnter when editing a directory
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
336 call mkdir('Xdir')
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
337 split Xdir
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
338 call assert_equal('+++', g:val)
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
339 bwipe!
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
340
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
341 call delete('Xdir', 'd')
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
342 au! BufEnter
01a5f64a7a20 patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents: 10242
diff changeset
343 endfunc