Mercurial > vim
annotate src/testdir/test_autocmd.vim @ 17849:73ddc462979d v8.1.1921
patch 8.1.1921: more functions can be used as methods
Commit: https://github.com/vim/vim/commit/a4208966fb289a505ebdef62bbc37c214069bab4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 24 20:50:19 2019 +0200
patch 8.1.1921: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Aug 2019 21:00:05 +0200 |
parents | 131f1d8c5860 |
children | 9606c0adc148 |
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 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
4 source check.vim |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
5 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15207
diff
changeset
|
6 func s:cleanup_buffers() abort |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
7 for bnr in range(1, bufnr('$')) |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
8 if bufloaded(bnr) && bufnr('%') != bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
9 execute 'bd! ' . bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
10 endif |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
11 endfor |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
12 endfunc |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
13 |
8738
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 func Test_vim_did_enter() |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_false(v:vim_did_enter) |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 " 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
|
18 " becomes one. |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
20 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
21 if has('timers') |
16646
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
22 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
23 func ExitInsertMode(id) |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
24 call feedkeys("\<Esc>") |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
25 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
26 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
27 func Test_cursorhold_insert() |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
28 " Need to move the cursor. |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
29 call feedkeys("ggG", "xt") |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
30 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
31 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
32 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
33 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
34 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
35 call feedkeys('a', 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
36 call assert_equal(1, g:triggered) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
37 unlet g:triggered |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
38 au! CursorHoldI |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
39 set updatetime& |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
40 endfunc |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
41 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
42 func Test_cursorhold_insert_with_timer_interrupt() |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
43 if !has('job') |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
44 return |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
45 endif |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
46 " Need to move the cursor. |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
47 call feedkeys("ggG", "xt") |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
48 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
49 " Confirm the timer invoked in exit_cb of the job doesn't disturb |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
50 " CursorHoldI event. |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
51 let g:triggered = 0 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
52 au CursorHoldI * let g:triggered += 1 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
53 set updatetime=500 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
54 call job_start(has('win32') ? 'cmd /c echo:' : 'echo', |
15687
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15659
diff
changeset
|
55 \ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}}) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
56 call feedkeys('a', 'x!') |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
57 call assert_equal(1, g:triggered) |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
58 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
59 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
60 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
61 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
62 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
63 func Test_cursorhold_insert_ctrl_x() |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
64 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
65 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
66 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
67 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
68 " 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
|
69 call feedkeys("a\<C-X>", 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
70 call assert_equal(0, g:triggered) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
71 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
72 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
73 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
74 endfunc |
16646
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
75 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
76 func Test_OptionSet_modeline() |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
77 call test_override('starting', 1) |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
78 au! OptionSet |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
79 augroup set_tabstop |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
80 au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")}) |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
81 augroup END |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
82 call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline') |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
83 set modeline |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
84 let v:errmsg = '' |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
85 call assert_fails('split XoptionsetModeline', 'E12:') |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
86 call assert_equal(7, &ts) |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
87 call assert_equal('', v:errmsg) |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
88 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
89 augroup set_tabstop |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
90 au! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
91 augroup END |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
92 bwipe! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
93 set ts& |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
94 call delete('XoptionsetModeline') |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
95 call test_override('starting', 0) |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
96 endfunc |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
97 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
98 endif "has('timers') |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
99 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
100 func Test_bufunload() |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
101 augroup test_bufunload_group |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
102 autocmd! |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 augroup END |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
107 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
108 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
109 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
110 setlocal bufhidden= |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
111 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
112 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
|
113 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
114 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
115 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
116 setlocal bufhidden=delete |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
117 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
118 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
|
119 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
120 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
121 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
122 setlocal bufhidden=unload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
123 bwipeout |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
124 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
|
125 |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
126 au! test_bufunload_group |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
127 augroup! test_bufunload_group |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
128 endfunc |
9450
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
129 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
130 " 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
|
131 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
|
132 tabedit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
133 tabfirst |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
134 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
135 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
|
136 autocmd! |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
137 autocmd BufUnload <buffer> tabnext |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
138 augroup END |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
139 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
140 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
141 call assert_equal(2, tabpagenr('$')) |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
142 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
143 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
|
144 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
|
145 tablast |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
146 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
147 endfunc |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
148 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
149 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
|
150 tabedit |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
151 augroup sample |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
152 autocmd! |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
153 autocmd BufWinLeave <buffer> tabfirst |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
154 augroup END |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
155 call setline(1, ['a', 'b', 'c']) |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
156 edit! a.txt |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
157 tabclose |
10114
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
158 endfunc |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
159 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
160 " 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
|
161 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
|
162 split aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
163 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
164 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
165 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
166 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
167 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
|
168 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
169 |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
170 " 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
|
171 " 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
|
172 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
|
173 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
174 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
175 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
176 bwipe! aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
177 bwipe! bb.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
178 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
179 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
180 " 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
|
181 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
|
182 setlocal buftype=nowrite |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
183 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
184 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
185 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
186 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
187 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
|
188 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
189 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
190 normal! i1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
191 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
|
192 call feedkeys("\<CR>") |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
193 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
194 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
195 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
196 bwipe! a.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
197 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
198 |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
199 func Test_win_tab_autocmd() |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
200 let g:record = [] |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
201 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
202 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
211 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
212 split |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
213 tabnew |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
214 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
215 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
216 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
217 call assert_equal([ |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
218 \ 'WinLeave', 'WinNew', 'WinEnter', |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
219 \ '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
|
220 \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter', |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
221 \ 'WinLeave', 'WinEnter' |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
222 \ ], g:record) |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
223 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
224 let g:record = [] |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
225 tabnew somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
226 tabnext |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
227 bwipe somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
228 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
229 call assert_equal([ |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
230 \ '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
|
231 \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', |
9599
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
232 \ 'TabClosed' |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
233 \ ], g:record) |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
234 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
235 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
236 au! |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
237 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
238 unlet g:record |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
239 endfunc |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
240 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
241 func s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
242 augroup vimBarTest |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
243 au BufReadCmd * echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
244 augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
245 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
|
246 endfunc |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
247 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
248 func Test_early_bar() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
249 " 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
|
250 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
251 augroup vimBarTest | au! | augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
252 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
|
253 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
254 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
255 augroup vimBarTest| au!| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
256 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
|
257 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
258 " 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
|
259 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
260 augroup vimBarTest| au!BufReadCmd| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
261 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
|
262 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
263 " 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
|
264 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
265 au! vimBarTest|echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
266 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
|
267 endfunc |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
268 |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
269 func RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
270 autocmd! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
271 augroup! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
272 endfunc |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
273 |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
274 func Test_augroup_warning() |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
275 augroup TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
276 au VimEnter * echo 'entering' |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
277 augroup END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
278 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
|
279 redir => res |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
280 augroup! TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
281 redir END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
282 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
|
283 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
|
284 |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
285 " 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
|
286 augroup Another |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
287 augroup END |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
288 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
|
289 augroup! Another |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
290 |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
291 " no warning for postpone aucmd delete |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
292 augroup StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
293 au VimEnter * call RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
294 augroup END |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
295 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
|
296 redir => res |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
297 doautocmd VimEnter |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
298 redir END |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
299 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
|
300 au! VimEnter |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
301 endfunc |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
302 |
12680
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
303 func Test_BufReadCmdHelp() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
304 " 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
|
305 au BufReadCmd * e +h |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
306 help |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
307 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
308 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
309 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
310 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
311 func Test_BufReadCmdHelpJump() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
312 " 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
|
313 au BufReadCmd * e +h{ |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
314 " } to fix highlighting |
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
315 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
|
316 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
317 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
318 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
319 |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
320 func Test_augroup_deleted() |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
321 " 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
|
322 augroup x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
323 call assert_fails('augroup! x', 'E936:') |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
324 au VimEnter * echo |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
325 augroup end |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
326 augroup! x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
327 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
|
328 au! VimEnter |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
329 endfunc |
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
330 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
331 " Tests for autocommands on :close command. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
332 " This used to be in test13. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
333 func Test_three_windows() |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
334 " 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
|
335 call s:cleanup_buffers() |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
336 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
337 " 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
|
338 " 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
|
339 " Do this twice, writing the file. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
340 e! Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
341 call setline(1, 'testje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
342 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
343 sp Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
344 call setline(1, 'testje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
345 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
346 sp Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
347 call setline(1, 'testje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
348 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
349 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
350 au WinLeave Xtestje2 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
351 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
352 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
353 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
354 au WinLeave Xtestje1 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
355 close |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
356 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
357 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
358 " 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
|
359 " will be the ATTENTION prompt. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
360 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
361 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
362 au! BufUnload Xtestje1 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
363 call assert_fails('e Xtestje3', 'E937:') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
364 call assert_equal('Xtestje3', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
365 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
366 e Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
367 sp Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
368 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
|
369 call assert_equal('Xtestje1', expand('%')) |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
370 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
371 " 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
|
372 " 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
|
373 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
374 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
375 e Xanother |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
376 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
377 bwipe Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
378 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
379 au BufWipeout Xtestje1 buf Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
380 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
381 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
382 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
383 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
384 help |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
385 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
386 1quit |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
387 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
388 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
389 au! |
11197
7f355d8cd634
patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents:
10575
diff
changeset
|
390 enew |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
391 call delete('Xtestje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
392 call delete('Xtestje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
393 call delete('Xtestje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
394 endfunc |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
395 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
396 func Test_BufEnter() |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
397 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
398 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
|
399 let g:val = '' |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
400 split NewFile |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
401 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
|
402 bwipe! |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
403 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
|
404 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
405 " 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
|
406 call mkdir('Xdir') |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
407 split Xdir |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
408 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
|
409 |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
410 " 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
|
411 " buffer. |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
412 bwipe! Xdir |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
413 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
414 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
|
415 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
416 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
|
417 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
418 " 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
|
419 " 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
|
420 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
|
421 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
|
422 tabnew |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
423 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
|
424 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
|
425 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
426 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
427 let content =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
428 set nocp noswapfile |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
429 let v:swapchoice="e" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
430 augroup test_autocmd_sessionload |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
431 autocmd! |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
432 autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
433 augroup END |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
434 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
435 func WriteErrors() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
436 call writefile([execute("messages")], "Xerrors") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
437 endfunc |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
438 au VimLeave * call WriteErrors() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
439 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
440 |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
441 call writefile(content, 'Xvimrc') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
442 call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
443 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
|
444 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
|
445 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
446 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
|
447 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
|
448 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
|
449 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
450 endfunc |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
451 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
452 " 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
|
453 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
|
454 tabnew |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
455 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
|
456 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
457 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
458 let content =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
459 set nocp noswapfile |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
460 function! DeleteInactiveBufs() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
461 tabfirst |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
462 let tabblist = [] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
463 for i in range(1, tabpagenr(''$'')) |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
464 call extend(tabblist, tabpagebuflist(i)) |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
465 endfor |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
466 for b in range(1, bufnr(''$'')) |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
467 if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'') |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
468 exec ''bwipeout '' . b |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
469 endif |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
470 endfor |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
471 echomsg "SessionLoadPost DONE" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
472 endfunction |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
473 au SessionLoadPost * call DeleteInactiveBufs() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
474 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
475 func WriteErrors() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
476 call writefile([execute("messages")], "Xerrors") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
477 endfunc |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
478 au VimLeave * call WriteErrors() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
479 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
480 |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
481 call writefile(content, 'Xvimrc') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
482 call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
483 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
|
484 " 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
|
485 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
|
486 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
|
487 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
488 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
|
489 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
|
490 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
|
491 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
492 endfunc |
11641
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
493 |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
494 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
|
495 doau \| |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
496 endfunc |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
497 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
498 func s:AutoCommandOptionSet(match) |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
499 let template = "Option: <%s>, OldVal: <%s>, OldValLocal: <%s>, OldValGlobal: <%s>, NewVal: <%s>, Scope: <%s>, Command: <%s>\n" |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
500 let item = remove(g:options, 0) |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
501 let expected = printf(template, item[0], item[1], item[2], item[3], item[4], item[5], item[6]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
502 let actual = printf(template, a:match, v:option_old, v:option_oldlocal, v:option_oldglobal, v:option_new, v:option_type, v:option_command) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
503 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
|
504 "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
|
505 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
506 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
507 func Test_OptionSet() |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
508 if !has("eval") || !exists("+autochdir") |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
509 return |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
510 endif |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
511 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
512 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
|
513 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
514 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
|
515 set nocp |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
516 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
|
517 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
518 " 1: Setting number option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
519 let g:options=[['number', 0, 0, 0, 1, 'global', 'set']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
520 set nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
521 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
|
522 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
|
523 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
524 " 2: Setting local number option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
525 let g:options=[['number', 1, 1, '', 0, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
526 setlocal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
527 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
|
528 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
|
529 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
530 " 3: Setting global number option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
531 let g:options=[['number', 1, '', 1, 0, 'global', 'setglobal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
532 setglobal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
533 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
|
534 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
|
535 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
536 " 4: Setting local autoindent option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
537 let g:options=[['autoindent', 0, 0, '', 1, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
538 setlocal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
539 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
|
540 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
|
541 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
542 " 5: Setting global autoindent option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
543 let g:options=[['autoindent', 0, '', 0, 1, 'global', 'setglobal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
544 setglobal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
545 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
|
546 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
|
547 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
548 " 6: Setting global autoindent option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
549 let g:options=[['autoindent', 1, 1, 1, 0, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
550 set ai! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
551 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
552 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
553 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
554 " 6a: Setting global autoindent option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
555 let g:options=[['autoindent', 1, 1, 0, 0, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
556 noa setlocal ai |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
557 noa setglobal noai |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
558 set ai! |
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:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
560 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
|
561 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
562 " 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
|
563 " 7: don't trigger OptionSet" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
564 let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
565 noa set nonu |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
566 call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
567 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
|
568 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
569 " 8: Setting several global list and number option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
570 let g:options=[['list', 0, 0, 0, 1, 'global', 'set'], ['number', 0, 0, 0, 1, 'global', 'set']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
571 set list nu |
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:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
573 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
|
574 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
575 " 9: don't trigger OptionSet" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
576 let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
577 noa set nolist nonu |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
578 call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
579 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
|
580 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
581 " 10: Setting global acd" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
582 let g:options=[['autochdir', 0, 0, '', 1, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
583 setlocal acd |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
584 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
|
585 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
|
586 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
587 " 11: Setting global autoread (also sets local value)" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
588 let g:options=[['autoread', 0, 0, 0, 1, 'global', 'set']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
589 set ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
590 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
|
591 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
|
592 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
593 " 12: Setting local autoread" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
594 let g:options=[['autoread', 1, 1, '', 1, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
595 setlocal ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
596 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
|
597 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
|
598 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
599 " 13: Setting global autoread" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
600 let g:options=[['autoread', 1, '', 1, 0, 'global', 'setglobal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
601 setglobal invar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
602 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
|
603 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
|
604 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
605 " 14: Setting option backspace through :let" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
606 let g:options=[['backspace', '', '', '', 'eol,indent,start', 'global', 'set']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
611 " 15: Setting option backspace through setbufvar()" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
612 let g:options=[['backup', 0, 0, '', 1, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
613 " 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
|
614 " 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
|
615 let bnum = bufnr('%') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
616 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
|
617 " 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
|
618 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
|
619 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
|
620 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
|
621 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
622 " 16: Setting number option using setwinvar" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
623 let g:options=[['number', 0, 0, '', 1, 'local', 'setlocal']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
624 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
|
625 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
|
626 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
|
627 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
628 " 17: Setting key option, shouldn't trigger" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
629 let g:options=[['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']] |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
630 setlocal key=blah |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
631 setlocal key= |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
632 call assert_equal([['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
633 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
634 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
635 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
636 " 18a: Setting string global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
637 let oldval = &backupext |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
638 let g:options=[['backupext', oldval, oldval, oldval, 'foo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
639 set backupext=foo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
640 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
641 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
642 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
643 " 18b: Resetting string global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
644 let g:options=[['backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
645 set backupext& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
646 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
647 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
648 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
649 " 18c: Setting global string global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
650 let g:options=[['backupext', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
651 setglobal backupext=bar |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
652 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
653 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
654 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
655 " 18d: Setting local string global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
656 " As this is a global option this sets the global value even though |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
657 " :setlocal is used! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
658 noa set backupext& " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
659 let g:options=[['backupext', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
660 setlocal backupext=baz |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
661 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
662 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
663 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
664 " 18e: Setting again string global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
665 noa setglobal backupext=ext_global " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
666 noa setlocal backupext=ext_local " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
667 let g:options=[['backupext', 'ext_local', 'ext_local', 'ext_local', 'fuu', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
668 set backupext=fuu |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
669 call assert_equal([], g:options) |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
670 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
|
671 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
672 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
673 " 19a: Setting string local-global (to buffer) option" |
12188
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
674 let oldval = &tags |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
675 let g:options=[['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
676 set tags=tagpath |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
677 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
678 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
679 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
680 " 19b: Resetting string local-global (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
681 let g:options=[['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
682 set tags& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
683 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
684 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
685 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
686 " 19c: Setting global string local-global (to buffer) option " |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
687 let g:options=[['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
688 setglobal tags=tagpath1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
689 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
690 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
691 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
692 " 19d: Setting local string local-global (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
693 let g:options=[['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
694 setlocal tags=tagpath2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
695 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
696 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
697 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
698 " 19e: Setting again string local-global (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
699 " Note: v:option_old is the old global value for local-global string options |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
700 " but the old local value for all other kinds of options. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
701 noa setglobal tags=tag_global " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
702 noa setlocal tags=tag_local |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
703 let g:options=[['tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
704 set tags=tagpath |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
705 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
706 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
707 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
708 " 19f: Setting string local-global (to buffer) option to an empty string" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
709 " Note: v:option_old is the old global value for local-global string options |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
710 " but the old local value for all other kinds of options. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
711 noa set tags=tag_global " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
712 noa setlocal tags= " empty string |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
713 let g:options=[['tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set']] |
12188
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
714 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
|
715 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
|
716 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
|
717 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
718 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
719 " 20a: Setting string local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
720 let oldval = &spelllang |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
721 let g:options=[['spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
722 set spelllang=elvish,klingon |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
723 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
724 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
725 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
726 " 20b: Resetting string local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
727 let g:options=[['spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
728 set spelllang& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
729 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
730 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
731 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
732 " 20c: Setting global string local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
733 let g:options=[['spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
734 setglobal spelllang=elvish |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
735 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
736 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
737 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
738 " 20d: Setting local string local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
739 noa set spelllang& " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
740 let g:options=[['spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
741 setlocal spelllang=klingon |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
742 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
743 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
744 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
745 " 20e: Setting again string local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
746 " Note: v:option_old is the old global value for local-global string options |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
747 " but the old local value for all other kinds of options. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
748 noa setglobal spelllang=spellglobal " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
749 noa setlocal spelllang=spelllocal |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
750 let g:options=[['spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
751 set spelllang=foo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
752 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
753 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
754 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
755 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
756 " 21a: Setting string local-global (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
757 let oldval = &statusline |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
758 let g:options=[['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
759 set statusline=foo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
760 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
761 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
762 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
763 " 21b: Resetting string local-global (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
764 " Note: v:option_old is the old global value for local-global string options |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
765 " but the old local value for all other kinds of options. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
766 let g:options=[['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
767 set statusline& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
768 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
769 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
770 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
771 " 21c: Setting global string local-global (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
772 let g:options=[['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
773 setglobal statusline=bar |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
774 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
775 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
776 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
777 " 21d: Setting local string local-global (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
778 noa set statusline& " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
779 let g:options=[['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
780 setlocal statusline=baz |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
781 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
782 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
783 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
784 " 21e: Setting again string local-global (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
785 " Note: v:option_old is the old global value for local-global string options |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
786 " but the old local value for all other kinds of options. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
787 noa setglobal statusline=bar " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
788 noa setlocal statusline=baz |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
789 let g:options=[['statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
790 set statusline=foo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
791 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
792 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
793 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
794 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
795 " 22a: Setting string local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
796 let oldval = &foldignore |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
797 let g:options=[['foldignore', oldval, oldval, oldval, 'fo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
798 set foldignore=fo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
799 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
800 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
801 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
802 " 22b: Resetting string local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
803 let g:options=[['foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
804 set foldignore& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
805 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
806 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
807 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
808 " 22c: Setting global string local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
809 let g:options=[['foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
810 setglobal foldignore=bar |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
811 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
812 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
813 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
814 " 22d: Setting local string local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
815 noa set foldignore& " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
816 let g:options=[['foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
817 setlocal foldignore=baz |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
818 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
819 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
820 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
821 " 22e: Setting again string local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
822 noa setglobal foldignore=glob " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
823 noa setlocal foldignore=loc |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
824 let g:options=[['foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
825 set foldignore=fo |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
826 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
827 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
828 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
829 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
830 " 23a: Setting global number local option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
831 noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
832 noa setlocal cmdheight=1 " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
833 let g:options=[['cmdheight', '1', '', '1', '2', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
834 setglobal cmdheight=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
835 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
836 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
837 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
838 " 23b: Setting local number global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
839 noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
840 noa setlocal cmdheight=1 " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
841 let g:options=[['cmdheight', '1', '1', '', '2', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
842 setlocal cmdheight=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
843 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
844 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
845 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
846 " 23c: Setting again number global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
847 noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
848 noa setlocal cmdheight=1 " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
849 let g:options=[['cmdheight', '1', '1', '1', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
850 set cmdheight=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
851 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
852 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
853 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
854 " 23d: Setting again number global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
855 noa set cmdheight=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
856 let g:options=[['cmdheight', '8', '8', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
857 set cmdheight=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
858 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
859 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
860 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
861 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
862 " 24a: Setting global number global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
863 noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
864 noa setlocal undolevels=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
865 let g:options=[['undolevels', '8', '', '8', '2', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
866 setglobal undolevels=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
867 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
868 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
869 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
870 " 24b: Setting local number global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
871 noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
872 noa setlocal undolevels=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
873 let g:options=[['undolevels', '1', '1', '', '2', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
874 setlocal undolevels=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
875 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
876 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
877 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
878 " 24c: Setting again number global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
879 noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
880 noa setlocal undolevels=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
881 let g:options=[['undolevels', '1', '1', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
882 set undolevels=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
883 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
884 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
885 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
886 " 24d: Setting again global number global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
887 noa set undolevels=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
888 let g:options=[['undolevels', '8', '8', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
889 set undolevels=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
890 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
891 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
892 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
893 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
894 " 25a: Setting global number local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
895 noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
896 noa setlocal wrapmargin=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
897 let g:options=[['wrapmargin', '8', '', '8', '2', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
898 setglobal wrapmargin=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
899 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
900 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
901 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
902 " 25b: Setting local number local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
903 noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
904 noa setlocal wrapmargin=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
905 let g:options=[['wrapmargin', '1', '1', '', '2', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
906 setlocal wrapmargin=2 |
12188
d2e367d9de1f
patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents:
11961
diff
changeset
|
907 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
|
908 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
|
909 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
910 " 25c: Setting again number local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
911 noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
912 noa setlocal wrapmargin=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
913 let g:options=[['wrapmargin', '1', '1', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
914 set wrapmargin=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
915 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
916 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
917 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
918 " 25d: Setting again global number local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
919 noa set wrapmargin=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
920 let g:options=[['wrapmargin', '8', '8', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
921 set wrapmargin=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
922 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
923 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
924 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
925 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
926 " 26: Setting number global-local (to window) option. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
927 " Such option does currently not exist. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
928 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
929 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
930 " 27a: Setting global number local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
931 noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
932 noa setlocal foldcolumn=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
933 let g:options=[['foldcolumn', '8', '', '8', '2', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
934 setglobal foldcolumn=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
935 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
936 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
937 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
938 " 27b: Setting local number local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
939 noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
940 noa setlocal foldcolumn=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
941 let g:options=[['foldcolumn', '1', '1', '', '2', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
942 setlocal foldcolumn=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
943 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
944 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
945 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
946 " 27c: Setting again number local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
947 noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
948 noa setlocal foldcolumn=1 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
949 let g:options=[['foldcolumn', '1', '1', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
950 set foldcolumn=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
951 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
952 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
953 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
954 " 27d: Ssettin again global number local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
955 noa set foldcolumn=8 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
956 let g:options=[['foldcolumn', '8', '8', '8', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
957 set foldcolumn=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
958 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
959 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
960 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
961 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
962 " 28a: Setting global boolean global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
963 noa setglobal nowrapscan " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
964 noa setlocal wrapscan " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
965 let g:options=[['wrapscan', '1', '', '1', '0', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
966 setglobal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
967 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
968 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
969 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
970 " 28b: Setting local boolean global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
971 noa setglobal nowrapscan " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
972 noa setlocal wrapscan " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
973 let g:options=[['wrapscan', '1', '1', '', '0', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
974 setlocal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
975 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
976 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
977 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
978 " 28c: Setting again boolean global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
979 noa setglobal nowrapscan " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
980 noa setlocal wrapscan " Sets the global(!) value! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
981 let g:options=[['wrapscan', '1', '1', '1', '0', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
982 set nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
983 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
984 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
985 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
986 " 28d: Setting again global boolean global option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
987 noa set nowrapscan " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
988 let g:options=[['wrapscan', '0', '0', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
989 set wrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
990 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
991 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
992 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
993 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
994 " 29a: Setting global boolean global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
995 noa setglobal noautoread " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
996 noa setlocal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
997 let g:options=[['autoread', '0', '', '0', '1', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
998 setglobal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
999 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1000 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1001 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1002 " 29b: Setting local boolean global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1003 noa setglobal noautoread " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1004 noa setlocal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1005 let g:options=[['autoread', '1', '1', '', '0', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1006 setlocal noautoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1007 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1008 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1009 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1010 " 29c: Setting again boolean global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1011 noa setglobal noautoread " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1012 noa setlocal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1013 let g:options=[['autoread', '1', '1', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1014 set autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1015 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1016 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1017 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1018 " 29d: Setting again global boolean global-local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1019 noa set noautoread " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1020 let g:options=[['autoread', '0', '0', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1021 set autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1022 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1023 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1024 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1025 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1026 " 30a: Setting global boolean local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1027 noa setglobal nocindent " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1028 noa setlocal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1029 let g:options=[['cindent', '0', '', '0', '1', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1030 setglobal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1031 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1032 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1033 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1034 " 30b: Setting local boolean local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1035 noa setglobal nocindent " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1036 noa setlocal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1037 let g:options=[['cindent', '1', '1', '', '0', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1038 setlocal nocindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1039 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1040 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1041 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1042 " 30c: Setting again boolean local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1043 noa setglobal nocindent " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1044 noa setlocal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1045 let g:options=[['cindent', '1', '1', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1046 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1047 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1048 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1049 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1050 " 30d: Setting again global boolean local (to buffer) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1051 noa set nocindent " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1052 let g:options=[['cindent', '0', '0', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1053 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1054 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1055 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1056 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1057 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1058 " 31: Setting boolean global-local (to window) option |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1059 " Currently no such option exists. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1060 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1061 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1062 " 32a: Setting global boolean local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1063 noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1064 noa setlocal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1065 let g:options=[['cursorcolumn', '0', '', '0', '1', 'global', 'setglobal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1066 setglobal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1067 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1068 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1069 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1070 " 32b: Setting local boolean local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1071 noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1072 noa setlocal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1073 let g:options=[['cursorcolumn', '1', '1', '', '0', 'local', 'setlocal']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1074 setlocal nocursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1075 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1076 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1077 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1078 " 32c: Setting again boolean local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1079 noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1080 noa setlocal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1081 let g:options=[['cursorcolumn', '1', '1', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1082 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1083 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1084 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1085 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1086 " 32d: Setting again global boolean local (to window) option" |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1087 noa set nocursorcolumn " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1088 let g:options=[['cursorcolumn', '0', '0', '0', '1', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1089 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1090 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1091 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1092 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1093 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1094 " 33: Test autocomands when an option value is converted internally. |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1095 noa set backspace=1 " Reset global and local value (without triggering autocmd) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1096 let g:options=[['backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set']] |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1097 set backspace=2 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1098 call assert_equal([], g:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1099 call assert_equal(g:opt[0], g:opt[1]) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1100 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1101 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1102 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1103 au! OptionSet |
17093
5cda6165a5c1
patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents:
17085
diff
changeset
|
1104 " set tags& |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1105 for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp', 'backupext', 'tags', 'spelllang', 'statusline', 'foldignore', 'cmdheight', 'undolevels', 'wrapmargin', 'foldcolumn', 'wrapscan', 'autoread', 'cindent', 'cursorcolumn'] |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1106 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
|
1107 endfor |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1108 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
|
1109 delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1110 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1111 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1112 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
|
1113 call test_override('starting', 1) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
1114 " 18: Changing an option when entering diff mode |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1115 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1116 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
|
1117 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1118 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
|
1119 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
|
1120 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1121 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
|
1122 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1123 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1124 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
|
1125 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
|
1126 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1127 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
|
1128 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1129 diffoff |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1130 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
|
1131 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
|
1132 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1133 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1134 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
|
1135 diffoff! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1136 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
|
1137 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
|
1138 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1139 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1140 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1141 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1142 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
|
1143 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1144 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1145 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
|
1146 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
|
1147 " 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
|
1148 " should not segfault |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1149 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1150 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
|
1151 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1152 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
|
1153 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
|
1154 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
|
1155 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1156 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
|
1157 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
|
1158 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
|
1159 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1160 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
|
1161 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1162 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1163 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1164 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1165 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
|
1166 "delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1167 endfunc |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1168 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1169 " 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
|
1170 func Test_BufleaveWithDelete() |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1171 new | edit Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1172 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1173 augroup test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1174 autocmd! |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1175 autocmd BufLeave Xfile1 bwipe Xfile2 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1176 augroup END |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1177 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1178 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
|
1179 call assert_equal('Xfile1', bufname('%')) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1180 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1181 autocmd! test_bufleavewithdelete BufLeave Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1182 augroup! test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1183 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1184 new |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1185 bwipe! Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1186 endfunc |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1187 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1188 " 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
|
1189 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
|
1190 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1191 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1192 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
|
1193 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
|
1194 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
|
1195 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1196 " 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
|
1197 split Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1198 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1199 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1200 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1201 split Xxx3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1202 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1203 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1204 " 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
|
1205 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
|
1206 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1207 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
|
1208 ball |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1209 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1210 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
|
1211 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
|
1212 wincmd t |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1213 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1214 au! BufReadPost |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1215 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1216 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1217 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1218 call delete('Xxx3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1219 enew! | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1220 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1221 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1222 " 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
|
1223 " 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
|
1224 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
|
1225 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1226 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
|
1227 \ "\<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
|
1228 \ '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
|
1229 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
|
1230 \ 'vim: set noai :', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1231 \ "\<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
|
1232 \ '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
|
1233 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1234 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
|
1235 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
|
1236 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1237 " 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
|
1238 edit Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1239 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
|
1240 " 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
|
1241 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
|
1242 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
|
1243 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
|
1244 " 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
|
1245 au! BufEnter Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1246 buf! Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1247 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
|
1248 " 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
|
1249 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
|
1250 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
|
1251 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
|
1252 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1253 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1254 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1255 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1256 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
|
1257 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1258 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1259 " 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
|
1260 " 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
|
1261 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
|
1262 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1263 set ai |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1264 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
|
1265 set fo+=r |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1266 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
|
1267 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
|
1268 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
|
1269 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1270 set ai&vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1271 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
|
1272 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1273 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1274 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1275 " 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
|
1276 " 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
|
1277 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
|
1278 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1279 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
|
1280 \ '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
|
1281 \ '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
|
1282 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
|
1283 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
|
1284 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1285 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
|
1286 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1287 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1288 " 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
|
1289 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1290 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
|
1291 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
|
1292 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1293 " 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
|
1294 %write! test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1295 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
|
1296 " delete alternate buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1297 bwipe test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1298 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
|
1299 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
|
1300 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1301 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
|
1302 " 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
|
1303 bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1304 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
|
1305 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
|
1306 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
|
1307 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
|
1308 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1309 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1310 call delete('Xxx2') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1311 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
|
1312 %bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1313 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
|
1314 |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
1315 " 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
|
1316 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
|
1317 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
|
1318 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1319 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
|
1320 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
|
1321 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
|
1322 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
|
1323 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
|
1324 " 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
|
1325 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
|
1326 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
|
1327 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1328 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
|
1329 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
|
1330 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
|
1331 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
|
1332 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
1333 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
|
1334 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
|
1335 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
|
1336 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
|
1337 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
|
1338 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1339 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1340 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
|
1341 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
|
1342 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
|
1343 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
|
1344 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1345 |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
1346 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
|
1347 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
|
1348 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
|
1349 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
|
1350 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
|
1351 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
|
1352 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
|
1353 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
|
1354 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
|
1355 |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1356 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
|
1357 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
|
1358 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
|
1359 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
|
1360 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
|
1361 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
|
1362 new |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1363 call setline(1, 'hello') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1364 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
|
1365 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
|
1366 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
|
1367 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
|
1368 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
|
1369 au! CmdlineLeave |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1370 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
|
1371 endfunc |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1372 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1373 " 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
|
1374 func Test_BufWritePre() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1375 %bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1376 au BufWritePre Xxx1 bunload |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1377 au BufWritePre Xxx2 bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1378 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1379 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
|
1380 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
|
1381 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1382 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1383 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1384 bdel Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1385 e Xxx1 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1386 " 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
|
1387 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
|
1388 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
|
1389 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1390 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1391 bwipe Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1392 " 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
|
1393 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
|
1394 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
|
1395 au! BufWritePre |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1396 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1397 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1398 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1399 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1400 " 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
|
1401 func Test_bufunload_all() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1402 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
|
1403 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
|
1404 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1405 let content =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1406 func UnloadAllBufs() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1407 let i = 1 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1408 while i <= bufnr('$') |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1409 if i != bufnr('%') && bufloaded(i) |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1410 exe i . 'bunload' |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1411 endif |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1412 let i += 1 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1413 endwhile |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1414 endfunc |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1415 au BufUnload * call UnloadAllBufs() |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1416 au VimLeave * call writefile(['Test Finished'], 'Xout') |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1417 edit Xxx1 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1418 split Xxx2 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1419 q |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1420 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1421 |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1422 call writefile(content, 'Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1423 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1424 call delete('Xout') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1425 call system(GetVimCommandClean() .. ' -N --not-a-term -S Xtest') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1426 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
|
1427 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1428 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1429 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1430 call delete('Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1431 call delete('Xout') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1432 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1433 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1434 " 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
|
1435 func Test_buflocal_autocmd() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1436 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1437 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1438 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
|
1439 " 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
|
1440 " 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
|
1441 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1442 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
|
1443 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1444 " 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
|
1445 bwipe xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1446 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1447 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1448 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
|
1449 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1450 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1451 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
|
1452 enew |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1453 unlet g:bname |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1454 endfunc |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1455 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1456 " Test for "*Cmd" autocommands |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1457 func Test_Cmd_Autocmds() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1458 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
|
1459 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1460 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1461 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
|
1462 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
|
1463 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
|
1464 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1465 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
|
1466 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
|
1467 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
|
1468 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
|
1469 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
|
1470 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1471 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1472 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1473 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1474 " 3 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1475 " 4 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1476 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1477 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
|
1478 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
|
1479 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
|
1480 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1481 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1482 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1483 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1484 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1485 " 4 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1486 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1487 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1488 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1489 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1490 au FileWriteCmd XtestC '[,']copy $ |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1491 normal 4GA1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1492 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
|
1493 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
|
1494 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
|
1495 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
|
1496 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1497 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1498 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1499 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1500 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1501 " 4 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1502 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1503 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1504 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1505 " 8 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1506 " 9 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1507 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1508 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1509 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
|
1510 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
|
1511 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
|
1512 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
|
1513 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
|
1514 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
|
1515 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1516 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
|
1517 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
|
1518 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
|
1519 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1520 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1521 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
|
1522 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
|
1523 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
|
1524 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
|
1525 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
|
1526 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1527 au! BufReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1528 au! BufWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1529 au! FileReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1530 au! FileWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1531 au! FileAppendCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1532 %bwipe! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1533 call delete('Xxx') |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1534 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1535 endfunc |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1536 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1537 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
|
1538 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
|
1539 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
|
1540 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1541 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1542 " 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
|
1543 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
|
1544 edit! Xtest |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1545 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
|
1546 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1547 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
|
1548 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1549 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
|
1550 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1551 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
|
1552 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
|
1553 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1554 au! BufWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1555 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1556 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
|
1557 write XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1558 write >> XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1559 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1560 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
|
1561 " 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
|
1562 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
|
1563 " '[ 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
|
1564 " data |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1565 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
|
1566 " 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
|
1567 " 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
|
1568 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
|
1569 %!cat XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1570 " 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
|
1571 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
|
1572 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
|
1573 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1574 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1575 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
|
1576 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
|
1577 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
|
1578 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
|
1579 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
|
1580 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
|
1581 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
|
1582 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1583 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1584 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
|
1585 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1586 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1587 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
|
1588 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
|
1589 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
|
1590 au! FileWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1591 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1592 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
|
1593 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
|
1594 write >> Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1595 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1596 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1597 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
|
1598 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
|
1599 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
|
1600 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1601 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1602 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
|
1603 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
|
1604 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
|
1605 3read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1606 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
|
1607 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1608 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1609 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
|
1610 " 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
|
1611 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
|
1612 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
|
1613 0read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1614 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
|
1615 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1616 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1617 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
|
1618 " 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
|
1619 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
|
1620 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
|
1621 1read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1622 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
|
1623 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1624 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1625 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1626 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
|
1627 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
|
1628 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1629 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1630 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
|
1631 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
|
1632 return |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1633 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1634 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1635 enew! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1636 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
|
1637 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1638 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
|
1639 set shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1640 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1641 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
|
1642 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
|
1643 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
|
1644 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
|
1645 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1646 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
|
1647 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1648 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
|
1649 set noshelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1650 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1651 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
|
1652 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
|
1653 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
|
1654 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
|
1655 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1656 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
|
1657 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1658 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1659 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
|
1660 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
|
1661 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1662 endfunc |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1663 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1664 func Test_TextYankPost() |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1665 enew! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1666 call setline(1, ['foo']) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1667 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1668 let g:event = [] |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1669 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
|
1670 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1671 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1672 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
|
1673 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
|
1674 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1675 norm "ayiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1676 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1677 \{'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
|
1678 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1679 norm y_ |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1680 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1681 \{'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
|
1682 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1683 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
|
1684 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1685 \{'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
|
1686 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1687 norm "xciwbar |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1688 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1689 \{'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
|
1690 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1691 norm "bdiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1692 call assert_equal( |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1693 \{'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
|
1694 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1695 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1696 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1697 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1698 au! TextYankPost |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1699 unlet g:event |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1700 bwipe! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1701 endfunc |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1702 |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1703 func Test_nocatch_wipe_all_buffers() |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1704 " 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
|
1705 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
|
1706 " 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
|
1707 " 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
|
1708 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
|
1709 bwipe |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1710 au! |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1711 endfunc |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1712 |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1713 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
|
1714 " 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
|
1715 au * x bwipe |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1716 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
|
1717 au! |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1718 endfunc |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1719 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1720 function s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1721 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1722 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1723 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1724 let s:li = [] |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1725 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
|
1726 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
|
1727 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
|
1728 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
|
1729 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
|
1730 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1731 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1732 function s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1733 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
|
1734 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
|
1735 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
|
1736 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1737 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1738 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1739 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1740 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1741 function Test_dirchanged_global() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1742 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1743 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
|
1744 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
|
1745 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
|
1746 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
|
1747 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
|
1748 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
|
1749 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
|
1750 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
|
1751 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1752 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1753 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1754 function Test_dirchanged_local() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1755 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1756 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
|
1757 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
|
1758 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
|
1759 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
|
1760 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
|
1761 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
|
1762 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
|
1763 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
|
1764 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1765 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1766 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1767 function Test_dirchanged_auto() |
13178
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1768 if !exists('+autochdir') |
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1769 return |
f83d3a633ccb
patch 8.0.1463: test fails without 'autochdir' option
Christian Brabandt <cb@256bit.org>
parents:
13170
diff
changeset
|
1770 endif |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1771 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1772 call test_autochdir() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1773 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
|
1774 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
|
1775 set acd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1776 exe 'cd ..' |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1777 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
|
1778 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
|
1779 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
|
1780 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
|
1781 set noacd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1782 bwipe! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1783 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1784 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
|
1785 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1786 " 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
|
1787 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
|
1788 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
|
1789 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
|
1790 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
|
1791 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
|
1792 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1793 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
|
1794 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
|
1795 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
|
1796 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1797 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
|
1798 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
|
1799 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
|
1800 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1801 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
|
1802 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
|
1803 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
|
1804 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
|
1805 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1806 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
|
1807 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
|
1808 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
|
1809 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1810 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
|
1811 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
|
1812 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
|
1813 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1814 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
|
1815 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
|
1816 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
|
1817 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1818 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
|
1819 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
|
1820 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
|
1821 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1822 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
|
1823 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
|
1824 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
|
1825 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1826 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
|
1827 " 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
|
1828 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1829 " 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
|
1830 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
|
1831 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
|
1832 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
|
1833 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
|
1834 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
|
1835 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
|
1836 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
|
1837 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1838 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
|
1839 endfunc |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1840 |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1841 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
|
1842 func SetLineOne() |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1843 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
|
1844 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
|
1845 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
|
1846 endif |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1847 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1848 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1849 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
|
1850 new |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1851 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
|
1852 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
|
1853 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
|
1854 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
|
1855 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
|
1856 undo |
14485
c71d65c3672f
patch 8.1.0256: using setline() in TextChangedI splits undo
Christian Brabandt <cb@256bit.org>
parents:
14463
diff
changeset
|
1857 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
|
1858 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
|
1859 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1860 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
|
1861 bwipe! |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1862 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1863 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1864 func Test_Changed_FirstTime() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
1865 CheckFeature terminal |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
1866 CheckNotGui |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
1867 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1868 " 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
|
1869 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
|
1870 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
|
1871 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
|
1872 " Wait for the ruler (in the status line) to be shown. |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1873 " In ConPTY, there is additional character which is drawn up to the width of |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1874 " the screen. |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1875 if has('conpty') |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1876 call WaitForAssert({-> assert_match('\<All.*$', term_getline(buf, 3))}) |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1877 else |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1878 call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))}) |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
1879 endif |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1880 " 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
|
1881 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
|
1882 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
|
1883 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
|
1884 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
|
1885 |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1886 " clean up |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1887 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
|
1888 bwipe! |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1889 endfunc |
15611
bfcd7ffe9ac2
patch 8.1.0813: FileChangedShell not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1890 |
16217
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1891 func Test_autocmd_nested() |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1892 let g:did_nested = 0 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1893 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1894 au WinNew * edit somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1895 au BufNew * let g:did_nested = 1 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1896 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1897 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1898 call assert_equal(0, g:did_nested) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1899 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1900 bwipe! somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1901 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1902 " old nested argument still works |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1903 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1904 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1905 au WinNew * nested edit somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1906 au BufNew * let g:did_nested = 1 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1907 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1908 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1909 call assert_equal(1, g:did_nested) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1910 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1911 bwipe! somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1912 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1913 " New ++nested argument works |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1914 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1915 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1916 au WinNew * ++nested edit somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1917 au BufNew * let g:did_nested = 1 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1918 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1919 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1920 call assert_equal(1, g:did_nested) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1921 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1922 bwipe! somefile |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1923 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1924 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1925 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1926 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1927 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1928 call assert_fails('au WinNew * ++nested ++nested echo bad', 'E983:') |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1929 call assert_fails('au WinNew * nested nested echo bad', 'E983:') |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1930 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1931 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1932 func Test_autocmd_once() |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1933 " Without ++once WinNew triggers twice |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1934 let g:did_split = 0 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1935 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1936 au WinNew * let g:did_split += 1 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1937 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1938 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1939 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1940 call assert_equal(2, g:did_split) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1941 call assert_true(exists('#WinNew')) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1942 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1943 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1944 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1945 " With ++once WinNew triggers once |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1946 let g:did_split = 0 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1947 augroup Testing |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1948 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1949 au WinNew * ++once let g:did_split += 1 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1950 augroup END |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1951 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1952 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1953 call assert_equal(1, g:did_split) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1954 call assert_false(exists('#WinNew')) |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1955 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1956 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1957 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1958 call assert_fails('au WinNew * ++once ++once echo bad', 'E983:') |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1959 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1960 |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1961 func Test_autocmd_bufreadpre() |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1962 new |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1963 let b:bufreadpre = 1 |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1964 call append(0, range(100)) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1965 w! XAutocmdBufReadPre.txt |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1966 autocmd BufReadPre <buffer> :let b:bufreadpre += 1 |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1967 norm! 50gg |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1968 sp |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1969 norm! 100gg |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1970 wincmd p |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1971 let g:wsv1 = winsaveview() |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1972 wincmd p |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1973 let g:wsv2 = winsaveview() |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1974 " triggers BufReadPre, should not move the cursor in either window |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1975 " The topline may change one line in a large window. |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1976 edit |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1977 call assert_inrange(g:wsv2.topline - 1, g:wsv2.topline + 1, winsaveview().topline) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1978 call assert_equal(g:wsv2.lnum, winsaveview().lnum) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1979 call assert_equal(2, b:bufreadpre) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1980 wincmd p |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1981 call assert_equal(g:wsv1.topline, winsaveview().topline) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1982 call assert_equal(g:wsv1.lnum, winsaveview().lnum) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1983 call assert_equal(2, b:bufreadpre) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1984 " Now set the cursor position in an BufReadPre autocommand |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1985 " (even though the position will be invalid, this should make Vim reset the |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1986 " cursor position in the other window. |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1987 wincmd p |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1988 set cpo+=g |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1989 " won't do anything, but try to set the cursor on an invalid lnum |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1990 autocmd BufReadPre <buffer> :norm! 70gg |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1991 " triggers BufReadPre, should not move the cursor in either window |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1992 e |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1993 call assert_equal(1, winsaveview().topline) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1994 call assert_equal(1, winsaveview().lnum) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1995 call assert_equal(3, b:bufreadpre) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1996 wincmd p |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1997 call assert_equal(g:wsv1.topline, winsaveview().topline) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1998 call assert_equal(g:wsv1.lnum, winsaveview().lnum) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
1999 call assert_equal(3, b:bufreadpre) |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2000 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2001 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2002 call delete('XAutocmdBufReadPre.txt') |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2003 set cpo-=g |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2004 endfunc |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2005 |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15611
diff
changeset
|
2006 " FileChangedShell tested in test_filechanged.vim |
16397
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2007 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2008 " Tests for the following autocommands: |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2009 " - FileWritePre writing a compressed file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2010 " - FileReadPost reading a compressed file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2011 " - BufNewFile reading a file template |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2012 " - BufReadPre decompressing the file to be read |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2013 " - FilterReadPre substituting characters in the temp file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2014 " - FilterReadPost substituting characters after filtering |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2015 " - FileReadPre set options for decompression |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2016 " - FileReadPost decompress the file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2017 func Test_ReadWrite_Autocmds() |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2018 " Run this test only on Unix-like systems and if gzip is available |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2019 if !has('unix') || !executable("gzip") |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2020 return |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2021 endif |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2022 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2023 " Make $GZIP empty, "-v" would cause trouble. |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2024 let $GZIP = "" |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2025 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2026 " Use a FileChangedShell autocommand to avoid a prompt for 'Xtestfile.gz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2027 " being modified outside of Vim (noticed on Solaris). |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2028 au FileChangedShell * echo 'caught FileChangedShell' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2029 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2030 " Test for the FileReadPost, FileWritePre and FileWritePost autocmds |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2031 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2032 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2033 au FileWritePre *.gz '[,']!gzip |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2034 au FileWritePost *.gz undo |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2035 au FileReadPost *.gz '[,']!gzip -d |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2036 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2037 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2038 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2039 set bin |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2040 call append(0, [ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2041 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2042 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2043 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2044 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2045 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2046 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2047 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2048 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2049 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2050 \ ]) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2051 1,9write! Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2052 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2053 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2054 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2055 " Read and decompress the testfile |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2056 0read Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2057 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2058 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2059 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2060 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2061 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2062 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2063 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2064 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2065 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2066 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2067 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2068 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2069 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2070 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2071 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2072 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2073 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2074 " Test for the FileAppendPre and FileAppendPost autocmds |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2075 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2076 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2077 au BufNewFile *.c read Xtest.c |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2078 au FileAppendPre *.out '[,']s/new/NEW/ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2079 au FileAppendPost *.out !cat Xtest.c >> test.out |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2080 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2081 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2082 call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2083 new foo.c " should load Xtest.c |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2084 call assert_equal(['/*', ' * Here is a new .c file', ' */'], getline(2, 4)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2085 w! >> test.out " append it to the output file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2086 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2087 let contents = readfile('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2088 call assert_equal(' * Here is a NEW .c file', contents[2]) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2089 call assert_equal(' * Here is a new .c file', contents[5]) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2090 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2091 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2092 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2093 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2094 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2095 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2096 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2097 " Test for the BufReadPre and BufReadPost autocmds |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2098 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2099 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2100 " setup autocommands to decompress before reading and re-compress |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2101 " afterwards |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2102 au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2103 au BufReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2104 au BufReadPost *.gz call rename(expand("<afile>"), expand("<afile>:r")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2105 au BufReadPost *.gz exe '!gzip ' . shellescape(expand("<afile>:r")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2106 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2107 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2108 e! Xtestfile.gz " Edit compressed file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2109 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2110 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2111 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2112 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2113 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2114 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2115 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2116 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2117 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2118 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2119 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2120 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2121 w! >> test.out " Append it to the output file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2122 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2123 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2124 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2125 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2126 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2127 " Test for the FilterReadPre and FilterReadPost autocmds. |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2128 set shelltemp " need temp files here |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2129 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2130 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2131 au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t") |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2132 au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2133 au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand("<afile>")) . '.t' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2134 au FilterReadPost *.out '[,']s/x/X/g |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2135 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2136 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2137 e! test.out " Edit the output file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2138 1,$!cat |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2139 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2140 \ 'linE 2 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2141 \ 'linE 3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2142 \ 'linE 4 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2143 \ 'linE 5 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2144 \ 'linE 6 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2145 \ 'linE 7 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2146 \ 'linE 8 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2147 \ 'linE 9 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2148 \ 'linE 10 AbcdefghijklmnopqrstuvwXyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2149 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2150 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2151 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2152 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2153 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2154 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2155 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2156 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2157 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2158 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2159 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2160 \ ], readfile('test.out')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2161 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2162 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2163 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2164 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2165 set shelltemp&vim |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2166 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2167 " Test for the FileReadPre and FileReadPost autocmds. |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2168 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2169 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2170 au FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand("<afile>")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2171 au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>")) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2172 au FileReadPost *.gz '[,']s/l/L/ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2173 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2174 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2175 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2176 0r Xtestfile.gz " Read compressed file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2177 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2178 \ 'Line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2179 \ 'Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2180 \ 'Line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2181 \ 'Line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2182 \ 'Line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2183 \ 'Line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2184 \ 'Line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2185 \ 'Line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2186 \ 'Line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2187 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2188 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2189 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2190 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2191 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2192 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2193 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2194 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2195 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2196 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2197 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2198 \ ], readfile('Xtestfile.gz')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2199 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2200 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2201 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2202 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2203 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2204 au! FileChangedShell |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2205 call delete('Xtestfile.gz') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2206 call delete('Xtest.c') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2207 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2208 endfunc |
16617
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2209 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2210 func Test_throw_in_BufWritePre() |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2211 new |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2212 call setline(1, ['one', 'two', 'three']) |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2213 call assert_false(filereadable('Xthefile')) |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2214 augroup throwing |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2215 au BufWritePre X* throw 'do not write' |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2216 augroup END |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2217 try |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2218 w Xthefile |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2219 catch |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2220 let caught = 1 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2221 endtry |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2222 call assert_equal(1, caught) |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2223 call assert_false(filereadable('Xthefile')) |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2224 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2225 bwipe! |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2226 au! throwing |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2227 endfunc |