Mercurial > vim
annotate src/testdir/test_autocmd.vim @ 23027:f74978697fb6 v8.2.2060
patch 8.2.2060: check for features implemented with "if"
Commit: https://github.com/vim/vim/commit/aeb313f355cd67638e3c611354ce401d86f56afe
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 27 19:13:28 2020 +0100
patch 8.2.2060: check for features implemented with "if"
Problem: Check for features implemented with "if".
Solution: Use the Check commands. (Ken Takata, closes https://github.com/vim/vim/issues/7383)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 27 Nov 2020 19:15:04 +0100 |
parents | d10a37eb91ee |
children | b545334ae654 |
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 |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
5 source term_util.vim |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
6 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15207
diff
changeset
|
7 func s:cleanup_buffers() abort |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
8 for bnr in range(1, bufnr('$')) |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
9 if bufloaded(bnr) && bufnr('%') != bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
10 execute 'bd! ' . bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
11 endif |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
12 endfor |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
13 endfunc |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
14 |
8738
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 func Test_vim_did_enter() |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_false(v:vim_did_enter) |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " 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
|
19 " becomes one. |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 endfunc |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
21 |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
22 " Test for the CursorHold autocmd |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
23 func Test_CursorHold_autocmd() |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
24 CheckRunVimInTerminal |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
25 call writefile(['one', 'two', 'three'], 'Xfile') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
26 let before =<< trim END |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
27 set updatetime=10 |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
28 au CursorHold * call writefile([line('.')], 'Xoutput', 'a') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
29 END |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
30 call writefile(before, 'Xinit') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
31 let buf = RunVimInTerminal('-S Xinit Xfile', {}) |
21895
0ae284aaa8a2
patch 8.2.1497: CursorHold test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
32 call term_sendkeys(buf, "G") |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
33 call term_wait(buf, 50) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
34 call term_sendkeys(buf, "gg") |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
35 call term_wait(buf) |
21895
0ae284aaa8a2
patch 8.2.1497: CursorHold test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
36 call WaitForAssert({-> assert_equal(['1'], readfile('Xoutput')[-1:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
37 call term_sendkeys(buf, "j") |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
38 call term_wait(buf) |
21895
0ae284aaa8a2
patch 8.2.1497: CursorHold test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
39 call WaitForAssert({-> assert_equal(['1', '2'], readfile('Xoutput')[-2:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
40 call term_sendkeys(buf, "j") |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
41 call term_wait(buf) |
21895
0ae284aaa8a2
patch 8.2.1497: CursorHold test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
42 call WaitForAssert({-> assert_equal(['1', '2', '3'], readfile('Xoutput')[-3:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
43 call StopVimInTerminal(buf) |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
44 |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
45 call delete('Xinit') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
46 call delete('Xoutput') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
47 call delete('Xfile') |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
48 endfunc |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
49 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
50 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
|
51 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
52 func ExitInsertMode(id) |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
53 call feedkeys("\<Esc>") |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
54 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
55 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
56 func Test_cursorhold_insert() |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
57 " Need to move the cursor. |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
58 call feedkeys("ggG", "xt") |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
59 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
60 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
61 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
62 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
63 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
64 call feedkeys('a', 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
65 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
|
66 unlet g:triggered |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
67 au! CursorHoldI |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
68 set updatetime& |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
69 endfunc |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
70 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
71 func Test_cursorhold_insert_with_timer_interrupt() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
72 CheckFeature job |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
73 " 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
|
74 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
|
75 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
76 " 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
|
77 " CursorHoldI event. |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
78 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
|
79 au CursorHoldI * let g:triggered += 1 |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
80 set updatetime=100 |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
81 call job_start(has('win32') ? 'cmd /c echo:' : 'echo', |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
82 \ {'exit_cb': {-> timer_start(200, 'ExitInsertMode')}}) |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
83 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
|
84 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
|
85 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
86 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
87 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
88 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
89 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
90 func Test_cursorhold_insert_ctrl_x() |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
91 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
92 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
93 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
94 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
95 " 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
|
96 call feedkeys("a\<C-X>", 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
97 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
|
98 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
99 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
100 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
101 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
|
102 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
116 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
|
117 au! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
118 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
|
119 bwipe! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
120 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
|
121 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
|
122 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
|
123 endfunc |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
124 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
125 endif "has('timers') |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
126 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
127 func Test_bufunload() |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
128 augroup test_bufunload_group |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
129 autocmd! |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 augroup END |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
134 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
135 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
136 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
137 setlocal bufhidden= |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
138 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
139 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
|
140 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
141 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
142 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
143 setlocal bufhidden=delete |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
144 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
145 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
|
146 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
147 let s:li=[] |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
148 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
149 setlocal bufhidden=unload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
150 bwipeout |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
151 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
|
152 |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
153 au! test_bufunload_group |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
154 augroup! test_bufunload_group |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
155 endfunc |
9450
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
156 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
157 " 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
|
158 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
|
159 tabedit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
160 tabfirst |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
161 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
162 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
|
163 autocmd! |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
164 autocmd BufUnload <buffer> tabnext |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
165 augroup END |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
166 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
167 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
168 call assert_equal(2, tabpagenr('$')) |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
169 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
170 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
|
171 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
|
172 tablast |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
173 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
174 endfunc |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
175 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
176 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
|
177 tabedit |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
178 augroup sample |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
179 autocmd! |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
180 autocmd BufWinLeave <buffer> tabfirst |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
181 augroup END |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
182 call setline(1, ['a', 'b', 'c']) |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
183 edit! a.txt |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
184 tabclose |
10114
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
185 endfunc |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
186 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
187 " 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
|
188 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
|
189 split aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
190 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
191 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
192 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
193 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
194 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
|
195 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
196 |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22576
diff
changeset
|
197 call assert_fails('edit bb.txt', 'E937:') |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
198 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
199 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
200 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
201 bwipe! aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
202 bwipe! bb.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
203 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
204 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
205 " 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
|
206 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
|
207 setlocal buftype=nowrite |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
208 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
209 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
210 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
211 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
212 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
|
213 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
214 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
215 normal! i1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
216 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
|
217 call feedkeys("\<CR>") |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
218 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
219 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
220 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
221 bwipe! a.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
222 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
223 |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
224 func Test_win_tab_autocmd() |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
225 let g:record = [] |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
226 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
227 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
236 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
237 split |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
238 tabnew |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
239 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
240 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
241 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
242 call assert_equal([ |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
243 \ 'WinLeave', 'WinNew', 'WinEnter', |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
244 \ '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
|
245 \ 'WinLeave', 'TabLeave', 'TabClosed', 'WinEnter', 'TabEnter', |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
246 \ 'WinLeave', 'WinEnter' |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
247 \ ], g:record) |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
248 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
249 let g:record = [] |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
250 tabnew somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
251 tabnext |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
252 bwipe somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
253 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
254 call assert_equal([ |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
255 \ '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
|
256 \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', |
9599
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
257 \ 'TabClosed' |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
258 \ ], g:record) |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
259 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
260 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
261 au! |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
262 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
263 unlet g:record |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
264 endfunc |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
265 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
266 func s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
267 augroup vimBarTest |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
268 au BufReadCmd * echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
269 augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
270 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
|
271 endfunc |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
272 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
273 func Test_early_bar() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
274 " 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
|
275 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
276 augroup vimBarTest | au! | augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
277 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
|
278 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
279 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
280 augroup vimBarTest| au!| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
281 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
|
282 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
283 " 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
|
284 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
285 augroup vimBarTest| au!BufReadCmd| augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
286 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
|
287 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
288 " 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
|
289 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
290 au! vimBarTest|echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
291 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
|
292 endfunc |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
293 |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
294 func RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
295 autocmd! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
296 augroup! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
297 endfunc |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
298 |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
299 func Test_augroup_warning() |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
300 augroup TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
301 au VimEnter * echo 'entering' |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
302 augroup END |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
303 call assert_match("TheWarning.*VimEnter", execute('au VimEnter')) |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
304 redir => res |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
305 augroup! TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
306 redir END |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
307 call assert_match("W19:", res) |
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
308 call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
309 |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
310 " 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
|
311 augroup Another |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
312 augroup END |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
313 call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
314 augroup! Another |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
315 |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
316 " no warning for postpone aucmd delete |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
317 augroup StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
318 au VimEnter * call RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
319 augroup END |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
320 call assert_match("StartOK.*VimEnter", execute('au VimEnter')) |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
321 redir => res |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
322 doautocmd VimEnter |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
323 redir END |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
324 call assert_notmatch("W19:", res) |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
325 au! VimEnter |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
326 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
327 call assert_fails('augroup!', 'E471:') |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
328 endfunc |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
329 |
12680
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
330 func Test_BufReadCmdHelp() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
331 " 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
|
332 au BufReadCmd * e +h |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
333 help |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
334 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
335 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
336 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
337 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
338 func Test_BufReadCmdHelpJump() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
339 " 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
|
340 au BufReadCmd * e +h{ |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
341 " } to fix highlighting |
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
342 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
|
343 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
344 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
345 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
346 |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
347 func Test_augroup_deleted() |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
348 " 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
|
349 augroup x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
350 call assert_fails('augroup! x', 'E936:') |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
351 au VimEnter * echo |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
352 augroup end |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
353 augroup! x |
22999
ffb173dbf228
patch 8.2.2046: some test failures don't give a clear error
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
354 call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
355 au! VimEnter |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
356 endfunc |
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
357 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
358 " Tests for autocommands on :close command. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
359 " This used to be in test13. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
360 func Test_three_windows() |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
361 " 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
|
362 call s:cleanup_buffers() |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
363 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
364 " 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
|
365 " 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
|
366 " Do this twice, writing the file. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
367 e! Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
368 call setline(1, 'testje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
369 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
370 sp Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
371 call setline(1, 'testje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
372 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
373 sp Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
374 call setline(1, 'testje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
375 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
376 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
377 au WinLeave Xtestje2 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
378 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
379 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
380 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
381 au WinLeave Xtestje1 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
382 close |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
383 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
384 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
385 " 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
|
386 " will be the ATTENTION prompt. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
387 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
388 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
389 au! BufUnload Xtestje1 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
390 call assert_fails('e Xtestje3', 'E937:') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
391 call assert_equal('Xtestje3', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
392 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
393 e Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
394 sp Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
395 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
|
396 call assert_equal('Xtestje1', expand('%')) |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
397 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
398 " 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
|
399 " 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
|
400 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
401 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
402 e Xanother |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
403 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
404 bwipe Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
405 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
406 au BufWipeout Xtestje1 buf Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
407 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
408 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
409 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
410 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
411 help |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
412 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
413 1quit |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
414 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
415 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
416 au! |
11197
7f355d8cd634
patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents:
10575
diff
changeset
|
417 enew |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
418 call delete('Xtestje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
419 call delete('Xtestje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
420 call delete('Xtestje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
421 endfunc |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
422 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
423 func Test_BufEnter() |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
424 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
425 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
|
426 let g:val = '' |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
427 split NewFile |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
428 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
|
429 bwipe! |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
430 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
|
431 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
432 " 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
|
433 call mkdir('Xdir') |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
434 split Xdir |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
435 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
|
436 |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
437 " 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
|
438 " buffer. |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
439 bwipe! Xdir |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
440 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
441 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
|
442 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
443 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
|
444 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
445 " 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
|
446 " 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
|
447 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
|
448 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
|
449 tabnew |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
450 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
|
451 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
|
452 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
453 |
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
|
454 let content =<< trim [CODE] |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
455 call test_override('ui_delay', 10) |
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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 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
|
462 |
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 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
|
464 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
|
465 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
|
466 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
|
467 [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
|
468 |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
469 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
|
470 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
|
471 let errors = join(readfile('Xerrors')) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
472 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
|
473 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
478 endfunc |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
479 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
480 " 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
|
481 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
|
482 tabnew |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
483 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
|
484 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
485 |
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
|
486 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
|
487 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
|
488 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
503 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
|
504 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
|
505 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
|
506 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
|
507 [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
|
508 |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 " 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
|
513 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
|
514 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
|
515 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
516 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
|
517 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
|
518 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
|
519 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
520 endfunc |
11641
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
521 |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
522 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
|
523 doau \| |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
524 endfunc |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
525 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 "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
|
533 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
534 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
535 func Test_OptionSet() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
536 CheckOption autochdir |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
537 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
538 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
|
539 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
540 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
|
541 set nocp |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
542 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
|
543 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
544 " 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
|
545 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
|
546 set nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
547 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
548 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
549 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
550 " 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
|
551 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
|
552 setlocal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
553 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
|
554 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
|
555 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
556 " 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
|
557 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
|
558 setglobal nonu |
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 " 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
|
563 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
|
564 setlocal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
565 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
566 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
|
567 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
568 " 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
|
569 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
|
570 setglobal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
571 call assert_equal([], g:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
572 call assert_equal(g:opt[0], g:opt[1]) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
573 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
574 " 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
|
575 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
|
576 set ai! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
577 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
|
578 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
|
579 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
580 " 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
|
581 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
|
582 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
|
583 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
|
584 set ai! |
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:options) |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
586 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
|
587 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
588 " 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
|
589 " 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
595 " 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
|
596 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
|
597 set list nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
598 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
|
599 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
|
600 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
601 " 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
607 " 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
|
608 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
|
609 setlocal acd |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
610 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
|
611 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
|
612 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
613 " 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
|
614 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
|
615 set ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
616 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
|
617 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
|
618 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
619 " 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
|
620 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
|
621 setlocal ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
622 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
|
623 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
|
624 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
625 " 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
|
626 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
|
627 setglobal invar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
628 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
|
629 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
|
630 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
631 " 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
|
632 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
|
633 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
|
634 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
|
635 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
|
636 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
637 " 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
|
638 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
|
639 " 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
|
640 " 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
|
641 let bnum = bufnr('%') |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
642 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
|
643 " 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
|
644 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
|
645 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
|
646 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
|
647 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
648 " 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
|
649 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
|
650 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
|
651 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
|
652 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
|
653 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
654 " 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
|
655 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
|
656 setlocal key=blah |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
657 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
|
658 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
|
659 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
|
660 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
661 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
662 " 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
669 " 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
|
670 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
|
671 set backupext& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
672 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
|
673 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
|
674 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
675 " 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
|
676 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
|
677 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
|
678 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
|
679 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
|
680 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
681 " 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
|
682 " 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
|
683 " :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
|
684 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
|
685 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
|
686 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
|
687 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
|
688 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
|
689 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
690 " 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
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
698 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
699 " 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
706 " 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
|
707 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
|
708 set tags& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
709 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
|
710 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
|
711 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
712 " 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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
718 " 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
|
719 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
|
720 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
|
721 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
|
722 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
|
723 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
724 " 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
|
725 " 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
|
726 " 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 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
|
733 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
734 " 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
|
735 " 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
|
736 " 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
|
737 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
|
738 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
|
739 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
|
740 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
|
741 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
|
742 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
|
743 |
17085
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 " 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
|
746 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
|
747 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
|
748 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
|
749 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
|
750 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
|
751 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
752 " 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
|
753 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
|
754 set spelllang& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
755 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
|
756 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
|
757 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
758 " 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
|
759 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
|
760 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
|
761 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
|
762 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
|
763 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
764 " 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
|
765 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
|
766 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
|
767 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
|
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 " 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
|
772 " 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
|
773 " 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
|
774 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
781 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
782 " 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 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
|
788 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
789 " 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
|
790 " 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
|
791 " 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
|
792 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
|
793 set statusline& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
794 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
|
795 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
|
796 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
797 " 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
|
798 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
|
799 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
|
800 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
|
801 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
|
802 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
803 " 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
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
810 " 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
|
811 " 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
|
812 " 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
|
813 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
|
814 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
|
815 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
|
816 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
|
817 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
|
818 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
|
819 |
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 " 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
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
828 " 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
|
829 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
|
830 set foldignore& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
831 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
|
832 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
|
833 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
834 " 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
|
835 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
|
836 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
|
837 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
|
838 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
|
839 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
840 " 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
|
841 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
|
842 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
|
843 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
|
844 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
|
845 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
|
846 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
847 " 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
|
848 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
|
849 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
|
850 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
|
851 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
|
852 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
|
853 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
|
854 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
855 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
856 " 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 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
|
863 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
864 " 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
|
865 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
|
866 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
|
867 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
|
868 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
|
869 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
|
870 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
|
871 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
872 " 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
|
873 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
|
874 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
|
875 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
|
876 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
|
877 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
|
878 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
|
879 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
880 " 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
|
881 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
|
882 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
|
883 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
|
884 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
|
885 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
|
886 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
887 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
888 " 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
|
889 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
|
890 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
|
891 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
|
892 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
|
893 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
|
894 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
|
895 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
896 " 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
|
897 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
|
898 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
|
899 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
|
900 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
|
901 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
|
902 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
|
903 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
904 " 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
|
905 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
|
906 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
|
907 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
|
908 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
|
909 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
|
910 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
|
911 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
912 " 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
|
913 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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
919 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
920 " 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
928 " 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
|
929 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
|
930 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
|
931 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
|
932 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
|
933 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
|
934 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
|
935 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
936 " 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
|
937 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
|
938 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
|
939 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
|
940 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
|
941 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
|
942 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
|
943 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
944 " 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
|
945 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
|
946 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
|
947 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
|
948 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
|
949 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
|
950 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
951 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
952 " 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
|
953 " 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
|
954 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
955 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
956 " 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
|
957 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
|
958 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
|
959 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
|
960 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
|
961 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
|
962 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
|
963 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
964 " 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
|
965 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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 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
|
971 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
972 " 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
|
973 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
|
974 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
|
975 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
|
976 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
|
977 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
|
978 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
|
979 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
980 " 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 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
|
986 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
987 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
988 " 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
|
989 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
|
990 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
|
991 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
|
992 setglobal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
993 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
|
994 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
|
995 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
996 " 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
|
997 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
|
998 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
|
999 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
|
1000 setlocal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1001 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
|
1002 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
|
1003 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1004 " 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
|
1005 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
|
1006 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
|
1007 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
|
1008 set nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1009 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
|
1010 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
|
1011 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1012 " 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
|
1013 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
|
1014 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
|
1015 set wrapscan |
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:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1017 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
|
1018 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1019 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1020 " 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
|
1021 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
|
1022 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
|
1023 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
|
1024 setglobal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1025 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
|
1026 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
|
1027 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1028 " 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
|
1029 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
|
1030 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
|
1031 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
|
1032 setlocal noautoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1033 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
|
1034 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
|
1035 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1036 " 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
|
1037 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
|
1038 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
|
1039 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
|
1040 set autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1041 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
|
1042 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
|
1043 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1044 " 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
|
1045 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
|
1046 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
|
1047 set autoread |
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:options) |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1049 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
|
1050 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1051 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1052 " 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
|
1053 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
|
1054 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
|
1055 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
|
1056 setglobal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1057 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
|
1058 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
|
1059 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1060 " 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
|
1061 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
|
1062 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
|
1063 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
|
1064 setlocal nocindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1065 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
|
1066 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
|
1067 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1068 " 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
|
1069 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
|
1070 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
|
1071 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
|
1072 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1073 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
|
1074 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
|
1075 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1076 " 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
|
1077 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
|
1078 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
|
1079 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1080 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
|
1081 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
|
1082 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1083 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1084 " 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
|
1085 " 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
|
1086 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1087 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1088 " 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
|
1089 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
|
1090 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
|
1091 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
|
1092 setglobal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1093 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
|
1094 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
|
1095 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1096 " 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
|
1097 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
|
1098 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
|
1099 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
|
1100 setlocal nocursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1101 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
|
1102 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
|
1103 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1104 " 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
|
1105 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
|
1106 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
|
1107 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
|
1108 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1109 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
|
1110 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
|
1111 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1112 " 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
|
1113 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
|
1114 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
|
1115 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1116 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
|
1117 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
|
1118 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1119 |
17918
9606c0adc148
patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1120 " 33: Test autocommands when an option value is converted internally. |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1121 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
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1127 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1128 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1129 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
|
1130 " 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
|
1131 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
|
1132 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
|
1133 endfor |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1134 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
|
1135 delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1136 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1137 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1138 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
|
1139 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
|
1140 " 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
|
1141 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1142 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
|
1143 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1144 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
|
1145 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
|
1146 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1147 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
|
1148 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1149 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1150 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
|
1151 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
|
1152 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1153 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
|
1154 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1155 diffoff |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1156 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
|
1157 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
|
1158 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1159 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1160 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
|
1161 diffoff! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1162 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
|
1163 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
|
1164 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1165 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1166 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1167 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1168 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
|
1169 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1170 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1171 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
|
1172 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
|
1173 " 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
|
1174 " should not segfault |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1175 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1176 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
|
1177 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1178 call setline(1, ['buffer 1', 'line2', 'line3', 'line4']) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1179 call assert_fails(':diffthis', 'E788:') |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1180 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
|
1181 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1182 call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4']) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1183 call assert_fails(':diffthis', 'E788:') |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1184 call assert_equal(1, &diff) |
18592
75c466dcf61c
patch 8.1.2290: autocommand test fails
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
1185 set diffopt-=closeoff |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1186 bw! |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1187 call assert_fails(':diffoff!', 'E788:') |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1188 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1189 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1190 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1191 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1192 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
|
1193 "delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1194 endfunc |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1195 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1196 " 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
|
1197 func Test_BufleaveWithDelete() |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1198 new | edit Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1199 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1200 augroup test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1201 autocmd! |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1202 autocmd BufLeave Xfile1 bwipe Xfile2 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1203 augroup END |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1204 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1205 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
|
1206 call assert_equal('Xfile1', bufname('%')) |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1207 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1208 autocmd! test_bufleavewithdelete BufLeave Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1209 augroup! test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1210 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1211 new |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1212 bwipe! Xfile1 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1213 endfunc |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1214 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1215 " 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
|
1216 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
|
1217 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1218 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1219 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
|
1220 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
|
1221 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
|
1222 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1223 " 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
|
1224 split Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1225 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1226 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1227 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1228 split Xxx3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1229 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1230 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1231 " 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
|
1232 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
|
1233 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1234 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
|
1235 ball |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1236 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1237 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
|
1238 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
|
1239 wincmd t |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1240 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1241 au! BufReadPost |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1242 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1243 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1244 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1245 call delete('Xxx3') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1246 enew! | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1247 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1248 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1249 " 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
|
1250 " 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
|
1251 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
|
1252 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1253 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
|
1254 \ "\<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
|
1255 \ '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
|
1256 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
|
1257 \ 'vim: set noai :', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1258 \ "\<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
|
1259 \ '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
|
1260 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1261 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
|
1262 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
|
1263 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1264 " 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
|
1265 edit Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1266 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
|
1267 " 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
|
1268 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
|
1269 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
|
1270 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
|
1271 " 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
|
1272 au! BufEnter Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1273 buf! Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1274 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
|
1275 " 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
|
1276 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
|
1277 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
|
1278 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
|
1279 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1280 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1281 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1282 call delete('Xxx2') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1283 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
|
1284 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1285 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1286 " 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
|
1287 " 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
|
1288 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
|
1289 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1290 set ai |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1291 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
|
1292 set fo+=r |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1293 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
|
1294 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
|
1295 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
|
1296 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1297 set ai&vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1298 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
|
1299 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1300 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1301 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1302 " 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
|
1303 " 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
|
1304 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
|
1305 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1306 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
|
1307 \ '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
|
1308 \ '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
|
1309 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
|
1310 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
|
1311 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1312 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
|
1313 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1314 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1315 " 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
|
1316 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1317 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
|
1318 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
|
1319 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1320 " 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
|
1321 %write! test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1322 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
|
1323 " delete alternate buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1324 bwipe test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1325 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
|
1326 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
|
1327 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1328 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
|
1329 " 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
|
1330 bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1331 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
|
1332 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
|
1333 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
|
1334 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
|
1335 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1336 call delete('Xxx1') |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1337 call delete('Xxx2') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1338 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
|
1339 %bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1340 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
|
1341 |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
1342 " 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
|
1343 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
|
1344 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
|
1345 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1346 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
|
1347 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
|
1348 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
|
1349 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
|
1350 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
|
1351 " 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
|
1352 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
|
1353 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
|
1354 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1355 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
|
1356 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
|
1357 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
|
1358 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
|
1359 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
1360 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
|
1361 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
|
1362 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
|
1363 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
|
1364 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
|
1365 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1366 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1367 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
|
1368 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
|
1369 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
|
1370 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
|
1371 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
1372 |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
1373 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
|
1374 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
|
1375 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
|
1376 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
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 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
|
1382 |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1383 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
|
1384 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
|
1385 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
|
1386 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
|
1387 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
|
1388 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
|
1389 new |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1390 call setline(1, 'hello') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1391 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
|
1392 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
|
1393 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
|
1394 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
|
1395 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
|
1396 au! CmdlineLeave |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1397 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
|
1398 endfunc |
12662
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 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
|
1401 func Test_BufWritePre() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1402 %bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1403 au BufWritePre Xxx1 bunload |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1404 au BufWritePre Xxx2 bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1405 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1406 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
|
1407 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
|
1408 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1409 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1410 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1411 bdel Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1412 e Xxx1 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1413 " write it, will unload it and give an error msg |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1414 call assert_fails('w', 'E203:') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1415 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
|
1416 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1417 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1418 bwipe Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1419 " write it, will delete the buffer and give an error msg |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1420 call assert_fails('w', 'E203:') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1421 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
|
1422 au! BufWritePre |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1423 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1424 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1425 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1426 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1427 " 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
|
1428 func Test_bufunload_all() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1429 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
|
1430 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
|
1431 |
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
|
1432 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
|
1433 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
|
1434 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
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 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
|
1441 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
|
1442 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
|
1443 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
|
1444 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
|
1445 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
|
1446 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
|
1447 [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
|
1448 |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1449 call writefile(content, 'Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1450 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1451 call delete('Xout') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1452 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
|
1453 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
|
1454 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1455 call delete('Xxx1') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1456 call delete('Xxx2') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1457 call delete('Xtest') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1458 call delete('Xout') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1459 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1460 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1461 " 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
|
1462 func Test_buflocal_autocmd() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1463 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1464 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1465 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
|
1466 " 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
|
1467 " 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
|
1468 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1469 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
|
1470 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1471 " 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
|
1472 bwipe xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1473 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1474 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1475 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
|
1476 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1477 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1478 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
|
1479 enew |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1480 unlet g:bname |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1481 endfunc |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1482 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1483 " Test for "*Cmd" autocommands |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1484 func Test_Cmd_Autocmds() |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1485 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
|
1486 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1487 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1488 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
|
1489 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
|
1490 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
|
1491 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1492 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
|
1493 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
|
1494 call assert_equal('write', getline('$')) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1495 call assert_fails('read XtestA', 'E484:') " should not read anything |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1496 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
|
1497 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1498 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1499 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1500 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1501 " 3 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1502 " 4 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1503 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1504 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
|
1505 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
|
1506 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
|
1507 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1508 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1509 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1510 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1511 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1512 " 4 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1513 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1514 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1515 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1516 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1517 au FileWriteCmd XtestC '[,']copy $ |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1518 normal 4GA1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1519 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
|
1520 call assert_equal("\tabc21", getline(8)) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1521 call assert_fails('r XtestC', 'E484:') " should not read anything |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1522 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
|
1523 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1524 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1525 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1526 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1527 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1528 " 4 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1529 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1530 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1531 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1532 " 8 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1533 " 9 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1534 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1535 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1536 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
|
1537 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
|
1538 call assert_equal(9, len(g:lines)) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1539 call assert_fails('$r XtestD', 'E484:') " should not read anything |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1540 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
|
1541 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
|
1542 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1543 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
|
1544 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
|
1545 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
|
1546 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1547 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1548 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
|
1549 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
|
1550 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
|
1551 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
|
1552 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
|
1553 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1554 au! BufReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1555 au! BufWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1556 au! FileReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1557 au! FileWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1558 au! FileAppendCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1559 %bwipe! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1560 call delete('Xxx') |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1561 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
1562 endfunc |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1563 |
19836
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1564 func s:ReadFile() |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1565 setl noswapfile nomodified |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1566 let filename = resolve(expand("<afile>:p")) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1567 execute 'read' fnameescape(filename) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1568 1d_ |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1569 exe 'file' fnameescape(filename) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1570 setl buftype=acwrite |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1571 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1572 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1573 func s:WriteFile() |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1574 let filename = resolve(expand("<afile>:p")) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1575 setl buftype= |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1576 noautocmd execute 'write' fnameescape(filename) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1577 setl buftype=acwrite |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1578 setl nomodified |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1579 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1580 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1581 func Test_BufReadCmd() |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1582 autocmd BufReadCmd *.test call s:ReadFile() |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1583 autocmd BufWriteCmd *.test call s:WriteFile() |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1584 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1585 call writefile(['one', 'two', 'three'], 'Xcmd.test') |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1586 edit Xcmd.test |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1587 call assert_match('Xcmd.test" line 1 of 3', execute('file')) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1588 normal! Gofour |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1589 write |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1590 call assert_equal(['one', 'two', 'three', 'four'], readfile('Xcmd.test')) |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1591 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1592 bwipe! |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1593 call delete('Xcmd.test') |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1594 au! BufReadCmd |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1595 au! BufWriteCmd |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1596 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
1597 |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1598 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
|
1599 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
|
1600 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
|
1601 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1602 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1603 " 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
|
1604 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
|
1605 edit! Xtest |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1606 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
|
1607 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1608 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
|
1609 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1610 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
|
1611 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1612 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
|
1613 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
|
1614 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1615 au! BufWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1616 |
21638
5dcdb970111b
patch 8.2.1369: MS-Windows: autocommand test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21419
diff
changeset
|
1617 if has('unix') |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1618 write XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1619 write >> XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1620 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1621 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
|
1622 " 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
|
1623 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
|
1624 " '[ 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
|
1625 " data |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1626 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
|
1627 " 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
|
1628 " 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
|
1629 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
|
1630 %!cat XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1631 " 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
|
1632 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
|
1633 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
|
1634 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1635 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1636 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
|
1637 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
|
1638 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
|
1639 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
|
1640 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
|
1641 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
|
1642 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
|
1643 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1644 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1645 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
|
1646 endif |
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 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
|
1649 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
|
1650 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
|
1651 au! FileWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1652 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1653 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
|
1654 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
|
1655 write >> Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1656 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1657 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1658 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
|
1659 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
|
1660 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
|
1661 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1662 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1663 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
|
1664 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
|
1665 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
|
1666 3read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1667 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
|
1668 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1669 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1670 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
|
1671 " 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
|
1672 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
|
1673 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
|
1674 0read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1675 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
|
1676 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1677 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1678 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
|
1679 " 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
|
1680 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
|
1681 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
|
1682 1read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1683 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
|
1684 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1685 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1686 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1687 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
|
1688 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
|
1689 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1690 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1691 func Test_Filter_noshelltemp() |
23027
f74978697fb6
patch 8.2.2060: check for features implemented with "if"
Bram Moolenaar <Bram@vim.org>
parents:
23021
diff
changeset
|
1692 CheckExecutable cat |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1693 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1694 enew! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1695 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
|
1696 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1697 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
|
1698 set shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1699 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1700 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
|
1701 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
|
1702 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
|
1703 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
|
1704 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1705 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
|
1706 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1707 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
|
1708 set noshelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1709 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1710 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
|
1711 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
|
1712 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
|
1713 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
|
1714 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1715 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
|
1716 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1717 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1718 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
|
1719 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
|
1720 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
1721 endfunc |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1722 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1723 func Test_TextYankPost() |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1724 enew! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1725 call setline(1, ['foo']) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1726 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1727 let g:event = [] |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1728 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
|
1729 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1730 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1731 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
|
1732 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
|
1733 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1734 norm "ayiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1735 call assert_equal( |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1736 \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v', 'visual': v:false}, |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1737 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1738 norm y_ |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1739 call assert_equal( |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1740 \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:false}, |
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1741 \g:event) |
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1742 norm Vy |
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1743 call assert_equal( |
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1744 \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:true}, |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1745 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1746 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
|
1747 call assert_equal( |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1748 \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161", 'visual': v:true}, |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1749 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1750 norm "xciwbar |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1751 call assert_equal( |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1752 \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v', 'visual': v:false}, |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1753 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1754 norm "bdiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1755 call assert_equal( |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
1756 \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v', 'visual': v:false}, |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1757 \g:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1758 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1759 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1760 |
23021
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1761 if has('clipboard_working') && !has('gui_running') |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1762 " Test that when the visual selection is automatically copied to clipboard |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1763 " register a TextYankPost is emitted |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1764 call setline(1, ['foobar']) |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1765 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1766 let @* = '' |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1767 set clipboard=autoselect |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1768 exe "norm! ggviw\<Esc>" |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1769 call assert_equal( |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1770 \{'regcontents': ['foobar'], 'regname': '*', 'operator': 'y', 'regtype': 'v', 'visual': v:true}, |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1771 \g:event) |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1772 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1773 let @+ = '' |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1774 set clipboard=autoselectplus |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1775 exe "norm! ggviw\<Esc>" |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1776 call assert_equal( |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1777 \{'regcontents': ['foobar'], 'regname': '+', 'operator': 'y', 'regtype': 'v', 'visual': v:true}, |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1778 \g:event) |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1779 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1780 set clipboard&vim |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1781 endif |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
1782 |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1783 au! TextYankPost |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1784 unlet g:event |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1785 bwipe! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
1786 endfunc |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1787 |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1788 func Test_nocatch_wipe_all_buffers() |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1789 " 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
|
1790 au * * bwipe * |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22576
diff
changeset
|
1791 call assert_fails('next x', ['E94:', 'E937:']) |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1792 bwipe |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1793 au! |
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
1794 endfunc |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1795 |
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1796 func Test_nocatch_wipe_dummy_buffer() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1797 CheckFeature quickfix |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1798 " Nasty autocommand: wipe buffer on any event. |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1799 au * x bwipe |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1800 call assert_fails('lv½ /x', 'E937:') |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1801 au! |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
1802 endfunc |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1803 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1804 function s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1805 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1806 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1807 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1808 let s:li = [] |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1809 let s:dir_this = getcwd() |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
1810 let s:dir_foo = s:dir_this . '/Xfoo' |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1811 call mkdir(s:dir_foo) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
1812 let s:dir_bar = s:dir_this . '/Xbar' |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1813 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
|
1814 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1815 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1816 function s:After_test_dirchanged() |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1817 call chdir(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
|
1818 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
|
1819 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
|
1820 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1821 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1822 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1823 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1824 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1825 function Test_dirchanged_global() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1826 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1827 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
|
1828 autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>")) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1829 call chdir(s:dir_foo) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1830 call assert_equal(["cd:", s:dir_foo], s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1831 call chdir(s:dir_foo) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1832 call assert_equal(["cd:", s:dir_foo], s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1833 exe 'lcd ' .. fnameescape(s:dir_bar) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1834 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
|
1835 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1836 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1837 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1838 function Test_dirchanged_local() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1839 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1840 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
|
1841 autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>")) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1842 call chdir(s:dir_foo) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1843 call assert_equal([], s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1844 exe 'lcd ' .. fnameescape(s:dir_bar) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1845 call assert_equal(["lcd:", s:dir_bar], s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1846 exe 'lcd ' .. fnameescape(s:dir_bar) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
1847 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
|
1848 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1849 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1850 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1851 function Test_dirchanged_auto() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1852 CheckOption autochdir |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1853 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1854 call test_autochdir() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1855 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
|
1856 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
|
1857 set acd |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
1858 cd .. |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1859 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
|
1860 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
|
1861 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
|
1862 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
|
1863 set noacd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1864 bwipe! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1865 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
1866 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
|
1867 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1868 " 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
|
1869 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
|
1870 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
|
1871 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
|
1872 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
|
1873 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
|
1874 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1875 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
|
1876 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
|
1877 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
|
1878 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1879 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
|
1880 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
|
1881 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
|
1882 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1883 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
|
1884 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
|
1885 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
|
1886 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
|
1887 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1888 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
|
1889 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
|
1890 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
|
1891 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1892 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
|
1893 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
|
1894 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
|
1895 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1896 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
|
1897 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
|
1898 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
|
1899 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1900 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
|
1901 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
|
1902 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
|
1903 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1904 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
|
1905 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
|
1906 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
|
1907 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1908 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
|
1909 " 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
|
1910 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1911 " 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
|
1912 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
|
1913 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
|
1914 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
|
1915 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
|
1916 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
|
1917 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
|
1918 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
|
1919 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
1920 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
|
1921 endfunc |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1922 |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1923 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
|
1924 func SetLineOne() |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1925 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
|
1926 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
|
1927 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
|
1928 endif |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1929 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1930 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1931 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
|
1932 new |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1933 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
|
1934 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
|
1935 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
|
1936 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
|
1937 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
|
1938 undo |
14485
c71d65c3672f
patch 8.1.0256: using setline() in TextChangedI splits undo
Christian Brabandt <cb@256bit.org>
parents:
14463
diff
changeset
|
1939 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
|
1940 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
|
1941 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1942 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
|
1943 bwipe! |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1944 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1945 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1946 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
|
1947 CheckFeature terminal |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
1948 CheckNotGui |
19687
c3f506e24eab
patch 8.2.0400: not all tests using a terminal are in the list of flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
1949 " Starting a terminal to run Vim is always considered flaky. |
19691
60b5abfc4897
patch 8.2.0402: setting local instead of global flag
Bram Moolenaar <Bram@vim.org>
parents:
19687
diff
changeset
|
1950 let g:test_is_flaky = 1 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
1951 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1952 " 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
|
1953 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
|
1954 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
|
1955 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
|
1956 " 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
|
1957 " 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
|
1958 " 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
|
1959 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
|
1960 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
|
1961 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
|
1962 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
|
1963 endif |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1964 " 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
|
1965 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
|
1966 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
|
1967 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
|
1968 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
|
1969 |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1970 " clean up |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1971 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
|
1972 bwipe! |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
1973 endfunc |
15611
bfcd7ffe9ac2
patch 8.1.0813: FileChangedShell not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
1974 |
16217
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1975 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
|
1976 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
|
1977 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
|
1978 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
|
1979 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
|
1980 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
|
1981 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1982 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
|
1983 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1984 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
|
1985 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1986 " 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
|
1987 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
|
1988 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1989 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
|
1990 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
|
1991 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
|
1992 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1993 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
|
1994 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1995 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
|
1996 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1997 " 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
|
1998 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
|
1999 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2000 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
|
2001 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
|
2002 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
|
2003 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2004 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
|
2005 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2006 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
|
2007 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2008 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
|
2009 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2010 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
|
2011 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2012 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
|
2013 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
|
2014 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2015 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2016 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
|
2017 " 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
|
2018 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
|
2019 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
|
2020 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
|
2021 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
|
2022 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2023 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2024 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
|
2025 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
|
2026 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2027 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2028 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2029 " 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
|
2030 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
|
2031 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
|
2032 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2033 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
|
2034 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
|
2035 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2036 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2037 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
|
2038 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
|
2039 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2040 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2041 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2042 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
|
2043 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2044 |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2045 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
|
2046 new |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2047 let b:bufreadpre = 1 |
19752
0927df746554
patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents:
19699
diff
changeset
|
2048 call append(0, range(1000)) |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2049 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
|
2050 autocmd BufReadPre <buffer> :let b:bufreadpre += 1 |
19752
0927df746554
patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents:
19699
diff
changeset
|
2051 norm! 500gg |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2052 sp |
19752
0927df746554
patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents:
19699
diff
changeset
|
2053 norm! 1000gg |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2054 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
|
2055 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
|
2056 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
|
2057 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
|
2058 " 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
|
2059 " 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
|
2060 edit |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2061 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
|
2062 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
|
2063 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
|
2064 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
|
2065 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
|
2066 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
|
2067 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
|
2068 " 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
|
2069 " (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
|
2070 " 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
|
2071 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
|
2072 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
|
2073 " 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
|
2074 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
|
2075 " 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
|
2076 e |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2077 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
|
2078 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
|
2079 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
|
2080 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
|
2081 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
|
2082 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
|
2083 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
|
2084 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2085 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2086 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
|
2087 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
|
2088 endfunc |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2089 |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15611
diff
changeset
|
2090 " 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
|
2091 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2092 " 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
|
2093 " - 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
|
2094 " - 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
|
2095 " - 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
|
2096 " - 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
|
2097 " - 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
|
2098 " - 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
|
2099 " - 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
|
2100 " - FileReadPost decompress the file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2101 func Test_ReadWrite_Autocmds() |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2102 " Run this test only on Unix-like systems and if gzip is available |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
2103 CheckUnix |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
2104 CheckExecutable gzip |
16397
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2105 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2106 " 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
|
2107 let $GZIP = "" |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2108 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2109 " 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
|
2110 " 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
|
2111 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
|
2112 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2113 " 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
|
2114 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2115 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2116 au FileWritePre *.gz '[,']!gzip |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2117 au FileWritePost *.gz undo |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2118 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
|
2119 augroup END |
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 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2122 set bin |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2123 call append(0, [ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2124 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2125 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2126 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2127 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2128 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2129 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2130 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2131 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2132 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2133 \ ]) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2134 1,9write! Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2135 enew! | close |
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 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2138 " 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
|
2139 0read Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2140 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2141 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2142 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2143 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2144 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2145 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2146 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2147 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2148 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2149 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2150 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2151 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2152 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2153 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2154 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2155 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2156 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2157 " 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
|
2158 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2159 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2160 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
|
2161 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
|
2162 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
|
2163 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2164 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2165 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
|
2166 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
|
2167 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
|
2168 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
|
2169 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2170 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
|
2171 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
|
2172 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
|
2173 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2174 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2175 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2176 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2177 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2178 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2179 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2180 " 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
|
2181 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2182 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2183 " 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
|
2184 " afterwards |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2185 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
|
2186 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
|
2187 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
|
2188 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
|
2189 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2190 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2191 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
|
2192 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2193 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2194 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2195 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2196 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2197 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2198 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2199 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2200 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2201 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2202 \ ], getline(1, 9)) |
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 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
|
2205 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2206 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2207 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2208 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2209 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2210 " 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
|
2211 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
|
2212 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2213 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2214 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
|
2215 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
|
2216 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
|
2217 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
|
2218 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2219 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2220 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
|
2221 1,$!cat |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2222 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2223 \ 'linE 2 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2224 \ 'linE 3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2225 \ 'linE 4 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2226 \ 'linE 5 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2227 \ 'linE 6 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2228 \ 'linE 7 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2229 \ 'linE 8 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2230 \ 'linE 9 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2231 \ 'linE 10 AbcdefghijklmnopqrstuvwXyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2232 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2233 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2234 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2235 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2236 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2237 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2238 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2239 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2240 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2241 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2242 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2243 \ ], readfile('test.out')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2244 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2245 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2246 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2247 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2248 set shelltemp&vim |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2249 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2250 " 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
|
2251 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2252 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2253 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
|
2254 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
|
2255 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
|
2256 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2257 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2258 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2259 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
|
2260 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2261 \ 'Line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2262 \ 'Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2263 \ 'Line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2264 \ 'Line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2265 \ 'Line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2266 \ 'Line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2267 \ 'Line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2268 \ 'Line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2269 \ 'Line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2270 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2271 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2272 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2273 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2274 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2275 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2276 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2277 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2278 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2279 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2280 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2281 \ ], readfile('Xtestfile.gz')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2282 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2283 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2284 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2285 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2286 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2287 au! FileChangedShell |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2288 call delete('Xtestfile.gz') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2289 call delete('Xtest.c') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2290 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2291 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
|
2292 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2293 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
|
2294 new |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2295 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
|
2296 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
|
2297 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
|
2298 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
|
2299 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
|
2300 try |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2301 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
|
2302 catch |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2303 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
|
2304 endtry |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2305 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
|
2306 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
|
2307 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2308 bwipe! |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
2309 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
|
2310 endfunc |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2311 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2312 func Test_autocmd_SafeState() |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2313 CheckRunVimInTerminal |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2314 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2315 let lines =<< trim END |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2316 let g:safe = 0 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2317 let g:again = '' |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2318 au SafeState * let g:safe += 1 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2319 au SafeStateAgain * let g:again ..= 'x' |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2320 func CallTimer() |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2321 call timer_start(10, {id -> execute('let g:again ..= "t"')}) |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2322 endfunc |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2323 END |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2324 call writefile(lines, 'XSafeState') |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2325 let buf = RunVimInTerminal('-S XSafeState', #{rows: 6}) |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2326 |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
2327 " Sometimes we loop to handle a K_IGNORE, SafeState may be trigered once or |
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
2328 " more often. |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2329 call term_sendkeys(buf, ":echo g:safe\<CR>") |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
2330 call WaitForAssert({-> assert_match('^\d ', term_getline(buf, 6))}, 1000) |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2331 |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
2332 " SafeStateAgain should be invoked at least three times |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2333 call term_sendkeys(buf, ":echo g:again\<CR>") |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
2334 call WaitForAssert({-> assert_match('^xxx', term_getline(buf, 6))}, 1000) |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2335 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2336 call term_sendkeys(buf, ":let g:again = ''\<CR>:call CallTimer()\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
2337 call TermWait(buf, 50) |
18148
f7d9f8fe70be
patch 8.1.2069: test for SafeStateAgain may still fail
Bram Moolenaar <Bram@vim.org>
parents:
18146
diff
changeset
|
2338 call term_sendkeys(buf, ":\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
2339 call TermWait(buf, 50) |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2340 call term_sendkeys(buf, ":echo g:again\<CR>") |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2341 call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000) |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2342 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2343 call StopVimInTerminal(buf) |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2344 call delete('XSafeState') |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2345 endfunc |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2346 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2347 func Test_autocmd_CmdWinEnter() |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2348 CheckRunVimInTerminal |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2349 " There is not cmdwin switch, so |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2350 " test for cmdline_hist |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2351 " (both are available with small builds) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2352 CheckFeature cmdline_hist |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2353 let lines =<< trim END |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2354 let b:dummy_var = 'This is a dummy' |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2355 autocmd CmdWinEnter * quit |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2356 let winnr = winnr('$') |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2357 END |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2358 let filename='XCmdWinEnter' |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2359 call writefile(lines, filename) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2360 let buf = RunVimInTerminal('-S '.filename, #{rows: 6}) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2361 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2362 call term_sendkeys(buf, "q:") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19932
diff
changeset
|
2363 call TermWait(buf) |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2364 call term_sendkeys(buf, ":echo b:dummy_var\<cr>") |
19651
283c8bc6a8e2
patch 8.2.0382: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
19505
diff
changeset
|
2365 call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 2000) |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2366 call term_sendkeys(buf, ":echo &buftype\<cr>") |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2367 call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2368 call term_sendkeys(buf, ":echo winnr\<cr>") |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2369 call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2370 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2371 " clean up |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2372 call StopVimInTerminal(buf) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2373 call delete(filename) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
2374 endfunc |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2375 |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2376 func Test_autocmd_was_using_freed_memory() |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18619
diff
changeset
|
2377 CheckFeature quickfix |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18619
diff
changeset
|
2378 |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2379 pedit xx |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2380 n x |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2381 au WinEnter * quit |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2382 split |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2383 au! WinEnter |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
2384 endfunc |
18619
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2385 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2386 func Test_BufWrite_lockmarks() |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2387 edit! Xtest |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2388 call setline(1, ['a', 'b', 'c', 'd']) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2389 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2390 " :lockmarks preserves the marks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2391 call SetChangeMarks(2, 3) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2392 lockmarks write |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2393 call assert_equal([2, 3], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2394 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2395 " *WritePre autocmds get the correct line range, but lockmarks preserves the |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2396 " original values for the user |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2397 augroup lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2398 au! |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2399 au BufWritePre,FilterWritePre * call assert_equal([1, 4], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2400 au FileWritePre * call assert_equal([3, 4], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2401 augroup END |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2402 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2403 lockmarks write |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2404 call assert_equal([2, 3], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2405 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2406 if executable('cat') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2407 lockmarks %!cat |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2408 call assert_equal([2, 3], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2409 endif |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2410 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2411 lockmarks 3,4write Xtest2 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2412 call assert_equal([2, 3], [line("'["), line("']")]) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2413 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2414 au! lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2415 augroup! lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2416 call delete('Xtest') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2417 call delete('Xtest2') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
2418 endfunc |
19073
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2419 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2420 func Test_FileType_spell() |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2421 if !isdirectory('/tmp') |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2422 throw "Skipped: requires /tmp directory" |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2423 endif |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2424 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2425 " this was crashing with an invalid free() |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2426 setglobal spellfile=/tmp/en.utf-8.add |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2427 augroup crash |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2428 autocmd! |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2429 autocmd BufNewFile,BufReadPost crashfile setf somefiletype |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2430 autocmd BufNewFile,BufReadPost crashfile set ft=anotherfiletype |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2431 autocmd FileType anotherfiletype setlocal spell |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2432 augroup END |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2433 func! NoCrash() abort |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2434 edit /tmp/crashfile |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2435 endfunc |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2436 call NoCrash() |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2437 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2438 au! crash |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2439 setglobal spellfile= |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
2440 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19073
diff
changeset
|
2441 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2442 " Test closing a window or editing another buffer from a FileChangedRO handler |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2443 " in a readonly buffer |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2444 func Test_FileChangedRO_winclose() |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
2445 call test_override('ui_delay', 10) |
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
2446 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2447 augroup FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2448 au! |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2449 autocmd FileChangedRO * quit |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2450 augroup END |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2451 new |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2452 set readonly |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2453 call assert_fails('normal i', 'E788:') |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2454 close |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2455 augroup! FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2456 |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2457 augroup FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2458 au! |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2459 autocmd FileChangedRO * edit Xfile |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2460 augroup END |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2461 new |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2462 set readonly |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2463 call assert_fails('normal i', 'E788:') |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2464 close |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2465 augroup! FileChangedROTest |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
2466 call test_override('ALL', 0) |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2467 endfunc |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
2468 |
19489
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2469 func LogACmd() |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2470 call add(g:logged, line('$')) |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2471 endfunc |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2472 |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2473 func Test_TermChanged() |
19491
7803c6e82a87
patch 8.2.0303: TermChanged test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
19489
diff
changeset
|
2474 CheckNotGui |
7803c6e82a87
patch 8.2.0303: TermChanged test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
19489
diff
changeset
|
2475 |
19489
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2476 enew! |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2477 tabnew |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2478 call setline(1, ['a', 'b', 'c', 'd']) |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2479 $ |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2480 au TermChanged * call LogACmd() |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2481 let g:logged = [] |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2482 let term_save = &term |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2483 set term=xterm |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2484 call assert_equal([1, 4], g:logged) |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2485 |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2486 au! TermChanged |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2487 let &term = term_save |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2488 bwipe! |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2489 endfunc |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
2490 |
19699
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2491 " Test for FileReadCmd autocmd |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2492 func Test_autocmd_FileReadCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2493 func ReadFileCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2494 call append(line('$'), "v:cmdarg = " .. v:cmdarg) |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2495 endfunc |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2496 augroup FileReadCmdTest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2497 au! |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2498 au FileReadCmd Xtest call ReadFileCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2499 augroup END |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2500 |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2501 new |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2502 read ++bin Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2503 read ++nobin Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2504 read ++edit Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2505 read ++bad=keep Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2506 read ++bad=drop Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2507 read ++bad=- Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2508 read ++ff=unix Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2509 read ++ff=dos Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2510 read ++ff=mac Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2511 read ++enc=utf-8 Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2512 |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2513 call assert_equal(['', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2514 \ 'v:cmdarg = ++bin', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2515 \ 'v:cmdarg = ++nobin', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2516 \ 'v:cmdarg = ++edit', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2517 \ 'v:cmdarg = ++bad=keep', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2518 \ 'v:cmdarg = ++bad=drop', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2519 \ 'v:cmdarg = ++bad=-', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2520 \ 'v:cmdarg = ++ff=unix', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2521 \ 'v:cmdarg = ++ff=dos', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2522 \ 'v:cmdarg = ++ff=mac', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2523 \ 'v:cmdarg = ++enc=utf-8'], getline(1, '$')) |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2524 |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2525 close! |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2526 augroup FileReadCmdTest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2527 au! |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2528 augroup END |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2529 delfunc ReadFileCmd |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2530 endfunc |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
2531 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2532 " Test for passing invalid arguments to autocmd |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2533 func Test_autocmd_invalid_args() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2534 " Additional character after * for event |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2535 call assert_fails('autocmd *a Xfile set ff=unix', 'E215:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2536 augroup Test |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2537 augroup END |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2538 " Invalid autocmd event |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2539 call assert_fails('autocmd Bufabc Xfile set ft=vim', 'E216:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2540 " Invalid autocmd event in a autocmd group |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2541 call assert_fails('autocmd Test Bufabc Xfile set ft=vim', 'E216:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2542 augroup! Test |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2543 " Execute all autocmds |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2544 call assert_fails('doautocmd * BufEnter', 'E217:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2545 call assert_fails('augroup! x1a2b3', 'E367:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2546 call assert_fails('autocmd BufNew <buffer=999> pwd', 'E680:') |
22375
595ea7f099cd
patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
2547 call assert_fails('autocmd BufNew \) set ff=unix', 'E55:') |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2548 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2549 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2550 " Test for deep nesting of autocmds |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2551 func Test_autocmd_deep_nesting() |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2552 autocmd BufEnter Xfile doautocmd BufEnter Xfile |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2553 call assert_fails('doautocmd BufEnter Xfile', 'E218:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2554 autocmd! BufEnter Xfile |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2555 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
2556 |
20800
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2557 " Tests for SigUSR1 autocmd event, which is only available on posix systems. |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2558 func Test_autocmd_sigusr1() |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2559 CheckUnix |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
2560 CheckExecutable /bin/kill |
20800
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2561 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2562 let g:sigusr1_passed = 0 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2563 au SigUSR1 * let g:sigusr1_passed = 1 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2564 call system('/bin/kill -s usr1 ' . getpid()) |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2565 call WaitForAssert({-> assert_true(g:sigusr1_passed)}) |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2566 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2567 au! SigUSR1 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2568 unlet g:sigusr1_passed |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2569 endfunc |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2570 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2571 " Test for BufReadPre autocmd deleting the file |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2572 func Test_BufReadPre_delfile() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2573 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2574 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2575 autocmd BufReadPre Xfile call delete('Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2576 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2577 call writefile([], 'Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2578 call assert_fails('new Xfile', 'E200:') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2579 call assert_equal('Xfile', @%) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2580 call assert_equal(1, &readonly) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2581 call delete('Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2582 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2583 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2584 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2585 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2586 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2587 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2588 " Test for BufReadPre autocmd changing the current buffer |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2589 func Test_BufReadPre_changebuf() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2590 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2591 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2592 autocmd BufReadPre Xfile edit Xsomeotherfile |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2593 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2594 call writefile([], 'Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2595 call assert_fails('new Xfile', 'E201:') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2596 call assert_equal('Xsomeotherfile', @%) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2597 call assert_equal(1, &readonly) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2598 call delete('Xfile') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2599 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2600 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2601 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2602 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2603 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2604 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2605 " Test for BufWipeouti autocmd changing the current buffer when reading a file |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2606 " in an empty buffer with 'f' flag in 'cpo' |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2607 func Test_BufDelete_changebuf() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2608 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2609 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2610 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2611 autocmd BufWipeout * let bufnr = bufadd('somefile') | exe "b " .. bufnr |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2612 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2613 let save_cpo = &cpo |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2614 set cpo+=f |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21016
diff
changeset
|
2615 call assert_fails('r Xfile', ['E812:', 'E484:']) |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2616 call assert_equal('somefile', @%) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2617 let &cpo = save_cpo |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2618 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2619 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2620 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2621 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2622 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
2623 |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2624 " Test for the temporary internal window used to execute autocmds |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2625 func Test_autocmd_window() |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2626 %bw! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2627 edit one.txt |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2628 tabnew two.txt |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2629 let g:blist = [] |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2630 augroup aucmd_win_test1 |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2631 au! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2632 au BufEnter * call add(g:blist, [expand('<afile>'), |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2633 \ win_gettype(bufwinnr(expand('<afile>')))]) |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2634 augroup END |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2635 |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2636 doautoall BufEnter |
20889
27401f09fe9b
patch 8.2.0996: using "aucmdwin" in win_gettype() is not ideal
Bram Moolenaar <Bram@vim.org>
parents:
20879
diff
changeset
|
2637 call assert_equal([['one.txt', 'autocmd'], ['two.txt', '']], g:blist) |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2638 |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2639 augroup aucmd_win_test1 |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2640 au! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2641 augroup END |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2642 augroup! aucmd_win_test1 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2643 %bw! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2644 endfunc |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2645 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2646 " Test for trying to close the temporary window used for executing an autocmd |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2647 func Test_close_autocmd_window() |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2648 %bw! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2649 edit one.txt |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2650 tabnew two.txt |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2651 augroup aucmd_win_test2 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2652 au! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2653 au BufEnter * if expand('<afile>') == 'one.txt' | 1close | endif |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2654 augroup END |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2655 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2656 call assert_fails('doautoall BufEnter', 'E813:') |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2657 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2658 augroup aucmd_win_test2 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2659 au! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2660 augroup END |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
2661 augroup! aucmd_win_test2 |
21016
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2662 %bwipe! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2663 endfunc |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2664 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2665 " Test for trying to close the tab that has the temporary window for exeucing |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2666 " an autocmd. |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2667 func Test_close_autocmd_tab() |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2668 edit one.txt |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2669 tabnew two.txt |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2670 augroup aucmd_win_test |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2671 au! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2672 au BufEnter * if expand('<afile>') == 'one.txt' | tabfirst | tabonly | endif |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2673 augroup END |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2674 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2675 call assert_fails('doautoall BufEnter', 'E813:') |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2676 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2677 tabonly |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2678 augroup aucmd_win_test |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2679 au! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2680 augroup END |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2681 augroup! aucmd_win_test |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
2682 %bwipe! |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2683 endfunc |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
2684 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19073
diff
changeset
|
2685 " vim: shiftwidth=2 sts=2 expandtab |