Mercurial > vim
annotate src/testdir/test_autocmd.vim @ 15430:d94901eeb762 v8.1.0723
patch 8.1.0723: cannot easily run specific test when in src/testdir
commit https://github.com/vim/vim/commit/ec50401e1e1357a1340b3c92109fd4860e38a8ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 11 17:30:16 2019 +0100
patch 8.1.0723: cannot easily run specific test when in src/testdir
Problem: Cannot run specific test when in src/testdir the same was as in
the src directory.
Solution: Move build rule to src/testdir/Makefile.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Jan 2019 17:45:05 +0100 |
parents | 63b02fcf1361 |
children | bfcd7ffe9ac2 |
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 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
3 source shared.vim |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
4 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15207
diff
changeset
|
5 func s:cleanup_buffers() abort |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
6 for bnr in range(1, bufnr('$')) |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
7 if bufloaded(bnr) && bufnr('%') != bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
8 execute 'bd! ' . bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
9 endif |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
10 endfor |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
11 endfunc |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
12 |
8738
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 func Test_vim_did_enter() |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_false(v:vim_did_enter) |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " 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
|
17 " becomes one. |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endfunc |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
19 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
20 if has('timers') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
21 func ExitInsertMode(id) |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
22 call feedkeys("\<Esc>") |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
23 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
24 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
25 func Test_cursorhold_insert() |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
26 " Need to move the cursor. |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
27 call feedkeys("ggG", "xt") |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
28 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
29 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
30 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
31 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
32 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
33 call feedkeys('a', 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
34 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
|
35 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
36 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
37 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
38 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
39 func Test_cursorhold_insert_ctrl_x() |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
40 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
41 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
42 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
43 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
44 " 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
|
45 call feedkeys("a\<C-X>", 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
46 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
|
47 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
48 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
49 endfunc |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
50 endif |
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
51 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
52 func Test_bufunload() |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
53 augroup test_bufunload_group |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
54 autocmd! |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 augroup END |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
59 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
60 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
61 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
62 setlocal bufhidden= |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
63 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
64 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
|
65 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
66 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
67 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
68 setlocal bufhidden=delete |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
69 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
70 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
|
71 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
72 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
73 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
74 setlocal bufhidden=unload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
75 bwipeout |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
76 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
|
77 |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
78 au! test_bufunload_group |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
79 augroup! test_bufunload_group |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
80 endfunc |
9450
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
81 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
82 " SEGV occurs in older versions. (At least 7.4.2005 or older) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
83 func Test_autocmd_bufunload_with_tabnext() |
9450
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
84 tabedit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
85 tabfirst |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
86 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
87 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
|
88 autocmd! |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
89 autocmd BufUnload <buffer> tabnext |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
90 augroup END |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
91 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
92 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
93 call assert_equal(2, tabpagenr('$')) |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
94 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
95 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
|
96 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
|
97 tablast |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
98 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
99 endfunc |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
100 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
101 func Test_autocmd_bufwinleave_with_tabfirst() |
10114
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
102 tabedit |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
103 augroup sample |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
104 autocmd! |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
105 autocmd BufWinLeave <buffer> tabfirst |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
106 augroup END |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
107 call setline(1, ['a', 'b', 'c']) |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
108 edit! a.txt |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
109 tabclose |
10114
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
110 endfunc |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
111 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
112 " SEGV occurs in older versions. (At least 7.4.2321 or older) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
113 func Test_autocmd_bufunload_avoiding_SEGV_01() |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
114 split aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
115 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
116 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
117 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
118 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
119 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
|
120 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
121 |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
122 " Todo: check for E937 generated first |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
123 " call assert_fails('edit bb.txt', 'E937:') |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
124 call assert_fails('edit bb.txt', 'E517:') |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
125 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
126 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
127 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
128 bwipe! aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
129 bwipe! bb.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
130 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
131 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
132 " SEGV occurs in older versions. (At least 7.4.2321 or older) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
133 func Test_autocmd_bufunload_avoiding_SEGV_02() |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
134 setlocal buftype=nowrite |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
135 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
136 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
137 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
138 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
139 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
|
140 augroup END |
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 normal! i1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
143 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
|
144 call feedkeys("\<CR>") |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
145 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
146 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
147 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
148 bwipe! a.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
149 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
150 |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
151 func Test_win_tab_autocmd() |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
152 let g:record = [] |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
153 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
154 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
163 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
164 split |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
165 tabnew |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
166 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
167 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
168 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
169 call assert_equal([ |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
170 \ 'WinLeave', 'WinNew', 'WinEnter', |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
171 \ '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
|
172 \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter', |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
173 \ 'WinLeave', 'WinEnter' |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
174 \ ], g:record) |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
175 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
176 let g:record = [] |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
177 tabnew somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
178 tabnext |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
179 bwipe somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
180 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
181 call assert_equal([ |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
182 \ '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
|
183 \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', |
9599
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
184 \ 'TabClosed' |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
185 \ ], g:record) |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
186 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
187 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
188 au! |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
189 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
190 unlet g:record |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
191 endfunc |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
192 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
193 func s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
194 augroup vimBarTest |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
195 au BufReadCmd * echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
196 augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
197 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
|
198 endfunc |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
199 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
200 func Test_early_bar() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
201 " 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
|
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 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
207 augroup vimBarTest| au!| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
208 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
|
209 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
210 " 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
|
211 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
212 augroup vimBarTest| au!BufReadCmd| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
213 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
|
214 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
215 " 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
|
216 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
217 au! vimBarTest|echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
218 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
|
219 endfunc |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
220 |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
221 func RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
222 autocmd! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
223 augroup! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
224 endfunc |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
225 |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
226 func Test_augroup_warning() |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
227 augroup TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
228 au VimEnter * echo 'entering' |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
229 augroup END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
230 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
|
231 redir => res |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
232 augroup! TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
233 redir END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
234 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
|
235 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
|
236 |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
237 " 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
|
238 augroup Another |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
239 augroup END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
240 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
|
241 augroup! Another |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
242 |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
243 " no warning for postpone aucmd delete |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
244 augroup StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
245 au VimEnter * call RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
246 augroup END |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
247 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
|
248 redir => res |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
249 doautocmd VimEnter |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
250 redir END |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
251 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
|
252 au! VimEnter |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
253 endfunc |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
254 |
12680
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
255 func Test_BufReadCmdHelp() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
256 " This used to cause access to free memory |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
257 au BufReadCmd * e +h |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
258 help |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
259 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
260 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
261 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
262 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
263 func Test_BufReadCmdHelpJump() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
264 " This used to cause access to free memory |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
265 au BufReadCmd * e +h{ |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
266 " } to fix highlighting |
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
267 call assert_fails('help', 'E434:') |
12680
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
268 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
269 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
270 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
271 |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
272 func Test_augroup_deleted() |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
273 " 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
|
274 augroup x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
275 call assert_fails('augroup! x', 'E936:') |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
276 au VimEnter * echo |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
277 augroup end |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
278 augroup! x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
279 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
|
280 au! VimEnter |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
281 endfunc |
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
282 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
283 " Tests for autocommands on :close command. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
284 " This used to be in test13. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
285 func Test_three_windows() |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
286 " 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
|
287 call s:cleanup_buffers() |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
288 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
289 " 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
|
290 " 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
|
291 " Do this twice, writing the file. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
292 e! Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
293 call setline(1, 'testje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
294 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
295 sp Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
296 call setline(1, 'testje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
297 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
298 sp Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
299 call setline(1, 'testje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
300 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
301 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
302 au WinLeave Xtestje2 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
303 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
304 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
305 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
306 au WinLeave Xtestje1 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
307 close |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
308 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
309 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
310 " 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
|
311 " will be the ATTENTION prompt. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
312 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
313 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
314 au! BufUnload Xtestje1 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
315 call assert_fails('e Xtestje3', 'E937:') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
316 call assert_equal('Xtestje3', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
317 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
318 e Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
319 sp Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
320 call assert_fails('e', 'E937:') |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
321 call assert_equal('Xtestje1', expand('%')) |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
322 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
323 " 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
|
324 " 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
|
325 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
326 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
327 e Xanother |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
328 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
329 bwipe Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
330 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
331 au BufWipeout Xtestje1 buf Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
332 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
333 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
334 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
335 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
336 help |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
337 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
338 1quit |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
339 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
340 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
341 au! |
11197
7f355d8cd634
patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents:
10575
diff
changeset
|
342 enew |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
343 call delete('Xtestje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
344 call delete('Xtestje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
345 call delete('Xtestje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
346 endfunc |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
347 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
348 func Test_BufEnter() |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
349 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
350 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
|
351 let g:val = '' |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
352 split NewFile |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
353 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
|
354 bwipe! |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
355 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
|
356 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
357 " 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
|
358 call mkdir('Xdir') |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
359 split Xdir |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
360 call assert_equal('+++', g:val) |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
361 |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
362 " On MS-Windows we can't edit the directory, make sure we wipe the right |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
363 " buffer. |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
364 bwipe! Xdir |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
365 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
366 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
|
367 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
368 endfunc |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
369 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
370 " Closing a window might cause an endless loop |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
371 " E814 for older Vims |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
372 func Test_autocmd_bufwipe_in_SessLoadPost() |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
373 edit Xtest |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
374 tabnew |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
375 file Xsomething |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
376 set noswapfile |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
377 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
378 |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
379 let content = ['set nocp noswapfile', |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
380 \ 'let v:swapchoice="e"', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
381 \ 'augroup test_autocmd_sessionload', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
382 \ 'autocmd!', |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
383 \ 'autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"', |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
384 \ 'augroup END', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
385 \ '', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
386 \ 'func WriteErrors()', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
387 \ ' call writefile([execute("messages")], "Xerrors")', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
388 \ 'endfunc', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
389 \ 'au VimLeave * call WriteErrors()', |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
390 \ ] |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
391 call writefile(content, 'Xvimrc') |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
392 call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
393 let errors = join(readfile('Xerrors')) |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
394 call assert_match('E814', errors) |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
395 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
396 set swapfile |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
397 for file in ['Session.vim', 'Xvimrc', 'Xerrors'] |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
398 call delete(file) |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
399 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
400 endfunc |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
401 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
402 " SEGV occurs in older versions. |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
403 func Test_autocmd_bufwipe_in_SessLoadPost2() |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
404 tabnew |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
405 set noswapfile |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
406 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
407 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
408 let content = ['set nocp noswapfile', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
409 \ 'function! DeleteInactiveBufs()', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
410 \ ' tabfirst', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
411 \ ' let tabblist = []', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
412 \ ' for i in range(1, tabpagenr(''$''))', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
413 \ ' call extend(tabblist, tabpagebuflist(i))', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
414 \ ' endfor', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
415 \ ' for b in range(1, bufnr(''$''))', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
416 \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
417 \ ' exec ''bwipeout '' . b', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
418 \ ' endif', |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
419 \ ' endfor', |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
420 \ ' echomsg "SessionLoadPost DONE"', |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
421 \ 'endfunction', |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
422 \ 'au SessionLoadPost * call DeleteInactiveBufs()', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
423 \ '', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
424 \ 'func WriteErrors()', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
425 \ ' call writefile([execute("messages")], "Xerrors")', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
426 \ 'endfunc', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
427 \ 'au VimLeave * call WriteErrors()', |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
428 \ ] |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
429 call writefile(content, 'Xvimrc') |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
430 call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
431 let errors = join(readfile('Xerrors')) |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
432 " This probably only ever matches on unix. |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
433 call assert_notmatch('Caught deadly signal SEGV', errors) |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
434 call assert_match('SessionLoadPost DONE', errors) |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
435 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
436 set swapfile |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
437 for file in ['Session.vim', 'Xvimrc', 'Xerrors'] |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
438 call delete(file) |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
439 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
440 endfunc |
11641
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
441 |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
442 func Test_empty_doau() |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
443 doau \| |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
444 endfunc |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
445 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
446 func s:AutoCommandOptionSet(match) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
447 let item = remove(g:options, 0) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
448 let expected = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", item[0], item[1], item[2], item[3]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
449 let actual = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", a:match, v:option_old, v:option_new, v:option_type) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
450 let g:opt = [expected, actual] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
451 "call assert_equal(expected, actual) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
452 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
453 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
454 func Test_OptionSet() |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
455 if !has("eval") || !has("autocmd") || !exists("+autochdir") |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
456 return |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
457 endif |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
458 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
459 badd test_autocmd.vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
460 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
461 call test_override('starting', 1) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
462 set nocp |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
463 au OptionSet * :call s:AutoCommandOptionSet(expand("<amatch>")) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
464 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
465 " 1: Setting number option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
466 let g:options=[['number', 0, 1, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
467 set nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
468 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
469 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
470 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
471 " 2: Setting local number option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
472 let g:options=[['number', 1, 0, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
473 setlocal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
474 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
475 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
476 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
477 " 3: Setting global number option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
478 let g:options=[['number', 1, 0, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
479 setglobal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
480 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
481 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
482 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
483 " 4: Setting local autoindent option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
484 let g:options=[['autoindent', 0, 1, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
485 setlocal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
486 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
487 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
488 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
489 " 5: Setting global autoindent option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
490 let g:options=[['autoindent', 0, 1, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
491 setglobal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
492 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
493 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
494 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
495 " 6: Setting global autoindent option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
496 let g:options=[['autoindent', 1, 0, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
497 set ai! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
498 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
499 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
500 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
501 " Should not print anything, use :noa |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
502 " 7: don't trigger OptionSet" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
503 let g:options=[['invalid', 1, 1, 'invalid']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
504 noa set nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
505 call assert_equal([['invalid', 1, 1, 'invalid']], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
506 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
507 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
508 " 8: Setting several global list and number option" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
509 let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
510 set list nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
511 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
512 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
513 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
514 " 9: don't trigger OptionSet" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
515 let g:options=[['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
516 noa set nolist nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
517 call assert_equal([['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
518 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
519 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
520 " 10: Setting global acd" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
521 let g:options=[['autochdir', 0, 1, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
522 setlocal acd |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
523 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
524 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
525 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
526 " 11: Setting global autoread (also sets local value)" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
527 let g:options=[['autoread', 0, 1, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
528 set ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
529 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
530 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
531 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
532 " 12: Setting local autoread" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
533 let g:options=[['autoread', 1, 1, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
534 setlocal ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
535 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
536 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
537 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
538 " 13: Setting global autoread" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
539 let g:options=[['autoread', 1, 0, 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
540 setglobal invar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
541 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
542 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
543 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
544 " 14: Setting option backspace through :let" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
545 let g:options=[['backspace', '', 'eol,indent,start', 'global']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
546 let &bs="eol,indent,start" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
547 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
548 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
549 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
550 " 15: Setting option backspace through setbufvar()" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
551 let g:options=[['backup', 0, 1, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
552 " try twice, first time, shouldn't trigger because option name is invalid, |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
553 " second time, it should trigger |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
554 let bnum = bufnr('%') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
555 call assert_fails("call setbufvar(bnum, '&l:bk', 1)", "E355") |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
556 " should trigger, use correct option name |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
557 call setbufvar(bnum, '&backup', 1) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
558 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
559 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
560 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
561 " 16: Setting number option using setwinvar" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
562 let g:options=[['number', 0, 1, 'local']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
563 call setwinvar(0, '&number', 1) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
564 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
565 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
566 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
567 " 17: Setting key option, shouldn't trigger" |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
568 let g:options=[['key', 'invalid', 'invalid1', 'invalid']] |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
569 setlocal key=blah |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
570 setlocal key= |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
571 call assert_equal([['key', 'invalid', 'invalid1', 'invalid']], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
572 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
573 |
12188
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
574 " 18: Setting string option" |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
575 let oldval = &tags |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
576 let g:options=[['tags', oldval, 'tagpath', 'global']] |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
577 set tags=tagpath |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
578 call assert_equal([], g:options) |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
579 call assert_equal(g:opt[0], g:opt[1]) |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
580 |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
581 " 1l: Resetting string option" |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
582 let g:options=[['tags', 'tagpath', oldval, 'global']] |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
583 set tags& |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
584 call assert_equal([], g:options) |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
585 call assert_equal(g:opt[0], g:opt[1]) |
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
586 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
587 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
588 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
589 for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp'] |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
590 exe printf(":set %s&vim", opt) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
591 endfor |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
592 call test_override('starting', 0) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
593 delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
594 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
595 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
596 func Test_OptionSet_diffmode() |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
597 call test_override('starting', 1) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
598 " 18: Changing an option when enetering diff mode |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
599 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
600 au OptionSet diff :let &l:cul=v:option_new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
601 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
602 call setline(1, ['buffer 1', 'line2', 'line3', 'line4']) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
603 call assert_equal(0, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
604 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
605 call assert_equal(1, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
606 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
607 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
608 call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4']) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
609 call assert_equal(0, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
610 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
611 call assert_equal(1, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
612 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
613 diffoff |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
614 call assert_equal(0, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
615 call assert_equal(1, getwinvar(2, '&l:cul')) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
616 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
617 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
618 call assert_equal(1, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
619 diffoff! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
620 call assert_equal(0, &l:cul) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
621 call assert_equal(0, getwinvar(1, '&l:cul')) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
622 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
623 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
624 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
625 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
626 call test_override('starting', 0) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
627 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
628 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
629 func Test_OptionSet_diffmode_close() |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
630 call test_override('starting', 1) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
631 " 19: Try to close the current window when entering diff mode |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
632 " should not segfault |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
633 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
634 au OptionSet diff close |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
635 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
636 call setline(1, ['buffer 1', 'line2', 'line3', 'line4']) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
637 call assert_fails(':diffthis', 'E788') |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
638 call assert_equal(1, &diff) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
639 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
640 call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4']) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
641 call assert_fails(':diffthis', 'E788') |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
642 call assert_equal(1, &diff) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
643 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
644 call assert_fails(':diffoff!', 'E788') |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
645 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
646 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
647 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
648 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
649 call test_override('starting', 0) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
650 "delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
651 endfunc |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
652 |
15207
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
653 func Test_OptionSet_modeline() |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
654 call test_override('starting', 1) |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
655 au! OptionSet |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
656 augroup set_tabstop |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
657 au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")}) |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
658 augroup END |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
659 call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline') |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
660 set modeline |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
661 let v:errmsg = '' |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
662 call assert_fails('split XoptionsetModeline', 'E12:') |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
663 call assert_equal(7, &ts) |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
664 call assert_equal('', v:errmsg) |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
665 |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
666 augroup set_tabstop |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
667 au! |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
668 augroup END |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
669 bwipe! |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
670 set ts& |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
671 call delete('XoptionsetModeline') |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
672 call test_override('starting', 0) |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
673 endfunc |
6ab9c18708c4
patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents:
15184
diff
changeset
|
674 |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
675 " Test for Bufleave autocommand that deletes the buffer we are about to edit. |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
676 func Test_BufleaveWithDelete() |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
677 new | edit Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
678 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
679 augroup test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
680 autocmd! |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
681 autocmd BufLeave Xfile1 bwipe Xfile2 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
682 augroup END |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
683 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
684 call assert_fails('edit Xfile2', 'E143:') |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
685 call assert_equal('Xfile1', bufname('%')) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
686 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
687 autocmd! test_bufleavewithdelete BufLeave Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
688 augroup! test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
689 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
690 new |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
691 bwipe! Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
692 endfunc |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
693 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
694 " Test for autocommand that changes the buffer list, when doing ":ball". |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
695 func Test_Acmd_BufAll() |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
696 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
697 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
698 call writefile(['Test file Xxx1'], 'Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
699 call writefile(['Test file Xxx2'], 'Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
700 call writefile(['Test file Xxx3'], 'Xxx3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
701 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
702 " Add three files to the buffer list |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
703 split Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
704 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
705 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
706 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
707 split Xxx3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
708 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
709 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
710 " Wipe the buffer when the buffer is opened |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
711 au BufReadPost Xxx2 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
712 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
713 call append(0, 'Test file Xxx4') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
714 ball |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
715 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
716 call assert_equal(2, winnr('$')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
717 call assert_equal('Xxx1', bufname(winbufnr(winnr('$')))) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
718 wincmd t |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
719 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
720 au! BufReadPost |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
721 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
722 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
723 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
724 call delete('Xxx3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
725 enew! | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
726 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
727 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
728 " Test for autocommand that changes current buffer on BufEnter event. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
729 " Check if modelines are interpreted for the correct buffer. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
730 func Test_Acmd_BufEnter() |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
731 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
732 call writefile(['start of test file Xxx1', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
733 \ "\<Tab>this is a test", |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
734 \ 'end of test file Xxx1'], 'Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
735 call writefile(['start of test file Xxx2', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
736 \ 'vim: set noai :', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
737 \ "\<Tab>this is a test", |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
738 \ 'end of test file Xxx2'], 'Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
739 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
740 au BufEnter Xxx2 brew |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
741 set ai modeline modelines=3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
742 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
743 " edit Xxx2, autocmd will do :brew |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
744 edit Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
745 exe "normal G?this is a\<CR>" |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
746 " Append text with autoindent to this file |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
747 normal othis should be auto-indented |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
748 call assert_equal("\<Tab>this should be auto-indented", getline('.')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
749 call assert_equal(3, line('.')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
750 " Remove autocmd and edit Xxx2 again |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
751 au! BufEnter Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
752 buf! Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
753 exe "normal G?this is a\<CR>" |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
754 " append text without autoindent to Xxx |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
755 normal othis should be in column 1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
756 call assert_equal("this should be in column 1", getline('.')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
757 call assert_equal(4, line('.')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
758 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
759 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
760 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
761 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
762 set ai&vim modeline&vim modelines&vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
763 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
764 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
765 " Test for issue #57 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
766 " do not move cursor on <c-o> when autoindent is set |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
767 func Test_ai_CTRL_O() |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
768 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
769 set ai |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
770 let save_fo = &fo |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
771 set fo+=r |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
772 exe "normal o# abcdef\<Esc>2hi\<CR>\<C-O>d0\<Esc>" |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
773 exe "normal o# abcdef\<Esc>2hi\<C-O>d0\<Esc>" |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
774 call assert_equal(['# abc', 'def', 'def'], getline(2, 4)) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
775 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
776 set ai&vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
777 let &fo = save_fo |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
778 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
779 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
780 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
781 " Test for autocommand that deletes the current buffer on BufLeave event. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
782 " Also test deleting the last buffer, should give a new, empty buffer. |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
783 func Test_BufLeave_Wipe() |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
784 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
785 let content = ['start of test file Xxx', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
786 \ 'this is a test', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
787 \ 'end of test file Xxx'] |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
788 call writefile(content, 'Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
789 call writefile(content, 'Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
790 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
791 au BufLeave Xxx2 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
792 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
793 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
794 " delete buffer Xxx2, we should be back to Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
795 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
796 call assert_equal('Xxx1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
797 call assert_equal(1, winnr('$')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
798 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
799 " Create an alternate buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
800 %write! test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
801 call assert_equal('test.out', bufname('#')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
802 " delete alternate buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
803 bwipe test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
804 call assert_equal('Xxx1', bufname('%')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
805 call assert_equal('', bufname('#')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
806 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
807 au BufLeave Xxx1 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
808 " delete current buffer, get an empty one |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
809 bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
810 call assert_equal(1, line('$')) |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
811 call assert_equal('', bufname('%')) |
12630
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
812 let g:bufinfo = getbufinfo() |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
813 call assert_equal(1, len(g:bufinfo)) |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
814 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
815 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
816 call delete('Xxx2') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
817 call delete('test.out') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
818 %bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
819 au! BufLeave |
12630
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
820 |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
821 " check that bufinfo doesn't contain a pointer to freed memory |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
822 call test_garbagecollect_now() |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
823 endfunc |
12652
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
824 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
825 func Test_QuitPre() |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
826 edit Xfoo |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
827 let winid = win_getid(winnr()) |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
828 split Xbar |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
829 au! QuitPre * let g:afile = expand('<afile>') |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
830 " Close the other window, <afile> should be correct. |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
831 exe win_id2win(winid) . 'q' |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
832 call assert_equal('Xfoo', g:afile) |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
833 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
834 unlet g:afile |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
835 bwipe Xfoo |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
836 bwipe Xbar |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
837 endfunc |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
838 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
839 func Test_Cmdline() |
13142
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
840 au! CmdlineChanged : let g:text = getcmdline() |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
841 let g:text = 0 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
842 call feedkeys(":echom 'hello'\<CR>", 'xt') |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
843 call assert_equal("echom 'hello'", g:text) |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
844 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
845 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
846 au! CmdlineChanged : let g:entered = expand('<afile>') |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
847 let g:entered = 0 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
848 call feedkeys(":echom 'hello'\<CR>", 'xt') |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
849 call assert_equal(':', g:entered) |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
850 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
851 |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
852 au! CmdlineEnter : let g:entered = expand('<afile>') |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
853 au! CmdlineLeave : let g:left = expand('<afile>') |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
854 let g:entered = 0 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
855 let g:left = 0 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
856 call feedkeys(":echo 'hello'\<CR>", 'xt') |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
857 call assert_equal(':', g:entered) |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
858 call assert_equal(':', g:left) |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
859 au! CmdlineEnter |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
860 au! CmdlineLeave |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
861 |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
862 let save_shellslash = &shellslash |
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
863 set noshellslash |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
864 au! CmdlineEnter / let g:entered = expand('<afile>') |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
865 au! CmdlineLeave / let g:left = expand('<afile>') |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
866 let g:entered = 0 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
867 let g:left = 0 |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
868 new |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
869 call setline(1, 'hello') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
870 call feedkeys("/hello\<CR>", 'xt') |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
871 call assert_equal('/', g:entered) |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
872 call assert_equal('/', g:left) |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
873 bwipe! |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
874 au! CmdlineEnter |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
875 au! CmdlineLeave |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
876 let &shellslash = save_shellslash |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
877 endfunc |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
878 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
879 " Test for BufWritePre autocommand that deletes or unloads the buffer. |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
880 func Test_BufWritePre() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
881 %bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
882 au BufWritePre Xxx1 bunload |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
883 au BufWritePre Xxx2 bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
884 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
885 call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
886 call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
887 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
888 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
889 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
890 bdel Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
891 e Xxx1 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
892 " write it, will unload it and give an error msg |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
893 call assert_fails('w', 'E203') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
894 call assert_equal('Xxx2', bufname('%')) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
895 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
896 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
897 bwipe Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
898 " write it, will delete the buffer and give an error msg |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
899 call assert_fails('w', 'E203') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
900 call assert_equal('Xxx1', bufname('%')) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
901 au! BufWritePre |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
902 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
903 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
904 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
905 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
906 " Test for BufUnload autocommand that unloads all the other buffers |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
907 func Test_bufunload_all() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
908 call writefile(['Test file Xxx1'], 'Xxx1')" |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
909 call writefile(['Test file Xxx2'], 'Xxx2')" |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
910 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
911 let content = [ |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
912 \ "func UnloadAllBufs()", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
913 \ " let i = 1", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
914 \ " while i <= bufnr('$')", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
915 \ " if i != bufnr('%') && bufloaded(i)", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
916 \ " exe i . 'bunload'", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
917 \ " endif", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
918 \ " let i += 1", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
919 \ " endwhile", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
920 \ "endfunc", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
921 \ "au BufUnload * call UnloadAllBufs()", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
922 \ "au VimLeave * call writefile(['Test Finished'], 'Xout')", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
923 \ "edit Xxx1", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
924 \ "split Xxx2", |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
925 \ "q"] |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
926 call writefile(content, 'Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
927 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
928 call delete('Xout') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
929 call system(v:progpath. ' --clean -N --not-a-term -S Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
930 call assert_true(filereadable('Xout')) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
931 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
932 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
933 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
934 call delete('Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
935 call delete('Xout') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
936 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
937 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
938 " Some tests for buffer-local autocommands |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
939 func Test_buflocal_autocmd() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
940 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
941 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
942 au BufLeave <buffer> let g:bname = expand("%") |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
943 " here, autocommand for xx should trigger. |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
944 " but autocommand shall not apply to buffer named <buffer>. |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
945 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
946 call assert_equal('xx', g:bname) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
947 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
948 " here, autocommand shall be auto-deleted |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
949 bwipe xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
950 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
951 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
952 call assert_equal('', g:bname) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
953 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
954 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
955 call assert_equal('', g:bname) |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
956 enew |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
957 unlet g:bname |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
958 endfunc |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
959 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
960 " Test for "*Cmd" autocommands |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
961 func Test_Cmd_Autocmds() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
962 call writefile(['start of Xxx', "\tabc2", 'end of Xxx'], 'Xxx') |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
963 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
964 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
965 au BufReadCmd XtestA 0r Xxx|$del |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
966 edit XtestA " will read text of Xxd instead |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
967 call assert_equal('start of Xxx', getline(1)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
968 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
969 au BufWriteCmd XtestA call append(line("$"), "write") |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
970 write " will append a line to the file |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
971 call assert_equal('write', getline('$')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
972 call assert_fails('read XtestA', 'E484') " should not read anything |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
973 call assert_equal('write', getline(4)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
974 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
975 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
976 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
977 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
978 " 3 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
979 " 4 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
980 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
981 au FileReadCmd XtestB '[r Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
982 2r XtestB " will read Xxx below line 2 instead |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
983 call assert_equal('start of Xxx', getline(3)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
984 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
985 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
986 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
987 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
988 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
989 " 4 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
990 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
991 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
992 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
993 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
994 au FileWriteCmd XtestC '[,']copy $ |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
995 normal 4GA1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
996 4,5w XtestC " will copy lines 4 and 5 to the end |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
997 call assert_equal("\tabc21", getline(8)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
998 call assert_fails('r XtestC', 'E484') " should not read anything |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
999 call assert_equal("end of Xxx", getline(9)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1000 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1001 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1002 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1003 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1004 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1005 " 4 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1006 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1007 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1008 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1009 " 8 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1010 " 9 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1011 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1012 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1013 au FileAppendCmd XtestD call extend(g:lines, getline(line("'["), line("']"))) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1014 w >>XtestD " will add lines to 'lines' |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1015 call assert_equal(9, len(g:lines)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1016 call assert_fails('$r XtestD', 'E484') " should not read anything |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1017 call assert_equal(9, line('$')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1018 call assert_equal('end of Xxx', getline('$')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1019 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1020 au BufReadCmd XtestE 0r Xxx|$del |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1021 sp XtestE " split window with test.out |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1022 call assert_equal('end of Xxx', getline(3)) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1023 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1024 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1025 exe "normal 2Goasdf\<Esc>\<C-W>\<C-W>" |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1026 au BufWriteCmd XtestE call extend(g:lines, getline(0, '$')) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1027 wall " will write other window to 'lines' |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1028 call assert_equal(4, len(g:lines), g:lines) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1029 call assert_equal('asdf', g:lines[2]) |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1030 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1031 au! BufReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1032 au! BufWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1033 au! FileReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1034 au! FileWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1035 au! FileAppendCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1036 %bwipe! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1037 call delete('Xxx') |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1038 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1039 endfunc |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1040 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1041 func SetChangeMarks(start, end) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1042 exe a:start. 'mark [' |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1043 exe a:end. 'mark ]' |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1044 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1045 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1046 " Verify the effects of autocmds on '[ and '] |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1047 func Test_change_mark_in_autocmds() |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1048 edit! Xtest |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1049 call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u", 'xtn') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1050 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1051 call SetChangeMarks(2, 3) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1052 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1053 call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1054 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1055 call SetChangeMarks(2, 3) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1056 au BufWritePre * call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1057 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1058 au! BufWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1059 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1060 if executable('cat') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1061 write XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1062 write >> XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1063 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1064 call SetChangeMarks(2, 3) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1065 " Marks are set to the entire range of the write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1066 au FilterWritePre * call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1067 " '[ is adjusted to just before the line that will receive the filtered |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1068 " data |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1069 au FilterReadPre * call assert_equal([4, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1070 " The filtered data is read into the buffer, and the source lines are |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1071 " still present, so the range is after the source lines |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1072 au FilterReadPost * call assert_equal([5, 12], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1073 %!cat XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1074 " After the filtered data is read, the original lines are deleted |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1075 call assert_equal([1, 8], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1076 au! FilterWritePre,FilterReadPre,FilterReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1077 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1078 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1079 call SetChangeMarks(1, 4) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1080 au FilterWritePre * call assert_equal([2, 3], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1081 au FilterReadPre * call assert_equal([3, 3], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1082 au FilterReadPost * call assert_equal([4, 11], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1083 2,3!cat XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1084 call assert_equal([2, 9], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1085 au! FilterWritePre,FilterReadPre,FilterReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1086 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1087 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1088 call delete('XtestFilter') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1089 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1090 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1091 call SetChangeMarks(1, 4) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1092 au FileWritePre * call assert_equal([2, 3], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1093 2,3write Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1094 au! FileWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1095 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1096 call SetChangeMarks(2, 3) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1097 au FileAppendPre * call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1098 write >> Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1099 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1100 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1101 call SetChangeMarks(1, 4) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1102 au FileAppendPre * call assert_equal([2, 3], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1103 2,3write >> Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1104 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1105 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1106 call SetChangeMarks(1, 1) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1107 au FileReadPre * call assert_equal([3, 1], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1108 au FileReadPost * call assert_equal([4, 11], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1109 3read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1110 au! FileReadPre,FileReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1111 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1112 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1113 call SetChangeMarks(4, 4) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1114 " When the line is 0, it's adjusted to 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1115 au FileReadPre * call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1116 au FileReadPost * call assert_equal([1, 8], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1117 0read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1118 au! FileReadPre,FileReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1119 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1120 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1121 call SetChangeMarks(4, 4) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1122 " When the line is 0, it's adjusted to 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1123 au FileReadPre * call assert_equal([1, 4], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1124 au FileReadPost * call assert_equal([2, 9], [line("'["), line("']")]) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1125 1read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1126 au! FileReadPre,FileReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1127 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1128 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1129 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1130 call delete('Xtest') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1131 call delete('Xtest2') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1132 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1133 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1134 func Test_Filter_noshelltemp() |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1135 if !executable('cat') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1136 return |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1137 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1138 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1139 enew! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1140 call setline(1, ['a', 'b', 'c', 'd']) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1141 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1142 let shelltemp = &shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1143 set shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1144 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1145 let g:filter_au = 0 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1146 au FilterWritePre * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1147 au FilterReadPre * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1148 au FilterReadPost * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1149 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1150 call assert_equal(3, g:filter_au) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1151 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1152 if has('filterpipe') |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1153 set noshelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1154 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1155 let g:filter_au = 0 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1156 au FilterWritePre * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1157 au FilterReadPre * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1158 au FilterReadPost * let g:filter_au += 1 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1159 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1160 call assert_equal(0, g:filter_au) |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1161 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1162 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1163 au! FilterWritePre,FilterReadPre,FilterReadPost |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1164 let &shelltemp = shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1165 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1166 endfunc |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1167 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1168 func Test_TextYankPost() |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1169 enew! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1170 call setline(1, ['foo']) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1171 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1172 let g:event = [] |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1173 au TextYankPost * let g:event = copy(v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1174 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1175 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1176 call assert_fails('let v:event = {}', 'E46:') |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1177 call assert_fails('let v:event.mykey = 0', 'E742:') |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1178 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1179 norm "ayiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1180 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1181 \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v'}, |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1182 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1183 norm y_ |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1184 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1185 \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V'}, |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1186 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1187 call feedkeys("\<C-V>y", 'x') |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1188 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1189 \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161"}, |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1190 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1191 norm "xciwbar |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1192 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1193 \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v'}, |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1194 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1195 norm "bdiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1196 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1197 \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v'}, |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1198 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1199 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1200 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1201 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1202 au! TextYankPost |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1203 unlet g:event |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1204 bwipe! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1205 endfunc |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1206 |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1207 func Test_nocatch_wipe_all_buffers() |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1208 " Real nasty autocommand: wipe all buffers on any event. |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1209 au * * bwipe * |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1210 " Get E93 first? |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1211 " call assert_fails('next x', 'E93:') |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1212 call assert_fails('next x', 'E517:') |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1213 bwipe |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1214 au! |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1215 endfunc |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1216 |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1217 func Test_nocatch_wipe_dummy_buffer() |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1218 " Nasty autocommand: wipe buffer on any event. |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1219 au * x bwipe |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1220 call assert_fails('lv½ /x', 'E480') |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1221 au! |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1222 endfunc |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1223 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1224 function s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1225 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1226 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1227 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1228 let s:li = [] |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1229 let s:dir_this = getcwd() |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1230 let s:dir_foo = s:dir_this . '/foo' |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1231 call mkdir(s:dir_foo) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1232 let s:dir_bar = s:dir_this . '/bar' |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1233 call mkdir(s:dir_bar) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1234 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1235 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1236 function s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1237 exe 'cd' s:dir_this |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1238 call delete(s:dir_foo, 'd') |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1239 call delete(s:dir_bar, 'd') |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1240 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1241 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1242 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1243 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1244 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1245 function Test_dirchanged_global() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1246 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1247 autocmd test_dirchanged DirChanged global call add(s:li, "cd:") |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1248 autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>")) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1249 exe 'cd' s:dir_foo |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1250 call assert_equal(["cd:", s:dir_foo], s:li) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1251 exe 'cd' s:dir_foo |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1252 call assert_equal(["cd:", s:dir_foo], s:li) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1253 exe 'lcd' s:dir_bar |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1254 call assert_equal(["cd:", s:dir_foo], s:li) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1255 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1256 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1257 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1258 function Test_dirchanged_local() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1259 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1260 autocmd test_dirchanged DirChanged window call add(s:li, "lcd:") |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1261 autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>")) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1262 exe 'cd' s:dir_foo |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1263 call assert_equal([], s:li) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1264 exe 'lcd' s:dir_bar |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1265 call assert_equal(["lcd:", s:dir_bar], s:li) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1266 exe 'lcd' s:dir_bar |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1267 call assert_equal(["lcd:", s:dir_bar], s:li) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1268 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1269 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1270 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1271 function Test_dirchanged_auto() |
13178
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1272 if !exists('+autochdir') |
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1273 return |
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1274 endif |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1275 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1276 call test_autochdir() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1277 autocmd test_dirchanged DirChanged auto call add(s:li, "auto:") |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1278 autocmd test_dirchanged DirChanged auto call add(s:li, expand("<afile>")) |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1279 set acd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1280 exe 'cd ..' |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1281 call assert_equal([], s:li) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1282 exe 'edit ' . s:dir_foo . '/Xfile' |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1283 call assert_equal(s:dir_foo, getcwd()) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1284 call assert_equal(["auto:", s:dir_foo], s:li) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1285 set noacd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1286 bwipe! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1287 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1288 endfunc |
13240
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1289 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1290 " Test TextChangedI and TextChangedP |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1291 func Test_ChangedP() |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1292 new |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1293 call setline(1, ['foo', 'bar', 'foobar']) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1294 call test_override("char_avail", 1) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1295 set complete=. completeopt=menuone |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1296 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1297 func! TextChangedAutocmd(char) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1298 let g:autocmd .= a:char |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1299 endfunc |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1300 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1301 au! TextChanged <buffer> :call TextChangedAutocmd('N') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1302 au! TextChangedI <buffer> :call TextChangedAutocmd('I') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1303 au! TextChangedP <buffer> :call TextChangedAutocmd('P') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1304 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1305 call cursor(3, 1) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1306 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1307 call feedkeys("o\<esc>", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1308 call assert_equal('I', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1309 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1310 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1311 call feedkeys("Sf", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1312 call assert_equal('II', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1313 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1314 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1315 call feedkeys("Sf\<C-N>", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1316 call assert_equal('IIP', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1317 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1318 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1319 call feedkeys("Sf\<C-N>\<C-N>", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1320 call assert_equal('IIPP', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1321 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1322 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1323 call feedkeys("Sf\<C-N>\<C-N>\<C-N>", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1324 call assert_equal('IIPPP', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1325 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1326 let g:autocmd = '' |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1327 call feedkeys("Sf\<C-N>\<C-N>\<C-N>\<C-N>", 'tnix') |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1328 call assert_equal('IIPPPP', g:autocmd) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1329 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1330 call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1331 " TODO: how should it handle completeopt=noinsert,noselect? |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1332 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1333 " CleanUp |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1334 call test_override("char_avail", 0) |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1335 au! TextChanged |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1336 au! TextChangedI |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1337 au! TextChangedP |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1338 delfu TextChangedAutocmd |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1339 unlet! g:autocmd |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1340 set complete&vim completeopt&vim |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1341 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1342 bw! |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1343 endfunc |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1344 |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1345 let g:setline_handled = v:false |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15207
diff
changeset
|
1346 func SetLineOne() |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1347 if !g:setline_handled |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1348 call setline(1, "(x)") |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1349 let g:setline_handled = v:true |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1350 endif |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1351 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1352 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1353 func Test_TextChangedI_with_setline() |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1354 new |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1355 call test_override('char_avail', 1) |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1356 autocmd TextChangedI <buffer> call SetLineOne() |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1357 call feedkeys("i(\<CR>\<Esc>", 'tx') |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1358 call assert_equal('(', getline(1)) |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1359 call assert_equal('x)', getline(2)) |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1360 undo |
14485
c71d65c3672f
patch 8.1.0256: using setline() in TextChangedI splits undo
Christian Brabandt <cb@256bit.org>
parents:
14463
diff
changeset
|
1361 call assert_equal('', getline(1)) |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1362 call assert_equal('', getline(2)) |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1363 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1364 call test_override('starting', 0) |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1365 bwipe! |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1366 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1367 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1368 func Test_Changed_FirstTime() |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1369 if !has('terminal') || has('gui_running') |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1370 return |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1371 endif |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1372 " Prepare file for TextChanged event. |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1373 call writefile([''], 'Xchanged.txt') |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1374 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1375 call assert_equal('running', term_getstatus(buf)) |
13559
af68603e213d
patch 8.0.1653: screen dump is made too soon
Christian Brabandt <cb@256bit.org>
parents:
13519
diff
changeset
|
1376 " Wait for the ruler (in the status line) to be shown. |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13752
diff
changeset
|
1377 call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))}) |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1378 " It's only adding autocmd, so that no event occurs. |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1379 call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>") |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1380 call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>") |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13752
diff
changeset
|
1381 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1382 call assert_equal([''], readfile('Xchanged.txt')) |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1383 |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1384 " clean up |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1385 call delete('Xchanged.txt') |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1386 bwipe! |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1387 endfunc |