Mercurial > vim
annotate src/testdir/test_autocmd.vim @ 34832:fa2084ba5138 v9.1.0285
patch 9.1.0285: Still problems with cursor position for CTRL-D/U
Commit: https://github.com/vim/vim/commit/78c51500f1bb16501521d721d52cb0982f5e70b6
Author: Luuk van Baal <luukvbaal@gmail.com>
Date: Tue Apr 9 21:30:19 2024 +0200
patch 9.1.0285: Still problems with cursor position for CTRL-D/U
Problem: Problems with cursor position when scrolling half a page.
Solution: Rework the cursor logic. (Luuk van Baal)
closes: #14455
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 09 Apr 2024 21:45:02 +0200 |
parents | f9b510d3ed32 |
children | f5ebd5ee3d53 |
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 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
6 source screendump.vim |
28167
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
7 import './vim9.vim' as v9 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
8 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15207
diff
changeset
|
9 func s:cleanup_buffers() abort |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
10 for bnr in range(1, bufnr('$')) |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
11 if bufloaded(bnr) && bufnr('%') != bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
12 execute 'bd! ' . bnr |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
13 endif |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
14 endfor |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
15 endfunc |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
16 |
8738
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 func Test_vim_did_enter() |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_false(v:vim_did_enter) |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " 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
|
21 " becomes one. |
e770986c855a
commit https://github.com/vim/vim/commit/1473551a4457d4920b235eeeb9f279e196ee7225
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 endfunc |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
23 |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
24 " 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
|
25 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
|
26 CheckRunVimInTerminal |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
27 call writefile(['one', 'two', 'three'], 'XoneTwoThree', 'D') |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
28 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
|
29 set updatetime=10 |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
30 au CursorHold * call writefile([line('.')], 'XCHoutput', 'a') |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
31 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
32 call writefile(before, 'XCHinit', 'D') |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
33 let buf = RunVimInTerminal('-S XCHinit XoneTwoThree', {}) |
21895
0ae284aaa8a2
patch 8.2.1497: CursorHold test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
34 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
|
35 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
|
36 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
|
37 call term_wait(buf) |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
38 call WaitForAssert({-> assert_equal(['1'], readfile('XCHoutput')[-1:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
39 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
|
40 call term_wait(buf) |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
41 call WaitForAssert({-> assert_equal(['1', '2'], readfile('XCHoutput')[-2:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
42 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
|
43 call term_wait(buf) |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
44 call WaitForAssert({-> assert_equal(['1', '2', '3'], readfile('XCHoutput')[-3:-1])}) |
21419
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
45 call StopVimInTerminal(buf) |
e4449560f18d
patch 8.2.1260: there is no good test for CursorHold
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
46 |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
47 call delete('XCHoutput') |
21419
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() |
32250
b1ea62e14b3c
patch 9.0.1456: shortmess test depends on order of test execution
Bram Moolenaar <Bram@vim.org>
parents:
31934
diff
changeset
|
57 " depends on timing |
b1ea62e14b3c
patch 9.0.1456: shortmess test depends on order of test execution
Bram Moolenaar <Bram@vim.org>
parents:
31934
diff
changeset
|
58 let g:test_is_flaky = 1 |
b1ea62e14b3c
patch 9.0.1456: shortmess test depends on order of test execution
Bram Moolenaar <Bram@vim.org>
parents:
31934
diff
changeset
|
59 |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
60 " Need to move the cursor. |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
61 call feedkeys("ggG", "xt") |
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
62 |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
63 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
64 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
65 set updatetime=20 |
23847
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
66 call timer_start(200, 'ExitInsertMode') |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
67 call feedkeys('a', 'x!') |
31073
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
68 sleep 30m |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
69 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
|
70 unlet g:triggered |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
71 au! CursorHoldI |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
72 set updatetime& |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
73 endfunc |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
74 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
75 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
|
76 CheckFeature job |
15659
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
77 " 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
|
78 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
|
79 |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
80 " 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
|
81 " CursorHoldI event. |
8513d9864f7e
patch 8.1.0837: timer interrupting cursorhold and mapping not tested
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
82 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
|
83 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
|
84 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
|
85 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
|
86 \ {'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
|
87 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
|
88 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
|
89 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
90 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
91 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
92 endfunc |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
93 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
94 func Test_cursorhold_insert_ctrl_x() |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
95 let g:triggered = 0 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
96 au CursorHoldI * let g:triggered += 1 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
97 set updatetime=20 |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
98 call timer_start(100, 'ExitInsertMode') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
99 " 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
|
100 call feedkeys("a\<C-X>", 'x!') |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
101 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
|
102 unlet g:triggered |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
103 au! CursorHoldI |
10141
b67088aae933
commit https://github.com/vim/vim/commit/aeac9006d5d14910f214f09df52c026a5936e737
Christian Brabandt <cb@256bit.org>
parents:
10114
diff
changeset
|
104 set updatetime& |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
105 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
|
106 |
25866
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
107 func Test_cursorhold_insert_ctrl_g_U() |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
108 au CursorHoldI * : |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
109 set updatetime=20 |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
110 new |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
111 call timer_start(100, { -> feedkeys("\<Left>foo\<Esc>", 't') }) |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
112 call feedkeys("i()\<C-g>U", 'tx!') |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
113 sleep 200m |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
114 call assert_equal('(foo)', getline(1)) |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
115 undo |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
116 call assert_equal('', getline(1)) |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
117 |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
118 bwipe! |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
119 au! CursorHoldI |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
120 set updatetime& |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
121 endfunc |
45a8b2b2f652
patch 8.2.3467: CursorHoldI event interferes with "CTRL-G U"
Bram Moolenaar <Bram@vim.org>
parents:
25838
diff
changeset
|
122 |
16646
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 augroup END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
129 call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline', 'D') |
16646
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
136 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
|
137 au! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
138 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
|
139 bwipe! |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
140 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
|
141 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
|
142 endfunc |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
143 |
ea0f9a2df961
patch 8.1.1325: cannot build with +eval but without +channel and +timers
Bram Moolenaar <Bram@vim.org>
parents:
16617
diff
changeset
|
144 endif "has('timers') |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
145 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
146 func Test_bufunload() |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
147 augroup test_bufunload_group |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
148 autocmd! |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 augroup END |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
153 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
154 let s:li = [] |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
155 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
156 setlocal bufhidden= |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
157 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
158 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
|
159 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
160 let s:li = [] |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
161 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
162 setlocal bufhidden=delete |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
163 bunload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
164 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
|
165 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
166 let s:li = [] |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
167 new |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
168 setlocal bufhidden=unload |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
169 bwipeout |
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
170 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
|
171 |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
172 au! test_bufunload_group |
9106
97a9538c37ff
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Christian Brabandt <cb@256bit.org>
parents:
8947
diff
changeset
|
173 augroup! test_bufunload_group |
8947
c07caeb90a35
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Christian Brabandt <cb@256bit.org>
parents:
8738
diff
changeset
|
174 endfunc |
9450
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
175 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
176 " 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
|
177 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
|
178 tabedit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
179 tabfirst |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
180 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
181 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
|
182 autocmd! |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
183 autocmd BufUnload <buffer> tabnext |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
184 augroup END |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
185 |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
186 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
187 call assert_equal(2, tabpagenr('$')) |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
188 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
189 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
|
190 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
|
191 tablast |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
192 quit |
073aebdba121
commit https://github.com/vim/vim/commit/30445cb6e94698d212ba866ef3e4022ac625540a
Christian Brabandt <cb@256bit.org>
parents:
9106
diff
changeset
|
193 endfunc |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
194 |
23760
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
195 func Test_argdelete_in_next() |
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
196 au BufNew,BufEnter,BufLeave,BufWinEnter * argdel |
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
197 call assert_fails('next a b', 'E1156:') |
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
198 au! BufNew,BufEnter,BufLeave,BufWinEnter * |
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
199 endfunc |
bb2afcad503b
patch 8.2.2421: double free when using autocommand with "argdel"
Bram Moolenaar <Bram@vim.org>
parents:
23758
diff
changeset
|
200 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
201 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
|
202 tabedit |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
203 augroup sample |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
204 autocmd! |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
205 autocmd BufWinLeave <buffer> tabfirst |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
206 augroup END |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
207 call setline(1, ['a', 'b', 'c']) |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
208 edit! a.txt |
10151
0be17a56e65f
commit https://github.com/vim/vim/commit/f18c4dbbe545757ce93563b25380e6f010340b4e
Christian Brabandt <cb@256bit.org>
parents:
10141
diff
changeset
|
209 tabclose |
10114
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
210 endfunc |
aa2219afd1c2
commit https://github.com/vim/vim/commit/f9e687e0681a250e1549ab27b6c7ef2c500395e3
Christian Brabandt <cb@256bit.org>
parents:
10106
diff
changeset
|
211 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
212 " 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
|
213 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
|
214 split aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
215 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
216 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
217 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
218 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
219 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
|
220 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
221 |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22576
diff
changeset
|
222 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
|
223 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
224 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
225 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
226 bwipe! aa.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
227 bwipe! bb.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
228 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
229 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
230 " 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
|
231 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
|
232 setlocal buftype=nowrite |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
233 let lastbuf = bufnr('$') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
234 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
235 augroup test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
236 autocmd! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
237 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
|
238 augroup END |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
239 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
240 normal! i1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
241 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
|
242 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
243 autocmd! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
244 augroup! test_autocmd_bufunload |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
245 bwipe! a.txt |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
246 endfunc |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
247 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
248 func Test_autocmd_dummy_wipeout() |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
249 " prepare files |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
250 call writefile([''], 'Xdummywipetest1.txt', 'D') |
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
251 call writefile([''], 'Xdummywipetest2.txt', 'D') |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
252 augroup test_bufunload_group |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
253 autocmd! |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
254 autocmd BufUnload * call add(s:li, "bufunload") |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
255 autocmd BufDelete * call add(s:li, "bufdelete") |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
256 autocmd BufWipeout * call add(s:li, "bufwipeout") |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
257 augroup END |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
258 |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
259 let s:li = [] |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
260 split Xdummywipetest1.txt |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
261 silent! vimgrep /notmatched/ Xdummywipetest* |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
262 call assert_equal(["bufunload", "bufwipeout"], s:li) |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
263 |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
264 bwipeout |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
265 au! test_bufunload_group |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
266 augroup! test_bufunload_group |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
267 endfunc |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
268 |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
269 func Test_win_tab_autocmd() |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
270 let g:record = [] |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
271 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
272 augroup testing |
34221
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
273 au WinNewPre * call add(g:record, 'WinNewPre') |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
274 au WinNew * call add(g:record, 'WinNew') |
26117
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
275 au WinClosed * call add(g:record, 'WinClosed') |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31764
diff
changeset
|
276 au WinEnter * call add(g:record, 'WinEnter') |
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31764
diff
changeset
|
277 au WinLeave * call add(g:record, 'WinLeave') |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
278 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
|
279 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
|
280 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
|
281 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
|
282 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
283 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
284 split |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
285 tabnew |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
286 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
287 close |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
288 |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
289 call assert_equal([ |
34221
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
290 \ 'WinNewPre', 'WinLeave', 'WinNew', 'WinEnter', |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
291 \ 'WinLeave', 'TabLeave', 'WinNewPre', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter', |
26117
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
292 \ 'WinLeave', 'TabLeave', 'WinClosed', 'TabClosed', 'WinEnter', 'TabEnter', |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
293 \ 'WinLeave', 'WinClosed', 'WinEnter' |
9599
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
294 \ ], g:record) |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
295 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
296 let g:record = [] |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
297 tabnew somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
298 tabnext |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
299 bwipe somefile |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
300 |
42a8a81decdf
commit https://github.com/vim/vim/commit/12c11d553053f5a9eae9eb3c518279b12fa928c2
Christian Brabandt <cb@256bit.org>
parents:
9595
diff
changeset
|
301 call assert_equal([ |
34221
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
302 \ 'WinLeave', 'TabLeave', 'WinNewPre', 'WinNew', 'WinEnter', 'TabNew', 'TabEnter', |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
303 \ 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', |
26117
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
304 \ 'WinClosed', 'TabClosed' |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
305 \ ], g:record) |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
306 |
34221
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
307 let g:record = [] |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
308 copen |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
309 help |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
310 tabnext |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
311 vnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
312 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
313 call assert_equal([ |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
314 \ 'WinNewPre', 'WinLeave', 'WinNew', 'WinEnter', |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
315 \ 'WinNewPre', 'WinLeave', 'WinNew', 'WinEnter', |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
316 \ 'WinNewPre', 'WinLeave', 'WinNew', 'WinEnter' |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
317 \ ], g:record) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
318 |
9595
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
319 augroup testing |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
320 au! |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
321 augroup END |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
322 unlet g:record |
0190d5de215f
commit https://github.com/vim/vim/commit/c917da4b3e8801a255dbefea8e4ed19c1c716dd8
Christian Brabandt <cb@256bit.org>
parents:
9450
diff
changeset
|
323 endfunc |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
324 |
34221
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
325 func Test_WinNewPre() |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
326 " Test that the old window layout can be accessed before a new window is created. |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
327 let g:layouts_pre = [] |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
328 let g:layouts_post = [] |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
329 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
330 au WinNewPre * call add(g:layouts_pre, winlayout()) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
331 au WinNew * call add(g:layouts_post, winlayout()) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
332 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
333 split |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
334 call assert_notequal(g:layouts_pre[0], g:layouts_post[0]) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
335 split |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
336 call assert_equal(g:layouts_pre[1], g:layouts_post[0]) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
337 call assert_notequal(g:layouts_pre[1], g:layouts_post[1]) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
338 tabnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
339 call assert_notequal(g:layouts_pre[2], g:layouts_post[1]) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
340 call assert_notequal(g:layouts_pre[2], g:layouts_post[2]) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
341 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
342 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
343 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
344 unlet g:layouts_pre |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
345 unlet g:layouts_post |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
346 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
347 " Test modifying window layout during WinNewPre throws. |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
348 let g:caught = 0 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
349 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
350 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
351 au WinNewPre * split |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
352 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
353 try |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
354 vnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
355 catch |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
356 let g:caught += 1 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
357 endtry |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
358 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
359 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
360 au WinNewPre * tabnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
361 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
362 try |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
363 vnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
364 catch |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
365 let g:caught += 1 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
366 endtry |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
367 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
368 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
369 au WinNewPre * close |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
370 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
371 try |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
372 vnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
373 catch |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
374 let g:caught += 1 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
375 endtry |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
376 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
377 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
378 au WinNewPre * tabclose |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
379 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
380 try |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
381 vnew |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
382 catch |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
383 let g:caught += 1 |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
384 endtry |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
385 call assert_equal(4, g:caught) |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
386 augroup testing |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
387 au! |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
388 augroup END |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
389 unlet g:caught |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
390 endfunc |
f2d904d44ebd
patch 9.1.0059: No event triggered before creating a window
Christian Brabandt <cb@256bit.org>
parents:
33848
diff
changeset
|
391 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
392 func Test_WinResized() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
393 CheckRunVimInTerminal |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
394 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
395 let lines =<< trim END |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
396 set scrolloff=0 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
397 call setline(1, ['111', '222']) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
398 vnew |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
399 call setline(1, ['aaa', 'bbb']) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
400 new |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
401 call setline(1, ['foo', 'bar']) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
402 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
403 let g:resized = 0 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
404 au WinResized * let g:resized += 1 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
405 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
406 func WriteResizedEvent() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
407 call writefile([json_encode(v:event)], 'XresizeEvent') |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
408 endfunc |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
409 au WinResized * call WriteResizedEvent() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
410 END |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
411 call writefile(lines, 'Xtest_winresized', 'D') |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
412 let buf = RunVimInTerminal('-S Xtest_winresized', {'rows': 10}) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
413 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
414 " redraw now to avoid a redraw after the :echo command |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
415 call term_sendkeys(buf, ":redraw!\<CR>") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
416 call TermWait(buf) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
417 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
418 call term_sendkeys(buf, ":echo g:resized\<CR>") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
419 call WaitForAssert({-> assert_match('^0$', term_getline(buf, 10))}, 1000) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
420 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
421 " increase window height, two windows will be reported |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
422 call term_sendkeys(buf, "\<C-W>+") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
423 call TermWait(buf) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
424 call term_sendkeys(buf, ":echo g:resized\<CR>") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
425 call WaitForAssert({-> assert_match('^1$', term_getline(buf, 10))}, 1000) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
426 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
427 let event = readfile('XresizeEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
428 call assert_equal({ |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
429 \ 'windows': [1002, 1001], |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
430 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
431 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
432 " increase window width, three windows will be reported |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
433 call term_sendkeys(buf, "\<C-W>>") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
434 call TermWait(buf) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
435 call term_sendkeys(buf, ":echo g:resized\<CR>") |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
436 call WaitForAssert({-> assert_match('^2$', term_getline(buf, 10))}, 1000) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
437 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
438 let event = readfile('XresizeEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
439 call assert_equal({ |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
440 \ 'windows': [1002, 1001, 1000], |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
441 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
442 |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
443 call delete('XresizeEvent') |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
444 call StopVimInTerminal(buf) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
445 endfunc |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
446 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
447 func Test_WinScrolled() |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
448 CheckRunVimInTerminal |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
449 |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
450 let lines =<< trim END |
28429
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
451 set nowrap scrolloff=0 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
452 for ii in range(1, 18) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
453 call setline(ii, repeat(nr2char(96 + ii), ii * 2)) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
454 endfor |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
455 let win_id = win_getid() |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
456 let g:matched = v:false |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
457 func WriteScrollEvent() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
458 call writefile([json_encode(v:event)], 'XscrollEvent') |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
459 endfunc |
28429
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
460 execute 'au WinScrolled' win_id 'let g:matched = v:true' |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
461 let g:scrolled = 0 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
462 au WinScrolled * let g:scrolled += 1 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
463 au WinScrolled * let g:amatch = str2nr(expand('<amatch>')) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
464 au WinScrolled * let g:afile = str2nr(expand('<afile>')) |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
465 au WinScrolled * call WriteScrollEvent() |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
466 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
467 call writefile(lines, 'Xtest_winscrolled', 'D') |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
468 let buf = RunVimInTerminal('-S Xtest_winscrolled', {'rows': 6}) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
469 |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
470 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
471 call WaitForAssert({-> assert_match('^0 ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
472 |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
473 " Scroll left/right in Normal mode. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
474 call term_sendkeys(buf, "zlzh:echo g:scrolled\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
475 call WaitForAssert({-> assert_match('^2 ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
476 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
477 let event = readfile('XscrollEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
478 call assert_equal({ |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
479 \ 'all': {'leftcol': 1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
480 \ '1000': {'leftcol': -1, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0} |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
481 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
482 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
483 " Scroll up/down in Normal mode. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
484 call term_sendkeys(buf, "\<c-e>\<c-y>:echo g:scrolled\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
485 call WaitForAssert({-> assert_match('^4 ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
486 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
487 let event = readfile('XscrollEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
488 call assert_equal({ |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
489 \ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
490 \ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0} |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
491 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
492 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
493 " Scroll up/down in Insert mode. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
494 call term_sendkeys(buf, "Mi\<c-x>\<c-e>\<Esc>i\<c-x>\<c-y>\<Esc>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
495 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
496 call WaitForAssert({-> assert_match('^6 ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
497 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
498 let event = readfile('XscrollEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
499 call assert_equal({ |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
500 \ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
501 \ '1000': {'leftcol': 0, 'topline': -1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0} |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
502 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
503 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
504 " Scroll the window horizontally to focus the last letter of the third line |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
505 " containing only six characters. Moving to the previous and shorter lines |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
506 " should trigger another autocommand as Vim has to make them visible. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
507 call term_sendkeys(buf, "5zl2k") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
508 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
509 call WaitForAssert({-> assert_match('^8 ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
510 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
511 let event = readfile('XscrollEvent')[0]->json_decode() |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
512 call assert_equal({ |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
513 \ 'all': {'leftcol': 5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
514 \ '1000': {'leftcol': -5, 'topline': 0, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0} |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
515 \ }, event) |
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
516 |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
517 " Ensure the command was triggered for the specified window ID. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
518 call term_sendkeys(buf, ":echo g:matched\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
519 call WaitForAssert({-> assert_match('^v:true ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
520 |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
521 " Ensure the expansion of <amatch> and <afile> matches the window ID. |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
522 call term_sendkeys(buf, ":echo g:amatch == win_id && g:afile == win_id\<CR>") |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
523 call WaitForAssert({-> assert_match('^v:true ', term_getline(buf, 6))}, 1000) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
524 |
31166
a86ee6c0309e
patch 9.0.0917: the WinScrolled autocommand event is not enough
Bram Moolenaar <Bram@vim.org>
parents:
31162
diff
changeset
|
525 call delete('XscrollEvent') |
28375
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
526 call StopVimInTerminal(buf) |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
527 endfunc |
e466fdbe0699
patch 8.2.4713: plugins cannot track text scrolling
Bram Moolenaar <Bram@vim.org>
parents:
28361
diff
changeset
|
528 |
28558
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
529 func Test_WinScrolled_mouse() |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
530 CheckRunVimInTerminal |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
531 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
532 let lines =<< trim END |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
533 set nowrap scrolloff=0 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
534 set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard= |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
535 call setline(1, ['foo']->repeat(32)) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
536 split |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
537 let g:scrolled = 0 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
538 au WinScrolled * let g:scrolled += 1 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
539 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
540 call writefile(lines, 'Xtest_winscrolled_mouse', 'D') |
28558
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
541 let buf = RunVimInTerminal('-S Xtest_winscrolled_mouse', {'rows': 10}) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
542 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
543 " With the upper split focused, send a scroll-down event to the unfocused one. |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
544 call test_setmouse(7, 1) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
545 call term_sendkeys(buf, "\<ScrollWheelDown>") |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
546 call TermWait(buf) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
547 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
548 call WaitForAssert({-> assert_match('^1', term_getline(buf, 10))}, 1000) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
549 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
550 " Again, but this time while we're in insert mode. |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
551 call term_sendkeys(buf, "i\<ScrollWheelDown>\<Esc>") |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
552 call TermWait(buf) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
553 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
554 call WaitForAssert({-> assert_match('^2', term_getline(buf, 10))}, 1000) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
555 |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
556 call StopVimInTerminal(buf) |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
557 endfunc |
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
558 |
28429
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
559 func Test_WinScrolled_close_curwin() |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
560 CheckRunVimInTerminal |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
561 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
562 let lines =<< trim END |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
563 set nowrap scrolloff=0 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
564 call setline(1, ['aaa', 'bbb']) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
565 vsplit |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
566 au WinScrolled * close |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
567 au VimLeave * call writefile(['123456'], 'Xtestout') |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
568 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
569 call writefile(lines, 'Xtest_winscrolled_close_curwin', 'D') |
28429
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
570 let buf = RunVimInTerminal('-S Xtest_winscrolled_close_curwin', {'rows': 6}) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
571 |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
572 " This was using freed memory |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
573 call term_sendkeys(buf, "\<C-E>") |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
574 call TermWait(buf) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
575 call StopVimInTerminal(buf) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
576 |
31158
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
577 " check the startup script finished to the end |
28429
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
578 call assert_equal(['123456'], readfile('Xtestout')) |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
579 call delete('Xtestout') |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
580 endfunc |
aa9720c76412
patch 8.2.4739: accessing freed memory after WinScrolled autocmd event
Bram Moolenaar <Bram@vim.org>
parents:
28407
diff
changeset
|
581 |
31158
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
582 func Test_WinScrolled_once_only() |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
583 CheckRunVimInTerminal |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
584 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
585 let lines =<< trim END |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
586 set cmdheight=2 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
587 call setline(1, ['aaa', 'bbb']) |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
588 let trigger_count = 0 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
589 func ShowInfo(id) |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
590 echo g:trigger_count g:winid winlayout() |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
591 endfunc |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
592 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
593 vsplit |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
594 split |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
595 " use a timer to show the info after a redraw |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
596 au WinScrolled * let trigger_count += 1 | let winid = expand('<amatch>') | call timer_start(100, 'ShowInfo') |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
597 wincmd j |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
598 wincmd l |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
599 END |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
600 call writefile(lines, 'Xtest_winscrolled_once', 'D') |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
601 let buf = RunVimInTerminal('-S Xtest_winscrolled_once', #{rows: 10, cols: 60, statusoff: 2}) |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
602 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
603 call term_sendkeys(buf, "\<C-E>") |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
604 call VerifyScreenDump(buf, 'Test_winscrolled_once_only_1', {}) |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
605 |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
606 call StopVimInTerminal(buf) |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
607 endfunc |
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
608 |
31162
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
609 " Check that WinScrolled is not triggered immediately when defined and there |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
610 " are split windows. |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
611 func Test_WinScrolled_not_when_defined() |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
612 CheckRunVimInTerminal |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
613 |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
614 let lines =<< trim END |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
615 call setline(1, ['aaa', 'bbb']) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
616 echo 'nothing happened' |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
617 func ShowTriggered(id) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
618 echo 'triggered' |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
619 endfunc |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
620 END |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
621 call writefile(lines, 'Xtest_winscrolled_not', 'D') |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
622 let buf = RunVimInTerminal('-S Xtest_winscrolled_not', #{rows: 10, cols: 60, statusoff: 2}) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
623 call term_sendkeys(buf, ":split\<CR>") |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
624 call TermWait(buf) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
625 " use a timer to show the message after redrawing |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
626 call term_sendkeys(buf, ":au WinScrolled * call timer_start(100, 'ShowTriggered')\<CR>") |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
627 call VerifyScreenDump(buf, 'Test_winscrolled_not_when_defined_1', {}) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
628 |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
629 call term_sendkeys(buf, "\<C-E>") |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
630 call VerifyScreenDump(buf, 'Test_winscrolled_not_when_defined_2', {}) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
631 |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
632 call StopVimInTerminal(buf) |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
633 endfunc |
981f7bc781bb
patch 9.0.0915: WinScrolled may trigger immediately when defined
Bram Moolenaar <Bram@vim.org>
parents:
31158
diff
changeset
|
634 |
29932
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
635 func Test_WinScrolled_long_wrapped() |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
636 CheckRunVimInTerminal |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
637 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
638 let lines =<< trim END |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
639 set scrolloff=0 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
640 let height = winheight(0) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
641 let width = winwidth(0) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
642 let g:scrolled = 0 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
643 au WinScrolled * let g:scrolled += 1 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
644 call setline(1, repeat('foo', height * width)) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
645 call cursor(1, height * width) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
646 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
647 call writefile(lines, 'Xtest_winscrolled_long_wrapped', 'D') |
29932
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
648 let buf = RunVimInTerminal('-S Xtest_winscrolled_long_wrapped', {'rows': 6}) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
649 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
650 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
651 call WaitForAssert({-> assert_match('^0 ', term_getline(buf, 6))}, 1000) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
652 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
653 call term_sendkeys(buf, 'gj') |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
654 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
655 call WaitForAssert({-> assert_match('^1 ', term_getline(buf, 6))}, 1000) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
656 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
657 call term_sendkeys(buf, '0') |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
658 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
659 call WaitForAssert({-> assert_match('^2 ', term_getline(buf, 6))}, 1000) |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
660 |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
661 call term_sendkeys(buf, '$') |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
662 call term_sendkeys(buf, ":echo g:scrolled\<CR>") |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
663 call WaitForAssert({-> assert_match('^3 ', term_getline(buf, 6))}, 1000) |
31353
49bd0e97549d
patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
664 |
49bd0e97549d
patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
665 call StopVimInTerminal(buf) |
29932
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
666 endfunc |
27cb0eed6aef
patch 9.0.0304: WinScrolled is not triggered when only skipcol changes
Bram Moolenaar <Bram@vim.org>
parents:
29875
diff
changeset
|
667 |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
668 func Test_WinScrolled_diff() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
669 CheckRunVimInTerminal |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
670 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
671 let lines =<< trim END |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
672 set diffopt+=foldcolumn:0 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
673 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
674 vnew |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
675 call setline(1, ['d', 'e', 'f', 'g', 'h', 'i']) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
676 windo diffthis |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
677 func WriteScrollEvent() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
678 call writefile([json_encode(v:event)], 'XscrollEvent') |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
679 endfunc |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
680 au WinScrolled * call WriteScrollEvent() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
681 END |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
682 call writefile(lines, 'Xtest_winscrolled_diff', 'D') |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
683 let buf = RunVimInTerminal('-S Xtest_winscrolled_diff', {'rows': 8}) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
684 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
685 call term_sendkeys(buf, "\<C-E>") |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
686 call WaitForAssert({-> assert_match('^d', term_getline(buf, 3))}, 1000) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
687 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
688 let event = readfile('XscrollEvent')[0]->json_decode() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
689 call assert_equal({ |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
690 \ 'all': {'leftcol': 0, 'topline': 1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
691 \ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
692 \ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -1, 'width': 0, 'height': 0, 'skipcol': 0} |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
693 \ }, event) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
694 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
695 call term_sendkeys(buf, "2\<C-E>") |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
696 call WaitForAssert({-> assert_match('^f', term_getline(buf, 3))}, 1000) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
697 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
698 let event = readfile('XscrollEvent')[0]->json_decode() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
699 call assert_equal({ |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
700 \ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 2, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
701 \ '1000': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
702 \ '1001': {'leftcol': 0, 'topline': 0, 'topfill': -2, 'width': 0, 'height': 0, 'skipcol': 0} |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
703 \ }, event) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
704 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
705 call term_sendkeys(buf, "\<C-E>") |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
706 call WaitForAssert({-> assert_match('^g', term_getline(buf, 3))}, 1000) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
707 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
708 let event = readfile('XscrollEvent')[0]->json_decode() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
709 call assert_equal({ |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
710 \ 'all': {'leftcol': 0, 'topline': 2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
711 \ '1000': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
712 \ '1001': {'leftcol': 0, 'topline': 1, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0} |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
713 \ }, event) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
714 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
715 call term_sendkeys(buf, "2\<C-Y>") |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
716 call WaitForAssert({-> assert_match('^e', term_getline(buf, 3))}, 1000) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
717 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
718 let event = readfile('XscrollEvent')[0]->json_decode() |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
719 call assert_equal({ |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
720 \ 'all': {'leftcol': 0, 'topline': 3, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
721 \ '1000': {'leftcol': 0, 'topline': -2, 'topfill': 0, 'width': 0, 'height': 0, 'skipcol': 0}, |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
722 \ '1001': {'leftcol': 0, 'topline': -1, 'topfill': 1, 'width': 0, 'height': 0, 'skipcol': 0} |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
723 \ }, event) |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
724 |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
725 call StopVimInTerminal(buf) |
31764
6969fac11aaa
patch 9.0.1214: file left behind after running tests
Bram Moolenaar <Bram@vim.org>
parents:
31571
diff
changeset
|
726 call delete('XscrollEvent') |
31384
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
727 endfunc |
992bfd3aee3f
patch 9.0.1025: WinScrolled is not triggered when filler lines change
Bram Moolenaar <Bram@vim.org>
parents:
31353
diff
changeset
|
728 |
26117
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
729 func Test_WinClosed() |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
730 " Test that the pattern is matched against the closed window's ID, and both |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
731 " <amatch> and <afile> are set to it. |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
732 new |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
733 let winid = win_getid() |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
734 let g:matched = v:false |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
735 augroup test-WinClosed |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
736 autocmd! |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
737 execute 'autocmd WinClosed' winid 'let g:matched = v:true' |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
738 autocmd WinClosed * let g:amatch = str2nr(expand('<amatch>')) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
739 autocmd WinClosed * let g:afile = str2nr(expand('<afile>')) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
740 augroup END |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
741 close |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
742 call assert_true(g:matched) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
743 call assert_equal(winid, g:amatch) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
744 call assert_equal(winid, g:afile) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
745 |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
746 " Test that WinClosed is non-recursive. |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
747 new |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
748 new |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
749 call assert_equal(3, winnr('$')) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
750 let g:triggered = 0 |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
751 augroup test-WinClosed |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
752 autocmd! |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
753 autocmd WinClosed * let g:triggered += 1 |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
754 autocmd WinClosed * 2 wincmd c |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
755 augroup END |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
756 close |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
757 call assert_equal(1, winnr('$')) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
758 call assert_equal(1, g:triggered) |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
759 |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
760 autocmd! test-WinClosed |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
761 augroup! test-WinClosed |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
762 unlet g:matched |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
763 unlet g:amatch |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
764 unlet g:afile |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
765 unlet g:triggered |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
766 endfunc |
d4d9c7c55a5f
patch 8.2.3591: no event is triggered when closing a window
Bram Moolenaar <Bram@vim.org>
parents:
26030
diff
changeset
|
767 |
28349
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
768 func Test_WinClosed_throws() |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
769 vnew |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
770 let bnr = bufnr() |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
771 call assert_equal(1, bufloaded(bnr)) |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
772 augroup test-WinClosed |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
773 autocmd WinClosed * throw 'foo' |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
774 augroup END |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
775 try |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
776 close |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
777 catch /.*/ |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
778 endtry |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
779 call assert_equal(0, bufloaded(bnr)) |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
780 |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
781 autocmd! test-WinClosed |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
782 augroup! test-WinClosed |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
783 endfunc |
d3a1fc6b4da6
patch 8.2.4700: buffer remains active if WinClosed event throws an exception
Bram Moolenaar <Bram@vim.org>
parents:
28211
diff
changeset
|
784 |
28361
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
785 func Test_WinClosed_throws_with_tabs() |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
786 tabnew |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
787 let bnr = bufnr() |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
788 call assert_equal(1, bufloaded(bnr)) |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
789 augroup test-WinClosed |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
790 autocmd WinClosed * throw 'foo' |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
791 augroup END |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
792 try |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
793 close |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
794 catch /.*/ |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
795 endtry |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
796 call assert_equal(0, bufloaded(bnr)) |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
797 |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
798 autocmd! test-WinClosed |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
799 augroup! test-WinClosed |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
800 endfunc |
68c36f734b10
patch 8.2.4706: buffer remains active with WinClosed and tabpages
Bram Moolenaar <Bram@vim.org>
parents:
28349
diff
changeset
|
801 |
30429
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
802 " This used to trigger WinClosed twice for the same window, and the window's |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
803 " buffer was NULL in the second autocommand. |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
804 func Test_WinClosed_switch_tab() |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
805 edit Xa |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
806 split Xb |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
807 split Xc |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
808 tab split |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
809 new |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
810 augroup test-WinClosed |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
811 autocmd WinClosed * tabprev | bwipe! |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
812 augroup END |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
813 close |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
814 " Check that the tabline has been fully removed |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
815 call assert_equal([1, 1], win_screenpos(0)) |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
816 |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
817 autocmd! test-WinClosed |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
818 augroup! test-WinClosed |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
819 %bwipe! |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
820 endfunc |
69ff2bd737a9
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
821 |
34506
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
822 " This used to trigger WinClosed twice for the same window, and the window's |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
823 " buffer was NULL in the second autocommand. |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
824 func Test_WinClosed_BufUnload_close_other() |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
825 tabnew |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
826 let g:tab = tabpagenr() |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
827 let g:buf = bufnr() |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
828 new |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
829 setlocal bufhidden=wipe |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
830 augroup test-WinClosed |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
831 autocmd BufUnload * ++once exe g:buf .. 'bwipe!' |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
832 autocmd WinClosed * call tabpagebuflist(g:tab) |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
833 augroup END |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
834 close |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
835 |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
836 unlet g:tab |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
837 unlet g:buf |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
838 autocmd! test-WinClosed |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
839 augroup! test-WinClosed |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
840 %bwipe! |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
841 endfunc |
56ba5ea924a7
patch 9.1.0159: Crash in WinClosed after BufUnload closes other windows
Christian Brabandt <cb@256bit.org>
parents:
34454
diff
changeset
|
842 |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
843 func s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
844 augroup vimBarTest |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
845 au BufReadCmd * echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
846 augroup END |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
847 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
|
848 endfunc |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
849 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
850 func Test_early_bar() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
851 " 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
|
852 call s:AddAnAutocmd() |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
853 augroup vimBarTest | au! | let done = 77 | augroup END |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
854 call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
855 call assert_equal(77, done) |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
856 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
857 call s:AddAnAutocmd() |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
858 augroup vimBarTest| au!| let done = 88 | augroup END |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
859 call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
860 call assert_equal(88, done) |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
861 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
862 " 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
|
863 call s:AddAnAutocmd() |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
864 augroup vimBarTest| au!BufReadCmd| let done = 99 | augroup END |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
865 call assert_equal(1, len(split(execute('au vimBarTest'), "\n"))) |
26189
36a1a04fcd9f
patch 8.2.3626: "au! event" cannot be followed by another command
Bram Moolenaar <Bram@vim.org>
parents:
26153
diff
changeset
|
866 call assert_equal(99, done) |
9653
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
867 |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
868 " 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
|
869 call s:AddAnAutocmd() |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
870 au! vimBarTest|echo 'hello' |
01c9630e80e0
commit https://github.com/vim/vim/commit/e99e84497b89e5f91df519790802770920ecf4fe
Christian Brabandt <cb@256bit.org>
parents:
9599
diff
changeset
|
871 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
|
872 endfunc |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
873 |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
874 func RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
875 autocmd! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
876 augroup! StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
877 endfunc |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
878 |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
879 func Test_augroup_warning() |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
880 augroup TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
881 au VimEnter * echo 'entering' |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
882 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
|
883 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
|
884 redir => res |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
885 augroup! TheWarning |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
886 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
|
887 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
|
888 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
|
889 |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
890 " 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
|
891 augroup Another |
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
892 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
|
893 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
|
894 augroup! Another |
10058
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
895 |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
896 " no warning for postpone aucmd delete |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
897 augroup StartOK |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
898 au VimEnter * call RemoveGroup() |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
899 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
|
900 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
|
901 redir => res |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
902 doautocmd VimEnter |
65e43481d7de
commit https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1
Christian Brabandt <cb@256bit.org>
parents:
9682
diff
changeset
|
903 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
|
904 call assert_notmatch("W19:", res) |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
905 au! VimEnter |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
906 |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
907 call assert_fails('augroup!', 'E471:') |
9682
a98607bb756c
commit https://github.com/vim/vim/commit/f2c4c391192cab6e923b1a418d4af09106fba25f
Christian Brabandt <cb@256bit.org>
parents:
9653
diff
changeset
|
908 endfunc |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
909 |
12680
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
910 func Test_BufReadCmdHelp() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
911 " 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
|
912 au BufReadCmd * e +h |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
913 help |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
914 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
915 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
916 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
917 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
918 func Test_BufReadCmdHelpJump() |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
919 " 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
|
920 au BufReadCmd * e +h{ |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
921 " } to fix highlighting |
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
12680
diff
changeset
|
922 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
|
923 |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
924 au! BufReadCmd |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
925 endfunc |
429bf1b9292f
patch 8.0.1218: writing to freed memory in autocmd
Christian Brabandt <cb@256bit.org>
parents:
12662
diff
changeset
|
926 |
29875
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
927 " BufReadCmd is triggered for a "nofile" buffer. Check all values. |
29867
6eaef7375f17
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer
Bram Moolenaar <Bram@vim.org>
parents:
29505
diff
changeset
|
928 func Test_BufReadCmdNofile() |
29875
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
929 for val in ['nofile', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
930 \ 'nowrite', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
931 \ 'acwrite', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
932 \ 'quickfix', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
933 \ 'help', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
934 \ 'terminal', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
935 \ 'prompt', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
936 \ 'popup', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
937 \ ] |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
938 new somefile |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
939 exe 'set buftype=' .. val |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
940 au BufReadCmd somefile call setline(1, 'triggered') |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
941 edit |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
942 call assert_equal('triggered', getline(1)) |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
943 |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
944 au! BufReadCmd |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
945 bwipe! |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
946 endfor |
29867
6eaef7375f17
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer
Bram Moolenaar <Bram@vim.org>
parents:
29505
diff
changeset
|
947 endfunc |
6eaef7375f17
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer
Bram Moolenaar <Bram@vim.org>
parents:
29505
diff
changeset
|
948 |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
949 func Test_augroup_deleted() |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
950 " 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
|
951 augroup x |
10086
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
952 call assert_fails('augroup! x', 'E936:') |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
953 au VimEnter * echo |
1de911ef1edf
commit https://github.com/vim/vim/commit/de653f08805dde14424d417502a0480a6ad292f8
Christian Brabandt <cb@256bit.org>
parents:
10084
diff
changeset
|
954 augroup end |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
955 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
|
956 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
|
957 au! VimEnter |
10084
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
958 endfunc |
3e410e6e1986
commit https://github.com/vim/vim/commit/b62cc36a600e2e1e5a1d1d484fef89898c847c4c
Christian Brabandt <cb@256bit.org>
parents:
10058
diff
changeset
|
959 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
960 " Tests for autocommands on :close command. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
961 " This used to be in test13. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
962 func Test_three_windows() |
10242
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
963 " 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
|
964 call s:cleanup_buffers() |
a369d97995ff
commit https://github.com/vim/vim/commit/b3435b0a3a0967115658d0a8c0224a28969cfa02
Christian Brabandt <cb@256bit.org>
parents:
10151
diff
changeset
|
965 |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
966 " 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
|
967 " 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
|
968 " Do this twice, writing the file. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
969 e! Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
970 call setline(1, 'testje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
971 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
972 sp Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
973 call setline(1, 'testje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
974 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
975 sp Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
976 call setline(1, 'testje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
977 w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
978 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
979 au WinLeave Xtestje2 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
980 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
981 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
982 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
983 au WinLeave Xtestje1 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
984 close |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
985 call assert_equal('Xtestje1', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
986 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
987 " 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
|
988 " will be the ATTENTION prompt. |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
989 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
990 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
991 au! BufUnload Xtestje1 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
992 call assert_fails('e Xtestje3', 'E937:') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
993 call assert_equal('Xtestje3', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
994 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
995 e Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
996 sp Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
997 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
|
998 call assert_equal('Xtestje1', expand('%')) |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
999 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1000 " 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
|
1001 " 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
|
1002 au! |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1003 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1004 e Xanother |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1005 e Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1006 bwipe Xtestje2 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1007 bwipe Xtestje3 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1008 au BufWipeout Xtestje1 buf Xtestje1 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1009 bwipe |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1010 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1011 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1012 only |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1013 help |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1014 wincmd w |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1015 1quit |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1016 call assert_equal('Xanother', expand('%')) |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1017 |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1018 au! |
11197
7f355d8cd634
patch 8.0.0485: not all windows commands are tested
Christian Brabandt <cb@256bit.org>
parents:
10575
diff
changeset
|
1019 enew |
10106
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1020 call delete('Xtestje1') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1021 call delete('Xtestje2') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1022 call delete('Xtestje3') |
58e6dd1d8be3
commit https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Christian Brabandt <cb@256bit.org>
parents:
10086
diff
changeset
|
1023 endfunc |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1024 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1025 func Test_BufEnter() |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1026 au! BufEnter |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1027 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
|
1028 let g:val = '' |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1029 split NewFile |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1030 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
|
1031 bwipe! |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1032 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
|
1033 |
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1034 " Also get BufEnter when editing a directory |
30150
0fe61fa4e5d1
patch 9.0.0411: only created files can be cleaned up with one call
Bram Moolenaar <Bram@vim.org>
parents:
30089
diff
changeset
|
1035 call mkdir('Xbufenterdir', 'D') |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29950
diff
changeset
|
1036 split Xbufenterdir |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1037 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
|
1038 |
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
1039 " 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
|
1040 " buffer. |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29950
diff
changeset
|
1041 bwipe! Xbufenterdir |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1042 au! BufEnter |
29873
adc2dec6d27d
patch 9.0.0275: BufEnter not triggered when using ":edit" in "nofile" buffer
Bram Moolenaar <Bram@vim.org>
parents:
29867
diff
changeset
|
1043 |
adc2dec6d27d
patch 9.0.0275: BufEnter not triggered when using ":edit" in "nofile" buffer
Bram Moolenaar <Bram@vim.org>
parents:
29867
diff
changeset
|
1044 " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter |
29875
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1045 " for historic reasons. Also test other 'buftype' values. |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1046 for val in ['nofile', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1047 \ 'nowrite', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1048 \ 'acwrite', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1049 \ 'quickfix', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1050 \ 'help', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1051 \ 'terminal', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1052 \ 'prompt', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1053 \ 'popup', |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1054 \ ] |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1055 new somefile |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1056 exe 'set buftype=' .. val |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1057 au BufEnter somefile call setline(1, 'some text') |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1058 edit |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1059 call assert_equal('some text', getline(1)) |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1060 bwipe! |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1061 au! BufEnter |
cb4d95b545f1
patch 9.0.0276: 'buftype' values not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
29873
diff
changeset
|
1062 endfor |
31150
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1063 |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1064 new |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1065 new |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1066 autocmd BufEnter * ++once close |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1067 call assert_fails('close', 'E1312:') |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1068 |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1069 au! BufEnter |
bcda71c89776
patch 9.0.0909: error message for layout change does not match action
Bram Moolenaar <Bram@vim.org>
parents:
31073
diff
changeset
|
1070 only |
10575
01a5f64a7a20
patch 8.0.0177: BufEnter autocommand not fired for a directory
Christian Brabandt <cb@256bit.org>
parents:
10242
diff
changeset
|
1071 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
|
1072 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1073 " 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
|
1074 " 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
|
1075 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
|
1076 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
|
1077 tabnew |
12620
27a2fc398671
patch 8.0.1188: autocmd test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12616
diff
changeset
|
1078 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
|
1079 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
|
1080 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1081 |
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
|
1082 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
|
1083 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
|
1084 set nocp noswapfile |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1085 let v:swapchoice = "e" |
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
|
1086 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
|
1087 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
|
1088 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
|
1089 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
|
1090 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1091 func WriteErrors() |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1092 call writefile([execute("messages")], "XerrorsBwipe") |
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
|
1093 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
|
1094 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
|
1095 [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
|
1096 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1097 call writefile(content, 'Xvimrc', 'D') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1098 call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') |
30178
8ddf91c8faa6
patch 9.0.0425: autocmd test is a bit flaky on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
30158
diff
changeset
|
1099 sleep 100m |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1100 let errors = join(readfile('XerrorsBwipe')) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1101 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
|
1102 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1103 set swapfile |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1104 for file in ['Session.vim', 'XerrorsBwipe'] |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1105 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
|
1106 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1107 endfunc |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1108 |
23624
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1109 " Using :blast and :ball for many events caused a crash, because b_nwindows was |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1110 " not incremented correctly. |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1111 func Test_autocmd_blast_badd() |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1112 let content =<< trim [CODE] |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1113 au BufNew,BufAdd,BufWinEnter,BufEnter,BufLeave,BufWinLeave,BufUnload,VimEnter foo* blast |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1114 edit foo1 |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1115 au BufNew,BufAdd,BufWinEnter,BufEnter,BufLeave,BufWinLeave,BufUnload,VimEnter foo* ball |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1116 edit foo2 |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1117 call writefile(['OK'], 'XerrorsBlast') |
23624
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1118 qall |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1119 [CODE] |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1120 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1121 call writefile(content, 'XblastBall', 'D') |
23624
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1122 call system(GetVimCommand() .. ' --clean -S XblastBall') |
30178
8ddf91c8faa6
patch 9.0.0425: autocmd test is a bit flaky on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
30158
diff
changeset
|
1123 sleep 100m |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1124 call assert_match('OK', readfile('XerrorsBlast')->join()) |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1125 |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1126 call delete('XerrorsBlast') |
23624
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1127 endfunc |
f9d02c83f306
patch 8.2.2354: crash with a weird combination of autocommands
Bram Moolenaar <Bram@vim.org>
parents:
23278
diff
changeset
|
1128 |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1129 " 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
|
1130 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
|
1131 tabnew |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1132 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
|
1133 mksession! |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1134 |
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
|
1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 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
|
1144 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
|
1145 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
|
1146 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
|
1147 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
|
1148 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
|
1149 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
|
1150 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
|
1151 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16646
diff
changeset
|
1152 func WriteErrors() |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1153 call writefile([execute("messages")], "XerrorsPost") |
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
|
1154 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
|
1155 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
|
1156 [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
|
1157 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1158 call writefile(content, 'Xvimrc', 'D') |
17698
131f1d8c5860
patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1159 call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq') |
30178
8ddf91c8faa6
patch 9.0.0425: autocmd test is a bit flaky on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
30158
diff
changeset
|
1160 sleep 100m |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1161 let errors = join(readfile('XerrorsPost')) |
11223
ac36e139510f
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11201
diff
changeset
|
1162 " 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
|
1163 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
|
1164 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
|
1165 |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1166 set swapfile |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
30178
diff
changeset
|
1167 for file in ['Session.vim', 'XerrorsPost'] |
11199
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1168 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
|
1169 endfor |
e08ead1d269f
patch 8.0.0486: crash and endless loop when closing windows in autocmd
Christian Brabandt <cb@256bit.org>
parents:
11197
diff
changeset
|
1170 endfunc |
11641
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
1171 |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
1172 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
|
1173 doau \| |
dbce7e03bf55
patch 8.0.0703: illegal memory access with empty :doau command
Christian Brabandt <cb@256bit.org>
parents:
11223
diff
changeset
|
1174 endfunc |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1175 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1176 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
|
1177 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
|
1178 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
|
1179 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
|
1180 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
|
1181 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
|
1182 "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
|
1183 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1184 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1185 func Test_OptionSet() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
1186 CheckOption autochdir |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1187 |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1188 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
|
1189 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1190 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
|
1191 set nocp |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1192 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
|
1193 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1194 " 1: Setting number option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1195 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
|
1196 set nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1197 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
|
1198 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
|
1199 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1200 " 2: Setting local number option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1201 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
|
1202 setlocal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1203 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
|
1204 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
|
1205 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1206 " 3: Setting global number option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1207 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
|
1208 setglobal nonu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1209 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
|
1210 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
|
1211 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1212 " 4: Setting local autoindent option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1213 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
|
1214 setlocal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1215 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
|
1216 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
|
1217 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1218 " 5: Setting global autoindent option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1219 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
|
1220 setglobal ai |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1221 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
|
1222 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
|
1223 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1224 " 6: Setting global autoindent option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1225 let g:options = [['autoindent', 1, 1, 1, 0, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1226 set ai! |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1227 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
|
1228 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
|
1229 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1230 " 6a: Setting global autoindent option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1231 let g:options = [['autoindent', 1, 1, 0, 0, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1232 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
|
1233 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
|
1234 set ai! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1235 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
|
1236 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
|
1237 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1238 " 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
|
1239 " 7: don't trigger OptionSet" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1240 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
|
1241 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
|
1242 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
|
1243 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
|
1244 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1245 " 8: Setting several global list and number option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1246 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
|
1247 set list nu |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1248 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
|
1249 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
|
1250 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1251 " 9: don't trigger OptionSet" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1252 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
|
1253 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
|
1254 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
|
1255 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
|
1256 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1257 " 10: Setting global acd" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1258 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
|
1259 setlocal acd |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1260 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
|
1261 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
|
1262 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1263 " 11: Setting global autoread (also sets local value)" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1264 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
|
1265 set ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1266 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
|
1267 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
|
1268 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1269 " 12: Setting local autoread" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1270 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
|
1271 setlocal ar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1272 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
|
1273 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
|
1274 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1275 " 13: Setting global autoread" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1276 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
|
1277 setglobal invar |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1278 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
|
1279 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
|
1280 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1281 " 14: Setting option backspace through :let" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1282 let g:options = [['backspace', '', '', '', 'eol,indent,start', 'global', 'set']] |
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1283 let &bs = "eol,indent,start" |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1284 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
|
1285 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
|
1286 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1287 " 15: Setting option backspace through setbufvar()" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1288 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
|
1289 " 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
|
1290 " 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
|
1291 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
|
1292 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
|
1293 " 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
|
1294 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
|
1295 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
|
1296 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
|
1297 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1298 " 16: Setting number option using setwinvar" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1299 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
|
1300 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
|
1301 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
|
1302 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
|
1303 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1304 " 17: Setting key option, shouldn't trigger" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1305 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
|
1306 setlocal key=blah |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1307 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
|
1308 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
|
1309 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
|
1310 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1311 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1312 " 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
|
1313 let oldval = &backupext |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1314 let g:options = [['backupext', oldval, oldval, oldval, 'foo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1315 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
|
1316 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
|
1317 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
|
1318 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1319 " 18b: Resetting string global option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1320 let g:options = [['backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1321 set backupext& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1322 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
|
1323 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
|
1324 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1325 " 18c: Setting global string global option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1326 let g:options = [['backupext', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1327 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
|
1328 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
|
1329 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
|
1330 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1331 " 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
|
1332 " 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
|
1333 " :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
|
1334 noa set backupext& " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1335 let g:options = [['backupext', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1336 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
|
1337 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
|
1338 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
|
1339 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1340 " 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
|
1341 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
|
1342 noa setlocal backupext=ext_local " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1343 let g:options = [['backupext', 'ext_local', 'ext_local', 'ext_local', 'fuu', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1344 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
|
1345 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
|
1346 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
|
1347 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1348 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1349 " 19a: Setting string global-local (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
|
1350 let oldval = &tags |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1351 let g:options = [['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1352 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
|
1353 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
|
1354 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
|
1355 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1356 " 19b: Resetting string global-local (to buffer) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1357 let g:options = [['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1358 set tags& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1359 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
|
1360 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
|
1361 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1362 " 19c: Setting global string global-local (to buffer) option " |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1363 let g:options = [['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1364 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
|
1365 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
|
1366 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
|
1367 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1368 " 19d: Setting local string global-local (to buffer) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1369 let g:options = [['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1370 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
|
1371 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
|
1372 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
|
1373 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1374 " 19e: Setting again string global-local (to buffer) option" |
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1375 " Note: v:option_old is the old global value for global-local string options |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1376 " 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
|
1377 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
|
1378 noa setlocal tags=tag_local |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1379 let g:options = [['tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1380 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
|
1381 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
|
1382 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
|
1383 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1384 " 19f: Setting string global-local (to buffer) option to an empty string" |
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1385 " Note: v:option_old is the old global value for global-local string options |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1386 " 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
|
1387 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
|
1388 noa setlocal tags= " empty string |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1389 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
|
1390 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
|
1391 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
|
1392 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
|
1393 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1394 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1395 " 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
|
1396 let oldval = &spelllang |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1397 let g:options = [['spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1398 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
|
1399 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
|
1400 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
|
1401 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1402 " 20b: Resetting string local (to buffer) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1403 let g:options = [['spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1404 set spelllang& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1405 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
|
1406 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
|
1407 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1408 " 20c: Setting global string local (to buffer) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1409 let g:options = [['spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1410 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
|
1411 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
|
1412 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
|
1413 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1414 " 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
|
1415 noa set spelllang& " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1416 let g:options = [['spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1417 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
|
1418 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
|
1419 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
|
1420 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1421 " 20e: Setting again string local (to buffer) option" |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1422 " Note: v:option_old is the old global value for global-local string options |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1423 " 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
|
1424 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
|
1425 noa setlocal spelllang=spelllocal |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1426 let g:options = [['spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1427 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
|
1428 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
|
1429 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
|
1430 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1431 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1432 " 21a: Setting string global-local (to window) option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1433 let oldval = &statusline |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1434 let g:options = [['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1435 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
|
1436 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
|
1437 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
|
1438 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1439 " 21b: Resetting string global-local (to window) option" |
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1440 " Note: v:option_old is the old global value for global-local string options |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1441 " but the old local value for all other kinds of options. |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1442 let g:options = [['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1443 set statusline& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1444 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
|
1445 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
|
1446 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1447 " 21c: Setting global string global-local (to window) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1448 let g:options = [['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1449 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
|
1450 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
|
1451 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
|
1452 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1453 " 21d: Setting local string global-local (to window) option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1454 noa set statusline& " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1455 let g:options = [['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1456 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
|
1457 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
|
1458 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
|
1459 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1460 " 21e: Setting again string global-local (to window) option" |
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1461 " Note: v:option_old is the old global value for global-local string options |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1462 " 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
|
1463 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
|
1464 noa setlocal statusline=baz |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1465 let g:options = [['statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1466 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
|
1467 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
|
1468 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
|
1469 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1470 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1471 " 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
|
1472 let oldval = &foldignore |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1473 let g:options = [['foldignore', oldval, oldval, oldval, 'fo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1474 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
|
1475 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
|
1476 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
|
1477 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1478 " 22b: Resetting string local (to window) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1479 let g:options = [['foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1480 set foldignore& |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1481 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
|
1482 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
|
1483 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1484 " 22c: Setting global string local (to window) option" |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1485 let g:options = [['foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1486 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
|
1487 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
|
1488 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
|
1489 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1490 " 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
|
1491 noa set foldignore& " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1492 let g:options = [['foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1493 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
|
1494 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
|
1495 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
|
1496 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1497 " 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
|
1498 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
|
1499 noa setlocal foldignore=loc |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1500 let g:options = [['foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1501 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
|
1502 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
|
1503 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
|
1504 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1505 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1506 " 23a: Setting global number global option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1507 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
|
1508 noa setlocal cmdheight=1 " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1509 let g:options = [['cmdheight', '1', '', '1', '2', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1510 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
|
1511 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
|
1512 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
|
1513 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1514 " 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
|
1515 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
|
1516 noa setlocal cmdheight=1 " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1517 let g:options = [['cmdheight', '1', '1', '', '2', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1518 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
|
1519 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
|
1520 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
|
1521 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1522 " 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
|
1523 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
|
1524 noa setlocal cmdheight=1 " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1525 let g:options = [['cmdheight', '1', '1', '1', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1526 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
|
1527 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
|
1528 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
|
1529 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1530 " 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
|
1531 noa set cmdheight=8 " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1532 let g:options = [['cmdheight', '8', '8', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1533 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
|
1534 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
|
1535 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
|
1536 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1537 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1538 " 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
|
1539 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
|
1540 noa setlocal undolevels=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1541 let g:options = [['undolevels', '8', '', '8', '2', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1542 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
|
1543 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
|
1544 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
|
1545 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1546 " 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
|
1547 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
|
1548 noa setlocal undolevels=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1549 let g:options = [['undolevels', '1', '1', '', '2', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1550 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
|
1551 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
|
1552 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
|
1553 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1554 " 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
|
1555 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
|
1556 noa setlocal undolevels=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1557 let g:options = [['undolevels', '1', '1', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1558 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
|
1559 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
|
1560 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
|
1561 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1562 " 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
|
1563 noa set undolevels=8 " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1564 let g:options = [['undolevels', '8', '8', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1565 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
|
1566 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
|
1567 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
|
1568 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1569 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1570 " 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
|
1571 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
|
1572 noa setlocal wrapmargin=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1573 let g:options = [['wrapmargin', '8', '', '8', '2', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1574 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
|
1575 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
|
1576 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
|
1577 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1578 " 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
|
1579 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
|
1580 noa setlocal wrapmargin=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1581 let g:options = [['wrapmargin', '1', '1', '', '2', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1582 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
|
1583 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
|
1584 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
|
1585 |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1586 " 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
|
1587 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
|
1588 noa setlocal wrapmargin=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1589 let g:options = [['wrapmargin', '1', '1', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1590 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
|
1591 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
|
1592 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
|
1593 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1594 " 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
|
1595 noa set wrapmargin=8 " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1596 let g:options = [['wrapmargin', '8', '8', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1597 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
|
1598 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
|
1599 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
|
1600 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1601 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1602 " 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
|
1603 " 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
|
1604 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1605 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1606 " 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
|
1607 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
|
1608 noa setlocal foldcolumn=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1609 let g:options = [['foldcolumn', '8', '', '8', '2', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1610 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
|
1611 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
|
1612 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
|
1613 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1614 " 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
|
1615 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
|
1616 noa setlocal foldcolumn=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1617 let g:options = [['foldcolumn', '1', '1', '', '2', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1618 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
|
1619 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
|
1620 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
|
1621 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1622 " 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
|
1623 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
|
1624 noa setlocal foldcolumn=1 |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1625 let g:options = [['foldcolumn', '1', '1', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1626 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
|
1627 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
|
1628 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
|
1629 |
26030
a140d0098595
patch 8.2.3549: mistakes in test comments
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
1630 " 27d: Setting again global number local (to window) option" |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1631 noa set foldcolumn=8 " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1632 let g:options = [['foldcolumn', '8', '8', '8', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1633 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
|
1634 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
|
1635 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
|
1636 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1637 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1638 " 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
|
1639 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
|
1640 noa setlocal wrapscan " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1641 let g:options = [['wrapscan', '1', '', '1', '0', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1642 setglobal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1643 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
|
1644 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
|
1645 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1646 " 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
|
1647 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
|
1648 noa setlocal wrapscan " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1649 let g:options = [['wrapscan', '1', '1', '', '0', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1650 setlocal nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1651 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
|
1652 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
|
1653 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1654 " 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
|
1655 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
|
1656 noa setlocal wrapscan " Sets the global(!) value! |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1657 let g:options = [['wrapscan', '1', '1', '1', '0', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1658 set nowrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1659 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
|
1660 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
|
1661 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1662 " 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
|
1663 noa set nowrapscan " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1664 let g:options = [['wrapscan', '0', '0', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1665 set wrapscan |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1666 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
|
1667 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
|
1668 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1669 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1670 " 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
|
1671 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
|
1672 noa setlocal autoread |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1673 let g:options = [['autoread', '0', '', '0', '1', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1674 setglobal autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1675 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
|
1676 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
|
1677 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1678 " 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
|
1679 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
|
1680 noa setlocal autoread |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1681 let g:options = [['autoread', '1', '1', '', '0', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1682 setlocal noautoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1683 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
|
1684 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
|
1685 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1686 " 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
|
1687 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
|
1688 noa setlocal autoread |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1689 let g:options = [['autoread', '1', '1', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1690 set autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1691 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
|
1692 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
|
1693 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1694 " 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
|
1695 noa set noautoread " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1696 let g:options = [['autoread', '0', '0', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1697 set autoread |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1698 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
|
1699 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
|
1700 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1701 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1702 " 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
|
1703 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
|
1704 noa setlocal cindent |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1705 let g:options = [['cindent', '0', '', '0', '1', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1706 setglobal cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1707 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
|
1708 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
|
1709 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1710 " 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
|
1711 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
|
1712 noa setlocal cindent |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1713 let g:options = [['cindent', '1', '1', '', '0', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1714 setlocal nocindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1715 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
|
1716 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
|
1717 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1718 " 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
|
1719 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
|
1720 noa setlocal cindent |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1721 let g:options = [['cindent', '1', '1', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1722 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1723 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
|
1724 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
|
1725 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1726 " 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
|
1727 noa set nocindent " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1728 let g:options = [['cindent', '0', '0', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1729 set cindent |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1730 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
|
1731 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
|
1732 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1733 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1734 " 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
|
1735 " 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
|
1736 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1737 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1738 " 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
|
1739 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
|
1740 noa setlocal cursorcolumn |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1741 let g:options = [['cursorcolumn', '0', '', '0', '1', 'global', 'setglobal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1742 setglobal cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1743 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
|
1744 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
|
1745 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1746 " 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
|
1747 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
|
1748 noa setlocal cursorcolumn |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1749 let g:options = [['cursorcolumn', '1', '1', '', '0', 'local', 'setlocal']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1750 setlocal nocursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1751 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
|
1752 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
|
1753 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1754 " 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
|
1755 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
|
1756 noa setlocal cursorcolumn |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1757 let g:options = [['cursorcolumn', '1', '1', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1758 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1759 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
|
1760 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
|
1761 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1762 " 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
|
1763 noa set nocursorcolumn " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1764 let g:options = [['cursorcolumn', '0', '0', '0', '1', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1765 set cursorcolumn |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1766 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
|
1767 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
|
1768 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1769 |
17918
9606c0adc148
patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
1770 " 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
|
1771 noa set backspace=1 " Reset global and local value (without triggering autocmd) |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1772 let g:options = [['backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set']] |
17085
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1773 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
|
1774 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
|
1775 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
|
1776 |
620e9011b685
patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1777 |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1778 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1779 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
|
1780 " 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
|
1781 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
|
1782 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
|
1783 endfor |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1784 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
|
1785 delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1786 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1787 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1788 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
|
1789 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
|
1790 " 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
|
1791 new |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
1792 au OptionSet diff :let &l:cul = v:option_new |
11707
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1793 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1794 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
|
1795 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
|
1796 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1797 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
|
1798 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1799 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1800 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
|
1801 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
|
1802 diffthis |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1803 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
|
1804 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1805 diffoff |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1806 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
|
1807 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
|
1808 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1809 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1810 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
|
1811 diffoff! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1812 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
|
1813 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
|
1814 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1815 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1816 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1817 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1818 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
|
1819 endfunc |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1820 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1821 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
|
1822 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
|
1823 " 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
|
1824 " should not segfault |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1825 new |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1826 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
|
1827 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1828 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
|
1829 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
|
1830 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
|
1831 vnew |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1832 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
|
1833 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
|
1834 call assert_equal(1, &diff) |
18592
75c466dcf61c
patch 8.1.2290: autocommand test fails
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
1835 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
|
1836 bw! |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21895
diff
changeset
|
1837 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
|
1838 bw! |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1839 |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1840 " Cleanup |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1841 au! OptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1842 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
|
1843 "delfunc! AutoCommandOptionSet |
1395a3b6978d
patch 8.0.0736: OptionSet not triggered when entering diff mode
Christian Brabandt <cb@256bit.org>
parents:
11641
diff
changeset
|
1844 endfunc |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1845 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1846 " 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
|
1847 func Test_BufleaveWithDelete() |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1848 new | edit XbufLeave1 |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1849 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1850 augroup test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1851 autocmd! |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1852 autocmd BufLeave XbufLeave1 bwipe XbufLeave2 |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1853 augroup END |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1854 |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1855 call assert_fails('edit XbufLeave2', 'E143:') |
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1856 call assert_equal('XbufLeave1', bufname('%')) |
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1857 |
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1858 autocmd! test_bufleavewithdelete BufLeave XbufLeave1 |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1859 augroup! test_bufleavewithdelete |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1860 |
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1861 new |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
1862 bwipe! XbufLeave1 |
11961
0240e7e3d736
patch 8.0.0861: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
11707
diff
changeset
|
1863 endfunc |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1864 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1865 " 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
|
1866 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
|
1867 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1868 %bwipe! |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1869 call writefile(['Test file Xxx1'], 'Xxx1', 'D') |
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1870 call writefile(['Test file Xxx2'], 'Xxx2', 'D') |
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1871 call writefile(['Test file Xxx3'], 'Xxx3', 'D') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1872 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1873 " 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
|
1874 split Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1875 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1876 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1877 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1878 split Xxx3 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1879 close |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1880 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1881 " 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
|
1882 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
|
1883 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1884 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
|
1885 ball |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1886 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1887 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
|
1888 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
|
1889 wincmd t |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1890 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1891 au! BufReadPost |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1892 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1893 enew! | only |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1894 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1895 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1896 " 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
|
1897 " 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
|
1898 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
|
1899 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1900 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
|
1901 \ "\<Tab>this is a test", |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1902 \ 'end of test file Xxx1'], 'Xxx1', 'D') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1903 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
|
1904 \ 'vim: set noai :', |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1905 \ "\<Tab>this is a test", |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1906 \ 'end of test file Xxx2'], 'Xxx2', 'D') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1907 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1908 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
|
1909 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
|
1910 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1911 " 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
|
1912 edit Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1913 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
|
1914 " 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
|
1915 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
|
1916 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
|
1917 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
|
1918 " 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
|
1919 au! BufEnter Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1920 buf! Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1921 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
|
1922 " 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
|
1923 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
|
1924 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
|
1925 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
|
1926 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1927 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1928 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
|
1929 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1930 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1931 " 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
|
1932 " 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
|
1933 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
|
1934 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1935 set ai |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1936 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
|
1937 set fo+=r |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1938 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
|
1939 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
|
1940 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
|
1941 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1942 set ai&vim |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1943 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
|
1944 enew! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1945 endfunc |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1946 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1947 " 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
|
1948 " 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
|
1949 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
|
1950 %bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1951 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
|
1952 \ '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
|
1953 \ 'end of test file Xxx'] |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1954 call writefile(content, 'Xxx1', 'D') |
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
1955 call writefile(content, 'Xxx2', 'D') |
12616
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1956 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1957 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
|
1958 edit Xxx1 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1959 split Xxx2 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1960 " 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
|
1961 bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1962 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
|
1963 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
|
1964 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1965 " 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
|
1966 %write! test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1967 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
|
1968 " delete alternate buffer |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1969 bwipe test.out |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1970 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
|
1971 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
|
1972 |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1973 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
|
1974 " 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
|
1975 bwipe! |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1976 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
|
1977 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
|
1978 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
|
1979 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
|
1980 |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
1981 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
|
1982 %bwipe |
4767939d10cc
patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents:
12188
diff
changeset
|
1983 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
|
1984 |
560adb3eed8b
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()
Christian Brabandt <cb@256bit.org>
parents:
12620
diff
changeset
|
1985 " 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
|
1986 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
|
1987 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
|
1988 |
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1989 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
|
1990 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
|
1991 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
|
1992 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
|
1993 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
|
1994 " 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
|
1995 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
|
1996 call assert_equal('Xfoo', g:afile) |
28558
2edad5db074c
patch 8.2.4803: WinScrolled not always triggered when scrolling with mouse
Bram Moolenaar <Bram@vim.org>
parents:
28556
diff
changeset
|
1997 |
12652
272ecbaf1b4f
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
1998 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
|
1999 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
|
2000 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
|
2001 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
|
2002 |
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
2003 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
|
2004 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
|
2005 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
|
2006 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
|
2007 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
|
2008 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
2009 |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
2010 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
|
2011 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
|
2012 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
|
2013 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
|
2014 au! CmdlineChanged |
59a16624400a
patch 8.0.1445: cannot act on edits in the command line
Christian Brabandt <cb@256bit.org>
parents:
13090
diff
changeset
|
2015 |
31934
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2016 autocmd CmdlineChanged : let g:log += [getcmdline()] |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2017 |
31412
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2018 let g:log = [] |
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2019 cnoremap <F1> <Cmd>call setcmdline('ls')<CR> |
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2020 call feedkeys(":\<F1>", 'xt') |
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2021 call assert_equal(['ls'], g:log) |
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2022 cunmap <F1> |
742b7bf2fefc
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Bram Moolenaar <Bram@vim.org>
parents:
31384
diff
changeset
|
2023 |
31916
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2024 let g:log = [] |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2025 call feedkeys(":sign \<Tab>\<Tab>\<C-N>\<C-P>\<S-Tab>\<S-Tab>\<Esc>", 'xt') |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2026 call assert_equal([ |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2027 \ 's', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2028 \ 'si', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2029 \ 'sig', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2030 \ 'sign', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2031 \ 'sign ', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2032 \ 'sign define', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2033 \ 'sign jump', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2034 \ 'sign list', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2035 \ 'sign jump', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2036 \ 'sign define', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2037 \ 'sign ', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2038 \ ], g:log) |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2039 let g:log = [] |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2040 set wildmenu wildoptions+=pum |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2041 call feedkeys(":sign \<S-Tab>\<PageUp>\<kPageUp>\<kPageDown>\<PageDown>\<Esc>", 'xt') |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2042 call assert_equal([ |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2043 \ 's', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2044 \ 'si', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2045 \ 'sig', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2046 \ 'sign', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2047 \ 'sign ', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2048 \ 'sign unplace', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2049 \ 'sign jump', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2050 \ 'sign define', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2051 \ 'sign undefine', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2052 \ 'sign unplace', |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2053 \ ], g:log) |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2054 set wildmenu& wildoptions& |
31934
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2055 |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2056 let g:log = [] |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2057 let @r = 'abc' |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2058 call feedkeys(":0\<C-R>r1\<C-R>\<C-O>r2\<C-R>\<C-R>r3\<Esc>", 'xt') |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2059 call assert_equal([ |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2060 \ '0', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2061 \ '0a', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2062 \ '0ab', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2063 \ '0abc', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2064 \ '0abc1', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2065 \ '0abc1abc', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2066 \ '0abc1abc2', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2067 \ '0abc1abc2abc', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2068 \ '0abc1abc2abc3', |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2069 \ ], g:log) |
929a9427862c
patch 9.0.1299: change for triggering incsearch not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
31916
diff
changeset
|
2070 |
31916
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2071 unlet g:log |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2072 au! CmdlineChanged |
dd38c6cc04bd
patch 9.0.1290: CTRL-N and -P on cmdline don't trigger CmdlineChanged
Bram Moolenaar <Bram@vim.org>
parents:
31849
diff
changeset
|
2073 |
12656
0a9dacb8826a
patch 8.0.1206: no autocmd for entering or leaving the command line
Christian Brabandt <cb@256bit.org>
parents:
12652
diff
changeset
|
2074 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
|
2075 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
|
2076 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
|
2077 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
|
2078 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
|
2079 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
|
2080 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
|
2081 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
|
2082 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
|
2083 |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
2084 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
|
2085 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
|
2086 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
|
2087 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
|
2088 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
|
2089 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
|
2090 new |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2091 call setline(1, 'hello') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2092 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
|
2093 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
|
2094 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
|
2095 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
|
2096 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
|
2097 au! CmdlineLeave |
13752
8a3e9d1e8cf9
patch 8.0.1748: CmdlineEnter command uses backslash instead of slash
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
2098 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
|
2099 endfunc |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2100 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2101 " 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
|
2102 func Test_BufWritePre() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2103 %bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2104 au BufWritePre Xxx1 bunload |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2105 au BufWritePre Xxx2 bwipe |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2106 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2107 call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1', 'D') |
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2108 call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2', 'D') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2109 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2110 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2111 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2112 bdel Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2113 e Xxx1 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2114 " 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
|
2115 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
|
2116 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
|
2117 edit Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2118 e! Xxx2 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2119 bwipe Xtest |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2120 " 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
|
2121 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
|
2122 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
|
2123 au! BufWritePre |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2124 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2125 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2126 " 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
|
2127 func Test_bufunload_all() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
25967
diff
changeset
|
2128 let g:test_is_flaky = 1 |
33223
def9fc5c92d1
patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents:
32317
diff
changeset
|
2129 call writefile(['Test file Xxx1'], 'Xxx1', 'D') |
def9fc5c92d1
patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents:
32317
diff
changeset
|
2130 call writefile(['Test file Xxx2'], 'Xxx2', 'D') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2131 |
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
|
2132 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
|
2133 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
|
2134 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
|
2135 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
|
2136 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
|
2137 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
|
2138 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
|
2139 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
|
2140 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
|
2141 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
|
2142 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
|
2143 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
|
2144 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
|
2145 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
|
2146 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
|
2147 [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
|
2148 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2149 call writefile(content, 'Xbunloadtest', 'D') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2150 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2151 call delete('Xout') |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2152 call system(GetVimCommandClean() .. ' -N --not-a-term -S Xbunloadtest') |
12662
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2153 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
|
2154 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2155 call delete('Xout') |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2156 endfunc |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2157 |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2158 " 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
|
2159 func Test_buflocal_autocmd() |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2160 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2161 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2162 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
|
2163 " 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
|
2164 " 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
|
2165 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2166 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
|
2167 let g:bname = '' |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2168 " 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
|
2169 bwipe xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2170 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2171 edit xx |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2172 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
|
2173 " autocmd should not trigger |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2174 edit somefile |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2175 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
|
2176 enew |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2177 unlet g:bname |
15f0f9f16cd9
patch 8.0.1209: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12656
diff
changeset
|
2178 endfunc |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2179 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2180 " Test for "*Cmd" autocommands |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2181 func Test_Cmd_Autocmds() |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2182 call writefile(['start of Xxx', "\tabc2", 'end of Xxx'], 'Xxx', 'D') |
12750
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2183 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2184 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2185 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
|
2186 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
|
2187 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
|
2188 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2189 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
|
2190 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
|
2191 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
|
2192 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
|
2193 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
|
2194 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2195 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2196 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2197 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2198 " 3 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2199 " 4 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2200 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2201 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
|
2202 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
|
2203 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
|
2204 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2205 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2206 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2207 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2208 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2209 " 4 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2210 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2211 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2212 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2213 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2214 au FileWriteCmd XtestC '[,']copy $ |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2215 normal 4GA1 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2216 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
|
2217 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
|
2218 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
|
2219 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
|
2220 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2221 " now we have: |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2222 " 1 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2223 " 2 abc2 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2224 " 3 start of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2225 " 4 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2226 " 5 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2227 " 6 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2228 " 7 write |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2229 " 8 abc21 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2230 " 9 end of Xxx |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2231 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2232 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2233 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
|
2234 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
|
2235 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
|
2236 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
|
2237 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
|
2238 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
|
2239 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2240 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
|
2241 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
|
2242 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
|
2243 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2244 let g:lines = [] |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2245 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
|
2246 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
|
2247 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
|
2248 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
|
2249 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
|
2250 |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2251 au! BufReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2252 au! BufWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2253 au! FileReadCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2254 au! FileWriteCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2255 au! FileAppendCmd |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2256 %bwipe! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2257 enew! |
0b6c09957b43
patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
2258 endfunc |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2259 |
19836
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2260 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
|
2261 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
|
2262 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
|
2263 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
|
2264 1d_ |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2265 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
|
2266 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
|
2267 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2268 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2269 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
|
2270 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
|
2271 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
|
2272 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
|
2273 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
|
2274 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
|
2275 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2276 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2277 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
|
2278 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
|
2279 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
|
2280 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2281 call writefile(['one', 'two', 'three'], 'Xcmd.test', 'D') |
19836
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2282 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
|
2283 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
|
2284 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
|
2285 write |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2286 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
|
2287 |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2288 bwipe! |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2289 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
|
2290 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
|
2291 endfunc |
c32b295af9c5
patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
19752
diff
changeset
|
2292 |
29988
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2293 func Test_BufWriteCmd() |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2294 autocmd BufWriteCmd Xbufwritecmd let g:written = 1 |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2295 new |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2296 file Xbufwritecmd |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2297 set buftype=acwrite |
30150
0fe61fa4e5d1
patch 9.0.0411: only created files can be cleaned up with one call
Bram Moolenaar <Bram@vim.org>
parents:
30089
diff
changeset
|
2298 call mkdir('Xbufwritecmd', 'D') |
29988
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2299 write |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2300 " BufWriteCmd should be triggered even if a directory has the same name |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2301 call assert_equal(1, g:written) |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2302 unlet g:written |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2303 au! BufWriteCmd |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2304 bwipe! |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2305 endfunc |
b2140f61826c
patch 9.0.0332: overwrite check may block BufWriteCmd
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
2306 |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2307 func SetChangeMarks(start, end) |
23626
e23ccc04025a
patch 8.2.2355: stray test failure on Appveyor
Bram Moolenaar <Bram@vim.org>
parents:
23624
diff
changeset
|
2308 exe a:start .. 'mark [' |
e23ccc04025a
patch 8.2.2355: stray test failure on Appveyor
Bram Moolenaar <Bram@vim.org>
parents:
23624
diff
changeset
|
2309 exe a:end .. 'mark ]' |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2310 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2311 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2312 " 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
|
2313 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
|
2314 edit! Xtest |
23626
e23ccc04025a
patch 8.2.2355: stray test failure on Appveyor
Bram Moolenaar <Bram@vim.org>
parents:
23624
diff
changeset
|
2315 call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u\<Esc>", 'xtn') |
12783
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2316 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2317 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
|
2318 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2319 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
|
2320 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2321 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
|
2322 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
|
2323 write |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2324 au! BufWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2325 |
21638
5dcdb970111b
patch 8.2.1369: MS-Windows: autocommand test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
21419
diff
changeset
|
2326 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
|
2327 write XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2328 write >> XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2329 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2330 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
|
2331 " 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
|
2332 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
|
2333 " '[ 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
|
2334 " data |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2335 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
|
2336 " 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
|
2337 " 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
|
2338 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
|
2339 %!cat XtestFilter |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2340 " 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
|
2341 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
|
2342 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
|
2343 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2344 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2345 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
|
2346 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
|
2347 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
|
2348 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
|
2349 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
|
2350 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
|
2351 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
|
2352 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2353 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2354 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
|
2355 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2356 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2357 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
|
2358 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
|
2359 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
|
2360 au! FileWritePre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2361 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2362 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
|
2363 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
|
2364 write >> Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2365 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2366 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2367 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
|
2368 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
|
2369 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
|
2370 au! FileAppendPre |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2371 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2372 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
|
2373 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
|
2374 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
|
2375 3read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2376 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
|
2377 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2378 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2379 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
|
2380 " 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
|
2381 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
|
2382 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
|
2383 0read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2384 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
|
2385 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2386 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2387 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
|
2388 " 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
|
2389 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
|
2390 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
|
2391 1read Xtest2 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2392 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
|
2393 undo |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2394 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2395 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2396 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
|
2397 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
|
2398 endfunc |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2399 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2400 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
|
2401 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
|
2402 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2403 enew! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2404 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
|
2405 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2406 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
|
2407 set shelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2408 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2409 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
|
2410 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
|
2411 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
|
2412 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
|
2413 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2414 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
|
2415 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2416 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
|
2417 set noshelltemp |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2418 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2419 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
|
2420 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
|
2421 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
|
2422 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
|
2423 %!cat |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2424 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
|
2425 endif |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2426 |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2427 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
|
2428 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
|
2429 bwipe! |
afd8a4f36301
patch 8.0.1269: effect of autocommands on marks is not tested
Christian Brabandt <cb@256bit.org>
parents:
12750
diff
changeset
|
2430 endfunc |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2431 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2432 func Test_TextYankPost() |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2433 enew! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2434 call setline(1, ['foo']) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2435 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2436 let g:event = [] |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2437 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
|
2438 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2439 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2440 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
|
2441 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
|
2442 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2443 norm "ayiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2444 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2445 \ #{regcontents: ['foo'], regname: 'a', operator: 'y', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2446 \ regtype: 'v', visual: v:false, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2447 \ g:event) |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2448 norm y_ |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2449 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2450 \ #{regcontents: ['foo'], regname: '', operator: 'y', regtype: 'V', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2451 \ visual: v:false, inclusive: v:false}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2452 \ g:event) |
20824
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
2453 norm Vy |
b8ca32dcfabb
patch 8.2.0964: TextYankPost does not provide info about Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
20800
diff
changeset
|
2454 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2455 \ #{regcontents: ['foo'], regname: '', operator: 'y', regtype: 'V', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2456 \ visual: v:true, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2457 \ g:event) |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2458 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
|
2459 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2460 \ #{regcontents: ['f'], regname: '', operator: 'y', regtype: "\x161", |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2461 \ visual: v:true, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2462 \ g:event) |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2463 norm "xciwbar |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2464 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2465 \ #{regcontents: ['foo'], regname: 'x', operator: 'c', regtype: 'v', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2466 \ visual: v:false, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2467 \ g:event) |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2468 norm "bdiw |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2469 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2470 \ #{regcontents: ['bar'], regname: 'b', operator: 'd', regtype: 'v', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2471 \ visual: v:false, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2472 \ g:event) |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2473 |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2474 call setline(1, 'foobar') |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2475 " exclusive motion |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2476 norm $"ay0 |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2477 call assert_equal( |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2478 \ #{regcontents: ['fooba'], regname: 'a', operator: 'y', regtype: 'v', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2479 \ visual: v:false, inclusive: v:false}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2480 \ g:event) |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2481 " inclusive motion |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2482 norm 0"ay$ |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2483 call assert_equal( |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2484 \ #{regcontents: ['foobar'], regname: 'a', operator: 'y', regtype: 'v', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2485 \ visual: v:false, inclusive: v:true}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2486 \ g:event) |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2487 |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2488 call assert_equal({}, v:event) |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2489 |
23021
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2490 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
|
2491 " 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
|
2492 " 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
|
2493 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
|
2494 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2495 let @* = '' |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2496 set clipboard=autoselect |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2497 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
|
2498 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2499 \ #{regcontents: ['foobar'], regname: '*', operator: 'y', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2500 \ regtype: 'v', visual: v:true, inclusive: v:false}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2501 \ g:event) |
23021
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2502 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2503 let @+ = '' |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2504 set clipboard=autoselectplus |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2505 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
|
2506 call assert_equal( |
28384
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2507 \ #{regcontents: ['foobar'], regname: '+', operator: 'y', |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2508 \ regtype: 'v', visual: v:true, inclusive: v:false}, |
21e96d9b66c0
patch 8.2.4717: for TextYankPost v:event does not contain all information
Bram Moolenaar <Bram@vim.org>
parents:
28375
diff
changeset
|
2509 \ g:event) |
23021
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2510 |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2511 set clipboard&vim |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2512 endif |
d10a37eb91ee
patch 8.2.2057: getting the selection may trigger TextYankPost autocmd
Bram Moolenaar <Bram@vim.org>
parents:
22999
diff
changeset
|
2513 |
13037
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2514 au! TextYankPost |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2515 unlet g:event |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2516 bwipe! |
6e81a68d63a1
patch 8.0.1394: cannot intercept a yank command
Christian Brabandt <cb@256bit.org>
parents:
12783
diff
changeset
|
2517 endfunc |
13054
197a08152ad5
patch 8.0.1402: crash with nasty autocommand
Christian Brabandt <cb@256bit.org>
parents:
13037
diff
changeset
|
2518 |
23758
97296182d336
patch 8.2.2420: too many problems with using all autocommand events
Bram Moolenaar <Bram@vim.org>
parents:
23756
diff
changeset
|
2519 func Test_autocommand_all_events() |
97296182d336
patch 8.2.2420: too many problems with using all autocommand events
Bram Moolenaar <Bram@vim.org>
parents:
23756
diff
changeset
|
2520 call assert_fails('au * * bwipe', 'E1155:') |
97296182d336
patch 8.2.2420: too many problems with using all autocommand events
Bram Moolenaar <Bram@vim.org>
parents:
23756
diff
changeset
|
2521 call assert_fails('au * x bwipe', 'E1155:') |
26715
af919f98c7e1
patch 8.2.3886: can define autocmd for every event by using "au!"
Bram Moolenaar <Bram@vim.org>
parents:
26189
diff
changeset
|
2522 call assert_fails('au! * x bwipe', 'E1155:') |
13056
b931b2751650
patch 8.0.1403: using freed buffer in grep command
Christian Brabandt <cb@256bit.org>
parents:
13054
diff
changeset
|
2523 endfunc |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2524 |
27639
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2525 func Test_autocmd_user() |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2526 au User MyEvent let s:res = [expand("<afile>"), expand("<amatch>")] |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2527 doautocmd User MyEvent |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2528 call assert_equal(['MyEvent', 'MyEvent'], s:res) |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2529 au! User |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2530 unlet s:res |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2531 endfunc |
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2532 |
31073
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2533 func Test_autocmd_user_clear_group() |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2534 CheckRunVimInTerminal |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2535 |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2536 let lines =<< trim END |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2537 autocmd! User |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2538 for i in range(1, 999) |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2539 exe 'autocmd User ' .. 'Foo' .. i .. ' bar' |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2540 endfor |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2541 au CmdlineLeave : call timer_start(0, {-> execute('autocmd! User')}) |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2542 END |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2543 call writefile(lines, 'XautoUser', 'D') |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2544 let buf = RunVimInTerminal('-S XautoUser', {'rows': 10}) |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2545 |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2546 " this was using freed memory |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2547 call term_sendkeys(buf, ":autocmd User\<CR>") |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2548 call TermWait(buf, 50) |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2549 call term_sendkeys(buf, "G") |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2550 |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2551 call StopVimInTerminal(buf) |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2552 endfunc |
df4957f0ccb5
patch 9.0.0871: using freed memory when clearing augroup at more prompt
Bram Moolenaar <Bram@vim.org>
parents:
30912
diff
changeset
|
2553 |
31231
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2554 func Test_autocmd_CmdlineLeave_unlet() |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2555 CheckRunVimInTerminal |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2556 |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2557 let lines =<< trim END |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2558 for i in range(1, 999) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2559 exe 'let g:var' .. i '=' i |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2560 endfor |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2561 au CmdlineLeave : call timer_start(0, {-> execute('unlet g:var990')}) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2562 END |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2563 call writefile(lines, 'XleaveUnlet', 'D') |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2564 let buf = RunVimInTerminal('-S XleaveUnlet', {'rows': 10}) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2565 |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2566 " this was using freed memory |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2567 call term_sendkeys(buf, ":let g:\<CR>") |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2568 call TermWait(buf, 50) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2569 call term_sendkeys(buf, "G") |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2570 call TermWait(buf, 50) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2571 call term_sendkeys(buf, "\<CR>") " for the hit-enter prompt |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2572 |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2573 call StopVimInTerminal(buf) |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2574 endfunc |
684e6dfa2fba
patch 9.0.0949: crash when unletting a variable while listing variables
Bram Moolenaar <Bram@vim.org>
parents:
31166
diff
changeset
|
2575 |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2576 function s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2577 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2578 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2579 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2580 let s:li = [] |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2581 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
|
2582 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
|
2583 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
|
2584 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
|
2585 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
|
2586 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2587 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2588 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
|
2589 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
|
2590 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
|
2591 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
|
2592 augroup test_dirchanged |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2593 autocmd! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2594 augroup END |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2595 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2596 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2597 function Test_dirchanged_global() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2598 call s:Before_test_dirchanged() |
27639
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2599 autocmd test_dirchanged DirChangedPre global call add(s:li, expand("<amatch>") .. " pre cd " .. v:event.directory) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2600 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
|
2601 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
|
2602 call chdir(s:dir_foo) |
27639
8736d8b0a0bc
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Bram Moolenaar <Bram@vim.org>
parents:
27617
diff
changeset
|
2603 let expected = ["global pre cd " .. s:dir_foo, "cd:", s:dir_foo] |
27617
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2604 call assert_equal(expected, s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
2605 call chdir(s:dir_foo) |
27617
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2606 call assert_equal(expected, s:li) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
2607 exe 'lcd ' .. fnameescape(s:dir_bar) |
27617
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2608 call assert_equal(expected, s:li) |
29117
c7a8d4bf4d04
patch 8.2.5079: DirChanged autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
29062
diff
changeset
|
2609 |
c7a8d4bf4d04
patch 8.2.5079: DirChanged autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
29062
diff
changeset
|
2610 exe 'cd ' .. s:dir_foo |
c7a8d4bf4d04
patch 8.2.5079: DirChanged autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
29062
diff
changeset
|
2611 exe 'cd ' .. s:dir_bar |
c7a8d4bf4d04
patch 8.2.5079: DirChanged autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
29062
diff
changeset
|
2612 autocmd! test_dirchanged DirChanged global let g:result = expand("<afile>") |
c7a8d4bf4d04
patch 8.2.5079: DirChanged autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
29062
diff
changeset
|
2613 cd - |
29126
4385dfed5b29
patch 8.2.5083: autocmd test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
29122
diff
changeset
|
2614 call assert_equal(s:dir_foo, substitute(g:result, '\\', '/', 'g')) |
4385dfed5b29
patch 8.2.5083: autocmd test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
29122
diff
changeset
|
2615 |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2616 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2617 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2618 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2619 function Test_dirchanged_local() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2620 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2621 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
|
2622 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
|
2623 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
|
2624 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
|
2625 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
|
2626 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
|
2627 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
|
2628 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
|
2629 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2630 endfunc |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2631 |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2632 function Test_dirchanged_auto() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
2633 CheckOption autochdir |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2634 call s:Before_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2635 call test_autochdir() |
27617
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2636 autocmd test_dirchanged DirChangedPre auto call add(s:li, "pre cd " .. v:event.directory) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2637 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
|
2638 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
|
2639 set acd |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18283
diff
changeset
|
2640 cd .. |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2641 call assert_equal([], s:li) |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
2642 exe 'edit ' . s:dir_foo . '/Xautofile' |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
14485
diff
changeset
|
2643 call assert_equal(s:dir_foo, getcwd()) |
27617
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2644 let expected = ["pre cd " .. s:dir_foo, "auto:", s:dir_foo] |
269f89efb06a
patch 8.2.4335: no autocommand event triggered before changing directory
Bram Moolenaar <Bram@vim.org>
parents:
27241
diff
changeset
|
2645 call assert_equal(expected, s:li) |
13170
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2646 set noacd |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2647 bwipe! |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2648 call s:After_test_dirchanged() |
6559e98f3e74
patch 8.0.1459: cannot handle change of directory
Christian Brabandt <cb@256bit.org>
parents:
13142
diff
changeset
|
2649 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
|
2650 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2651 " 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
|
2652 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
|
2653 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
|
2654 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
|
2655 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
|
2656 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
|
2657 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2658 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
|
2659 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
|
2660 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
|
2661 |
25967
46205b125fbd
patch 8.2.3517: TextChanged does not trigger after TextChangedI
Bram Moolenaar <Bram@vim.org>
parents:
25866
diff
changeset
|
2662 " TextChanged will not be triggered, only check that it isn't. |
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
|
2663 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
|
2664 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
|
2665 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
|
2666 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2667 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
|
2668 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
|
2669 call feedkeys("o\<esc>", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2670 call assert_equal('I', g:autocmd) |
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
|
2671 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2672 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
|
2673 call feedkeys("Sf", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2674 call assert_equal('II', g:autocmd) |
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
|
2675 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2676 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
|
2677 call feedkeys("Sf\<C-N>", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2678 call assert_equal('IIP', g:autocmd) |
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
|
2679 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2680 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
|
2681 call feedkeys("Sf\<C-N>\<C-N>", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2682 call assert_equal('IIPP', g:autocmd) |
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
|
2683 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2684 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
|
2685 call feedkeys("Sf\<C-N>\<C-N>\<C-N>", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2686 call assert_equal('IIPPP', g:autocmd) |
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
|
2687 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2688 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
|
2689 call feedkeys("Sf\<C-N>\<C-N>\<C-N>\<C-N>", 'tnix') |
33676
46cd1fc257de
patch 9.0.2075: TextChangedI may not always trigger
Christian Brabandt <cb@256bit.org>
parents:
33572
diff
changeset
|
2690 call assert_equal('IIPPPP', g:autocmd) |
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
|
2691 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2692 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
|
2693 " 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
|
2694 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2695 " 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
|
2696 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
|
2697 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
|
2698 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
|
2699 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
|
2700 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
|
2701 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
|
2702 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
|
2703 |
5ed6e4a25925
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Christian Brabandt <cb@256bit.org>
parents:
13178
diff
changeset
|
2704 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
|
2705 endfunc |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2706 |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2707 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
|
2708 func SetLineOne() |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2709 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
|
2710 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
|
2711 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
|
2712 endif |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2713 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2714 |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2715 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
|
2716 new |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2717 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
|
2718 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
|
2719 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
|
2720 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
|
2721 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
|
2722 undo |
14485
c71d65c3672f
patch 8.1.0256: using setline() in TextChangedI splits undo
Christian Brabandt <cb@256bit.org>
parents:
14463
diff
changeset
|
2723 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
|
2724 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
|
2725 |
27241
959d6a664cfd
patch 8.2.4149: test override not restored, autocommand left behind
Bram Moolenaar <Bram@vim.org>
parents:
26998
diff
changeset
|
2726 call test_override('char_avail', 0) |
14463
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2727 bwipe! |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2728 endfunc |
3b87daa5c37a
patch 8.1.0245: calling setline() in TextChangedI autocmd breaks undo
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
2729 |
34307
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2730 func Test_TextChanged_with_norm() |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2731 " For unknown reason this fails on MS-Windows |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2732 CheckNotMSWindows |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2733 CheckFeature terminal |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2734 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2735 call assert_equal('running', term_getstatus(buf)) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2736 call term_sendkeys(buf, ":let g:a=0\<cr>") |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2737 call term_wait(buf, 50) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2738 call term_sendkeys(buf, ":au! TextChanged * :let g:a+=1\<cr>") |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2739 call term_wait(buf, 50) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2740 call term_sendkeys(buf, ":norm! ia\<cr>") |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2741 call term_wait(buf, 50) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2742 call term_sendkeys(buf, ":echo g:a\<cr>") |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2743 call term_wait(buf, 50) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2744 call WaitForAssert({-> assert_match('^1.*$', term_getline(buf, 3))}) |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2745 bwipe! |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2746 endfunc |
a66a01e2094a
patch 9.1.0088: TextChanged not triggered for :norm! commands
Christian Brabandt <cb@256bit.org>
parents:
34221
diff
changeset
|
2747 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2748 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
|
2749 CheckFeature terminal |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
2750 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
|
2751 " 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
|
2752 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
|
2753 |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2754 " Prepare file for TextChanged event. |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2755 call writefile([''], 'Xchanged.txt', 'D') |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2756 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
|
2757 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
|
2758 " 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
|
2759 " 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
|
2760 " 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
|
2761 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
|
2762 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
|
2763 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
|
2764 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
|
2765 endif |
13519
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2766 " 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
|
2767 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
|
2768 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
|
2769 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
|
2770 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
|
2771 |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2772 " clean up |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2773 bwipe! |
4a44c90dd671
patch 8.0.1633: a TextChanged autocmd triggers when it is defined
Christian Brabandt <cb@256bit.org>
parents:
13240
diff
changeset
|
2774 endfunc |
15611
bfcd7ffe9ac2
patch 8.1.0813: FileChangedShell not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
2775 |
16217
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2776 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
|
2777 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
|
2778 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
|
2779 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
|
2780 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
|
2781 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
|
2782 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2783 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
|
2784 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2785 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
|
2786 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2787 " 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
|
2788 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
|
2789 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2790 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
|
2791 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
|
2792 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
|
2793 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2794 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
|
2795 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2796 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
|
2797 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2798 " 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
|
2799 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
|
2800 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2801 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
|
2802 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
|
2803 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
|
2804 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2805 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
|
2806 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2807 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
|
2808 |
27960
be693de40634
patch 8.2.4505: Vim9: outdated "autocmd nested" still works
Bram Moolenaar <Bram@vim.org>
parents:
27639
diff
changeset
|
2809 " nested without ++ does not work in Vim9 script |
be693de40634
patch 8.2.4505: Vim9: outdated "autocmd nested" still works
Bram Moolenaar <Bram@vim.org>
parents:
27639
diff
changeset
|
2810 call assert_fails('vim9cmd au WinNew * nested echo fails', 'E1078:') |
be693de40634
patch 8.2.4505: Vim9: outdated "autocmd nested" still works
Bram Moolenaar <Bram@vim.org>
parents:
27639
diff
changeset
|
2811 |
16217
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2812 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
|
2813 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2814 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
|
2815 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2816 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
|
2817 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
|
2818 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2819 |
29438
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2820 func Test_autocmd_nested_cursor_invalid() |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2821 set laststatus=0 |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2822 copen |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2823 cclose |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2824 call setline(1, ['foo', 'bar', 'baz']) |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2825 3 |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2826 augroup nested_inv |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2827 autocmd User foo ++nested copen |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2828 autocmd BufAdd * let &laststatus = 2 - &laststatus |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2829 augroup END |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2830 doautocmd User foo |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2831 |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2832 augroup nested_inv |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2833 au! |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2834 augroup END |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2835 set laststatus& |
29471
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2836 cclose |
29438
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2837 bwipe! |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2838 endfunc |
87da4bab5aaa
patch 9.0.0061: ml_get error with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29126
diff
changeset
|
2839 |
29505
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2840 func Test_autocmd_nested_keeps_cursor_pos() |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2841 enew |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2842 call setline(1, 'foo') |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2843 autocmd User foo ++nested normal! $a |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2844 autocmd InsertLeave * : |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2845 doautocmd User foo |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2846 call assert_equal([0, 1, 3, 0], getpos('.')) |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2847 |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2848 bwipe! |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2849 endfunc |
33983b2f030f
patch 9.0.0094: cursor restored unexpected with nested autocommand
Bram Moolenaar <Bram@vim.org>
parents:
29483
diff
changeset
|
2850 |
29471
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2851 func Test_autocmd_nested_switch_window() |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2852 " run this in a separate Vim so that SafeState works |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2853 CheckRunVimInTerminal |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2854 |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2855 let lines =<< trim END |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2856 vim9script |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2857 ['()']->writefile('Xautofile') |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2858 autocmd VimEnter * ++nested edit Xautofile | split |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2859 autocmd BufReadPost * autocmd SafeState * ++once foldclosed('.') |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2860 autocmd WinEnter * matchadd('ErrorMsg', 'pat') |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2861 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
2862 call writefile(lines, 'Xautoscript', 'D') |
29471
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2863 let buf = RunVimInTerminal('-S Xautoscript', {'rows': 10}) |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2864 call VerifyScreenDump(buf, 'Test_autocmd_nested_switch', {}) |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2865 |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2866 call StopVimInTerminal(buf) |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2867 call delete('Xautofile') |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2868 endfunc |
9ada26920941
patch 9.0.0077: wrong restored cursor position when switching window in autocmd
Bram Moolenaar <Bram@vim.org>
parents:
29438
diff
changeset
|
2869 |
16217
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2870 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
|
2871 " 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
|
2872 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
|
2873 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
|
2874 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
|
2875 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
|
2876 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2877 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2878 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
|
2879 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
|
2880 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2881 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2882 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2883 " 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
|
2884 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
|
2885 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
|
2886 au! |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2887 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
|
2888 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
|
2889 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2890 split |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2891 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
|
2892 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
|
2893 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2894 close |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2895 |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2896 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
|
2897 endfunc |
81e6940504e8
patch 8.1.1113: making an autocommand trigger once is not so easy
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
2898 |
16401
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2899 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
|
2900 new |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2901 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
|
2902 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
|
2903 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
|
2904 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
|
2905 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
|
2906 sp |
19752
0927df746554
patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents:
19699
diff
changeset
|
2907 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
|
2908 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
|
2909 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
|
2910 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
|
2911 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
|
2912 " 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
|
2913 " 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
|
2914 edit |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2915 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
|
2916 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
|
2917 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
|
2918 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
|
2919 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
|
2920 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
|
2921 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
|
2922 " 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
|
2923 " (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
|
2924 " 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
|
2925 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
|
2926 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
|
2927 " 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
|
2928 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
|
2929 " 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
|
2930 e |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2931 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
|
2932 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
|
2933 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
|
2934 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
|
2935 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
|
2936 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
|
2937 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
|
2938 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2939 close |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2940 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
|
2941 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
|
2942 endfunc |
3b2db762a509
patch 8.1.1205: a BufReadPre autocommand may cause the cursor to move
Bram Moolenaar <Bram@vim.org>
parents:
16397
diff
changeset
|
2943 |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15611
diff
changeset
|
2944 " 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
|
2945 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2946 " 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
|
2947 " - 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
|
2948 " - 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
|
2949 " - 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
|
2950 " - 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
|
2951 " - 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
|
2952 " - 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
|
2953 " - 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
|
2954 " - FileReadPost decompress the file |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2955 func Test_ReadWrite_Autocmds() |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2956 " 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
|
2957 CheckUnix |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21638
diff
changeset
|
2958 CheckExecutable gzip |
16397
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2959 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2960 " 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
|
2961 let $GZIP = "" |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2962 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2963 " 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
|
2964 " 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
|
2965 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
|
2966 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2967 " 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
|
2968 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2969 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2970 au FileWritePre *.gz '[,']!gzip |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2971 au FileWritePost *.gz undo |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2972 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
|
2973 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2974 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2975 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2976 set bin |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2977 call append(0, [ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2978 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2979 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2980 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2981 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2982 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2983 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2984 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2985 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2986 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2987 \ ]) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2988 1,9write! Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2989 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2990 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2991 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2992 " 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
|
2993 0read Xtestfile.gz |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2994 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2995 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2996 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2997 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2998 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
2999 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3000 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3001 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3002 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3003 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3004 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3005 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3006 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3007 augroup Test1 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3008 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3009 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3010 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3011 " 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
|
3012 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3013 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3014 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
|
3015 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
|
3016 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
|
3017 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3018 |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3019 call writefile(['/*', ' * Here is a new .c file', ' */'], 'Xtest.c', 'D') |
16397
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3020 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
|
3021 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
|
3022 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
|
3023 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3024 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
|
3025 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
|
3026 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
|
3027 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3028 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3029 enew! | close |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3030 augroup Test2 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3031 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3032 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3033 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3034 " 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
|
3035 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3036 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3037 " 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
|
3038 " afterwards |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3039 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
|
3040 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
|
3041 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
|
3042 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
|
3043 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3044 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3045 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
|
3046 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3047 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3048 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3049 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3050 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3051 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3052 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3053 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3054 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3055 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3056 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3057 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3058 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
|
3059 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3060 augroup Test3 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3061 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3062 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3063 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3064 " 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
|
3065 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
|
3066 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3067 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3068 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
|
3069 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
|
3070 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
|
3071 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
|
3072 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3073 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3074 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
|
3075 1,$!cat |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3076 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3077 \ 'linE 2 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3078 \ 'linE 3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3079 \ 'linE 4 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3080 \ 'linE 5 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3081 \ 'linE 6 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3082 \ 'linE 7 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3083 \ 'linE 8 AbcdefghijklmnopqrstuvwXyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3084 \ 'linE 9 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3085 \ 'linE 10 AbcdefghijklmnopqrstuvwXyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3086 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3087 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3088 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3089 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3090 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3091 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3092 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3093 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3094 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3095 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3096 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3097 \ ], readfile('test.out')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3098 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3099 augroup Test4 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3100 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3101 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3102 set shelltemp&vim |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3103 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3104 " 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
|
3105 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3106 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3107 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
|
3108 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
|
3109 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
|
3110 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3111 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3112 new |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3113 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
|
3114 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3115 \ 'Line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3116 \ 'Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3117 \ 'Line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3118 \ 'Line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3119 \ 'Line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3120 \ 'Line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3121 \ 'Line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3122 \ 'Line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3123 \ 'Line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3124 \ ], getline(1, 9)) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3125 call assert_equal([ |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3126 \ 'line 2 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3127 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3128 \ 'line 4 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3129 \ 'line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3130 \ 'line 6 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3131 \ 'line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3132 \ 'line 8 Abcdefghijklmnopqrstuvwxyz', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3133 \ 'line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3134 \ 'line 10 Abcdefghijklmnopqrstuvwxyz' |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3135 \ ], readfile('Xtestfile.gz')) |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3136 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3137 augroup Test5 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3138 au! |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3139 augroup END |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3140 |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3141 au! FileChangedShell |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3142 call delete('Xtestfile.gz') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3143 call delete('test.out') |
7a942d92980d
patch 8.1.1203: some autocmd tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
16217
diff
changeset
|
3144 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
|
3145 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3146 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
|
3147 new |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3148 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
|
3149 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
|
3150 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
|
3151 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
|
3152 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
|
3153 try |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3154 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
|
3155 catch |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3156 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
|
3157 endtry |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3158 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
|
3159 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
|
3160 |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3161 bwipe! |
24233eeaadd0
patch 8.1.1311: aborting an autocmd with an exception is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16401
diff
changeset
|
3162 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
|
3163 endfunc |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3164 |
25838
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3165 func Test_autocmd_in_try_block() |
30150
0fe61fa4e5d1
patch 9.0.0411: only created files can be cleaned up with one call
Bram Moolenaar <Bram@vim.org>
parents:
30089
diff
changeset
|
3166 call mkdir('Xintrydir', 'R') |
25838
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3167 au BufEnter * let g:fname = expand('%') |
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3168 try |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29950
diff
changeset
|
3169 edit Xintrydir/ |
25838
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3170 endtry |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29950
diff
changeset
|
3171 call assert_match('Xintrydir', g:fname) |
25838
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3172 |
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3173 unlet g:fname |
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3174 au! BufEnter |
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3175 endfunc |
15fe946b1a41
patch 8.2.3453: autocmd not executed when editing a directory
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
3176 |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3177 func Test_autocmd_SafeState() |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3178 CheckRunVimInTerminal |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3179 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3180 let lines =<< trim END |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3181 let g:safe = 0 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3182 let g:again = '' |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3183 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
|
3184 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
|
3185 func CallTimer() |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3186 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
|
3187 endfunc |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3188 END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3189 call writefile(lines, 'XSafeState', 'D') |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3190 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
|
3191 |
23229
b545334ae654
patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents:
23027
diff
changeset
|
3192 " Sometimes we loop to handle a K_IGNORE, SafeState may be triggered once or |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
3193 " more often. |
18144
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3194 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
|
3195 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
|
3196 |
19505
e7eec9cae0ea
patch 8.2.0310: autocmd test fails on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19491
diff
changeset
|
3197 " 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
|
3198 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
|
3199 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
|
3200 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3201 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
|
3202 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
|
3203 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
|
3204 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
|
3205 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
|
3206 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
|
3207 |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3208 call StopVimInTerminal(buf) |
95719bfeced2
patch 8.1.2067: no tests for SafeState and SafeStateAgain
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
3209 endfunc |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3210 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3211 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
|
3212 CheckRunVimInTerminal |
23748
93f90f2ff4e9
patch 8.2.2415: no way to check for the cmdwin feature
Bram Moolenaar <Bram@vim.org>
parents:
23634
diff
changeset
|
3213 |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3214 let lines =<< trim END |
26153
44fe7d15881d
patch 8.2.3608: users who type "q:" instead of ":q" are confused
Bram Moolenaar <Bram@vim.org>
parents:
26117
diff
changeset
|
3215 augroup vimHints | au! | augroup END |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3216 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
|
3217 autocmd CmdWinEnter * quit |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3218 let winnr = winnr('$') |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3219 END |
23278
51b1a7e3e4ab
patch 8.2.2185: BufUnload is not triggered for the quickfix dummy buffer
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
3220 let filename = 'XCmdWinEnter' |
18227
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3221 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
|
3222 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
|
3223 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3224 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
|
3225 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
|
3226 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
|
3227 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
|
3228 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
|
3229 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
|
3230 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
|
3231 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
|
3232 |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3233 " clean up |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3234 call StopVimInTerminal(buf) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3235 call delete(filename) |
7d90fa3e5f8d
patch 8.1.2108: cannot close the cmdline window from CmdWinEnter
Bram Moolenaar <Bram@vim.org>
parents:
18148
diff
changeset
|
3236 endfunc |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3237 |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3238 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
|
3239 CheckFeature quickfix |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18619
diff
changeset
|
3240 |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3241 pedit xx |
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3242 n x |
23847
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3243 augroup winenter |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3244 au WinEnter * if winnr('$') > 2 | quit | endif |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3245 augroup END |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3246 split |
23847
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3247 |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3248 augroup winenter |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3249 au! WinEnter |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3250 augroup END |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3251 |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3252 bwipe xx |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3253 bwipe x |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3254 pclose |
18283
0cb608fc9c60
patch 8.1.2136: using freed memory with autocmd from fuzzer
Bram Moolenaar <Bram@vim.org>
parents:
18227
diff
changeset
|
3255 endfunc |
18619
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3256 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3257 func Test_BufWrite_lockmarks() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
25967
diff
changeset
|
3258 let g:test_is_flaky = 1 |
18619
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3259 edit! Xtest |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3260 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
|
3261 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3262 " :lockmarks preserves the marks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3263 call SetChangeMarks(2, 3) |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3264 lockmarks write |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3265 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
|
3266 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3267 " *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
|
3268 " 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
|
3269 augroup lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3270 au! |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3271 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
|
3272 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
|
3273 augroup END |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3274 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3275 lockmarks write |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3276 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
|
3277 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3278 if executable('cat') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3279 lockmarks %!cat |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3280 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
|
3281 endif |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3282 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3283 lockmarks 3,4write Xtest2 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3284 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
|
3285 |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3286 au! lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3287 augroup! lockmarks |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3288 call delete('Xtest') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3289 call delete('Xtest2') |
788d76db02ac
patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents:
18592
diff
changeset
|
3290 endfunc |
19073
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3291 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3292 func Test_FileType_spell() |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3293 if !isdirectory('/tmp') |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3294 throw "Skipped: requires /tmp directory" |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3295 endif |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3296 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3297 " 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
|
3298 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
|
3299 augroup crash |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3300 autocmd! |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3301 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
|
3302 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
|
3303 autocmd FileType anotherfiletype setlocal spell |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3304 augroup END |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3305 func! NoCrash() abort |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3306 edit /tmp/crashfile |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3307 endfunc |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3308 call NoCrash() |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3309 |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3310 au! crash |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3311 setglobal spellfile= |
45eb6f37692e
patch 8.2.0097: crash with autocommand and spellfile
Bram Moolenaar <Bram@vim.org>
parents:
18832
diff
changeset
|
3312 endfunc |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19073
diff
changeset
|
3313 |
30558
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3314 " this was wiping out the current buffer and using freed memory |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3315 func Test_SpellFileMissing_bwipe() |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3316 next 0 |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3317 au SpellFileMissing 0 bwipe |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3318 call assert_fails('set spell spelllang=0', 'E937:') |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3319 |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3320 au! SpellFileMissing |
31158
514ab6bdf73d
patch 9.0.0913: only change in current window triggers the WinScrolled event
Bram Moolenaar <Bram@vim.org>
parents:
31150
diff
changeset
|
3321 set nospell spelllang=en |
30558
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3322 bwipe |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3323 endfunc |
8e73ecbee60d
patch 9.0.0614: SpellFileMissing autocmd may delete buffer
Bram Moolenaar <Bram@vim.org>
parents:
30457
diff
changeset
|
3324 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3325 " 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
|
3326 " 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
|
3327 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
|
3328 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
|
3329 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3330 augroup FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3331 au! |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3332 autocmd FileChangedRO * quit |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3333 augroup END |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3334 new |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3335 set readonly |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3336 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
|
3337 close |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3338 augroup! FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3339 |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3340 augroup FileChangedROTest |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3341 au! |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3342 autocmd FileChangedRO * edit Xrofile |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3343 augroup END |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3344 new |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3345 set readonly |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3346 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
|
3347 close |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3348 augroup! FileChangedROTest |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
3349 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
|
3350 endfunc |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
3351 |
19489
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3352 func LogACmd() |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3353 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
|
3354 endfunc |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3355 |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3356 func Test_TermChanged() |
19491
7803c6e82a87
patch 8.2.0303: TermChanged test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
19489
diff
changeset
|
3357 CheckNotGui |
7803c6e82a87
patch 8.2.0303: TermChanged test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
19489
diff
changeset
|
3358 |
19489
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3359 enew! |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3360 tabnew |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3361 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
|
3362 $ |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3363 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
|
3364 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
|
3365 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
|
3366 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
|
3367 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
|
3368 |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3369 au! TermChanged |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3370 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
|
3371 bwipe! |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3372 endfunc |
31ac050a29a7
patch 8.2.0302: setting 'term' may cause error in TermChanged autocommand
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
3373 |
19699
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3374 " Test for FileReadCmd autocmd |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3375 func Test_autocmd_FileReadCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3376 func ReadFileCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3377 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
|
3378 endfunc |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3379 augroup FileReadCmdTest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3380 au! |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3381 au FileReadCmd Xtest call ReadFileCmd() |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3382 augroup END |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3383 |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3384 new |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3385 read ++bin Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3386 read ++nobin Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3387 read ++edit Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3388 read ++bad=keep Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3389 read ++bad=drop Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3390 read ++bad=- Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3391 read ++ff=unix Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3392 read ++ff=dos Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3393 read ++ff=mac Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3394 read ++enc=utf-8 Xtest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3395 |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3396 call assert_equal(['', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3397 \ 'v:cmdarg = ++bin', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3398 \ 'v:cmdarg = ++nobin', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3399 \ 'v:cmdarg = ++edit', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3400 \ 'v:cmdarg = ++bad=keep', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3401 \ 'v:cmdarg = ++bad=drop', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3402 \ 'v:cmdarg = ++bad=-', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3403 \ 'v:cmdarg = ++ff=unix', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3404 \ 'v:cmdarg = ++ff=dos', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3405 \ 'v:cmdarg = ++ff=mac', |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3406 \ '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
|
3407 |
31353
49bd0e97549d
patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents:
31263
diff
changeset
|
3408 bwipe! |
19699
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3409 augroup FileReadCmdTest |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3410 au! |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3411 augroup END |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3412 delfunc ReadFileCmd |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3413 endfunc |
4e9c794c3af1
patch 8.2.0406: FileReadCmd event not well tested
Bram Moolenaar <Bram@vim.org>
parents:
19691
diff
changeset
|
3414 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3415 " 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
|
3416 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
|
3417 " Additional character after * for event |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3418 call assert_fails('autocmd *a Xinvfile set ff=unix', 'E215:') |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3419 augroup Test |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3420 augroup END |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3421 " Invalid autocmd event |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3422 call assert_fails('autocmd Bufabc Xinvfile set ft=vim', 'E216:') |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3423 " Invalid autocmd event in a autocmd group |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3424 call assert_fails('autocmd Test Bufabc Xinvfile set ft=vim', 'E216:') |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3425 augroup! Test |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3426 " Execute all autocmds |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3427 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
|
3428 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
|
3429 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
|
3430 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
|
3431 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3432 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3433 " 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
|
3434 func Test_autocmd_deep_nesting() |
29997
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3435 autocmd BufEnter Xdeepfile doautocmd BufEnter Xdeepfile |
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3436 call assert_fails('doautocmd BufEnter Xdeepfile', 'E218:') |
98f5a0618a77
patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents:
29988
diff
changeset
|
3437 autocmd! BufEnter Xdeepfile |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3438 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19836
diff
changeset
|
3439 |
20800
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3440 " 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
|
3441 func Test_autocmd_sigusr1() |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3442 CheckUnix |
30457
7ab65e398be7
patch 9.0.0564: a few tests keep failing on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
30429
diff
changeset
|
3443 " FIXME: should this work on MacOS M1? |
7ab65e398be7
patch 9.0.0564: a few tests keep failing on MacOS M1
Bram Moolenaar <Bram@vim.org>
parents:
30429
diff
changeset
|
3444 CheckNotMacM1 |
22576
170077e26bde
patch 8.2.1836: autocmd test fails on pacifist systems
Bram Moolenaar <Bram@vim.org>
parents:
22375
diff
changeset
|
3445 CheckExecutable /bin/kill |
20800
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3446 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3447 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
|
3448 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
|
3449 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
|
3450 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
|
3451 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3452 au! SigUSR1 |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3453 unlet g:sigusr1_passed |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3454 endfunc |
e76b83c07bd8
patch 8.2.0952: no simple way to interrupt Vim
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
3455 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3456 " 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
|
3457 func Test_BufReadPre_delfile() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3458 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3459 au! |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
3460 autocmd BufReadPre XbufreadPre call delete('XbufreadPre') |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3461 augroup END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3462 call writefile([], 'XbufreadPre', 'D') |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
3463 call assert_fails('new XbufreadPre', 'E200:') |
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
3464 call assert_equal('XbufreadPre', @%) |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3465 call assert_equal(1, &readonly) |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3466 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3467 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3468 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3469 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3470 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3471 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3472 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3473 " 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
|
3474 func Test_BufReadPre_changebuf() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3475 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3476 au! |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
3477 autocmd BufReadPre Xchangebuf edit Xsomeotherfile |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3478 augroup END |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3479 call writefile([], 'Xchangebuf', 'D') |
29950
c8b1a683323c
patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29932
diff
changeset
|
3480 call assert_fails('new Xchangebuf', 'E201:') |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3481 call assert_equal('Xsomeotherfile', @%) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3482 call assert_equal(1, &readonly) |
30089
0a50e536de81
patch 9.0.0380: deleting files in tests is a hassle
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
3483 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3484 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3485 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3486 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3487 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3488 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3489 |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3490 " 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
|
3491 " 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
|
3492 func Test_BufDelete_changebuf() |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3493 new |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3494 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3495 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3496 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
|
3497 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3498 let save_cpo = &cpo |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3499 set cpo+=f |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29997
diff
changeset
|
3500 call assert_fails('r Xchangebuf', ['E812:', 'E484:']) |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3501 call assert_equal('somefile', @%) |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3502 let &cpo = save_cpo |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3503 augroup TestAuCmd |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3504 au! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3505 augroup END |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3506 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3507 endfunc |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
20824
diff
changeset
|
3508 |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3509 " 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
|
3510 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
|
3511 %bw! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3512 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
|
3513 tabnew two.txt |
24110
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3514 vnew three.txt |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3515 tabnew four.txt |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3516 tabprevious |
20879
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3517 let g:blist = [] |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3518 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
|
3519 au! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3520 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
|
3521 \ 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
|
3522 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
|
3523 |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3524 doautoall BufEnter |
24110
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3525 call assert_equal([ |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3526 \ ['one.txt', 'autocmd'], |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3527 \ ['two.txt', ''], |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3528 \ ['four.txt', 'autocmd'], |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3529 \ ['three.txt', ''], |
03438d77d8ab
patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Bram Moolenaar <Bram@vim.org>
parents:
23871
diff
changeset
|
3530 \ ], 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
|
3531 |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3532 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
|
3533 au! |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3534 augroup END |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3535 augroup! aucmd_win_test1 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3536 %bw! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3537 endfunc |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3538 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3539 " 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
|
3540 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
|
3541 %bw! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3542 edit one.txt |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3543 tabnew two.txt |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3544 augroup aucmd_win_test2 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3545 au! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3546 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
|
3547 augroup END |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3548 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3549 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
|
3550 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3551 augroup aucmd_win_test2 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3552 au! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3553 augroup END |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
20889
diff
changeset
|
3554 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
|
3555 %bwipe! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3556 endfunc |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3557 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3558 " 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
|
3559 " an autocmd. |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3560 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
|
3561 edit one.txt |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3562 tabnew two.txt |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3563 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
|
3564 au! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3565 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
|
3566 augroup END |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3567 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3568 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
|
3569 |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3570 tabonly |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3571 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
|
3572 au! |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3573 augroup END |
0738c44504cb
patch 8.2.1059: crash when using :tabonly in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
3574 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
|
3575 %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
|
3576 endfunc |
0ab45b558621
patch 8.2.0991: cannot get window type for autocmd and preview window
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
3577 |
26998
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3578 func Test_Visual_doautoall_redraw() |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3579 call setline(1, ['a', 'b']) |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31764
diff
changeset
|
3580 new |
26998
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3581 wincmd p |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3582 call feedkeys("G\<C-V>", 'txn') |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3583 autocmd User Explode ++once redraw |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3584 doautoall User Explode |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3585 %bwipe! |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3586 endfunc |
b0ef52086d57
patch 8.2.4028: ml_get error with :doautoall and Visual area
Bram Moolenaar <Bram@vim.org>
parents:
26715
diff
changeset
|
3587 |
23843
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3588 " This was using freed memory. |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3589 func Test_BufNew_arglocal() |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3590 arglocal |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3591 au BufNew * arglocal |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3592 call assert_fails('drop xx', 'E1156:') |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3593 |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3594 au! BufNew |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3595 endfunc |
d97258eca25d
patch 8.2.2463: using :arglocal in an autocommand may use freed memory
Bram Moolenaar <Bram@vim.org>
parents:
23760
diff
changeset
|
3596 |
23845
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3597 func Test_autocmd_closes_window() |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3598 au BufNew,BufWinLeave * e %e |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3599 file yyy |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3600 au BufNew,BufWinLeave * ball |
23861
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3601 n xxx |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3602 |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3603 %bwipe |
23845
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3604 au! BufNew |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3605 au! BufWinLeave |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3606 endfunc |
7517eb94239b
patch 8.2.2464: using freed memory if window closed in autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23843
diff
changeset
|
3607 |
23847
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3608 func Test_autocmd_quit_psearch() |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3609 sn aa bb |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3610 augroup aucmd_win_test |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3611 au! |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3612 au BufEnter,BufLeave,BufNew,WinEnter,WinLeave,WinNew * if winnr('$') > 1 | q | endif |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3613 augroup END |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3614 ps / |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3615 |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3616 augroup aucmd_win_test |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3617 au! |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3618 augroup END |
28556
ea98e79c9677
patch 8.2.4802: test is not cleaned up
Bram Moolenaar <Bram@vim.org>
parents:
28534
diff
changeset
|
3619 new |
ea98e79c9677
patch 8.2.4802: test is not cleaned up
Bram Moolenaar <Bram@vim.org>
parents:
28534
diff
changeset
|
3620 pclose |
23847
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3621 endfunc |
b0e7fa957cd1
patch 8.2.2465: using freed memory in :psearch
Bram Moolenaar <Bram@vim.org>
parents:
23845
diff
changeset
|
3622 |
23861
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3623 " Fuzzer found some strange combination that caused a crash. |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3624 func Test_autocmd_normal_mess() |
23871
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3625 " For unknown reason this hangs on MS-Windows |
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3626 CheckNotMSWindows |
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3627 |
23861
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3628 augroup aucmd_normal_test |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3629 au BufLeave,BufWinLeave,BufHidden,BufUnload,BufDelete,BufWipeout * norm 7q/qc |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3630 augroup END |
23869
5a4f9c5c1b99
patch 8.2.2476: using freed memory when splitting window while closing buffer
Bram Moolenaar <Bram@vim.org>
parents:
23867
diff
changeset
|
3631 call assert_fails('o4', 'E1159') |
23861
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3632 silent! H |
23869
5a4f9c5c1b99
patch 8.2.2476: using freed memory when splitting window while closing buffer
Bram Moolenaar <Bram@vim.org>
parents:
23867
diff
changeset
|
3633 call assert_fails('e xx', 'E1159') |
23861
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3634 normal G |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3635 |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3636 augroup aucmd_normal_test |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3637 au! |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3638 augroup END |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3639 endfunc |
5d11a15dbaa9
patch 8.2.2472: crash when using command line window in an autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23847
diff
changeset
|
3640 |
23863
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3641 func Test_autocmd_closing_cmdwin() |
23871
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3642 " For unknown reason this hangs on MS-Windows |
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3643 CheckNotMSWindows |
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3644 |
23863
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3645 au BufWinLeave * nested q |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3646 call assert_fails("norm 7q?\n", 'E855:') |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3647 |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3648 au! BufWinLeave |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3649 new |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3650 only |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3651 endfunc |
a91f3147d06e
patch 8.2.2473: crash when leaving command line window triggers autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23861
diff
changeset
|
3652 |
23865
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3653 func Test_autocmd_vimgrep() |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3654 augroup aucmd_vimgrep |
28534
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3655 au QuickfixCmdPre,BufNew,BufReadCmd * sb |
28556
ea98e79c9677
patch 8.2.4802: test is not cleaned up
Bram Moolenaar <Bram@vim.org>
parents:
28534
diff
changeset
|
3656 au QuickfixCmdPre,BufNew,BufReadCmd * q9 |
23865
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3657 augroup END |
23871
533d6f1abbcf
patch 8.2.2477: autocommand tests hang on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
23869
diff
changeset
|
3658 call assert_fails('lv ?a? foo', 'E926:') |
23865
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3659 |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3660 augroup aucmd_vimgrep |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3661 au! |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3662 augroup END |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3663 endfunc |
e1643a1aa1a0
patch 8.2.2474: using freed memory when window is closed by autocommand
Bram Moolenaar <Bram@vim.org>
parents:
23863
diff
changeset
|
3664 |
25463
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3665 func Test_autocmd_with_block() |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3666 augroup block_testing |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3667 au BufReadPost *.xml { |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3668 setlocal matchpairs+=<:> |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3669 /<start |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3670 } |
25521
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3671 au CursorHold * { |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3672 autocmd BufReadPre * ++once echo 'one' | echo 'two' |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3673 g:gotSafeState = 77 |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3674 } |
25463
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3675 augroup END |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3676 |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3677 let expected = "\n--- Autocommands ---\nblock_testing BufRead\n *.xml {^@ setlocal matchpairs+=<:>^@ /<start^@ }" |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3678 call assert_equal(expected, execute('au BufReadPost *.xml')) |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3679 |
25521
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3680 doautocmd CursorHold |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3681 call assert_equal(77, g:gotSafeState) |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3682 unlet g:gotSafeState |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25463
diff
changeset
|
3683 |
25463
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3684 augroup block_testing |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3685 au! |
29062
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3686 autocmd CursorHold * { |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3687 if true |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3688 # comment |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3689 && true |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3690 |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3691 && true |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3692 g:done = 'yes' |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3693 endif |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3694 } |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3695 augroup END |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3696 doautocmd CursorHold |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3697 call assert_equal('yes', g:done) |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3698 |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3699 unlet g:done |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3700 augroup block_testing |
036b4d49c4a0
patch 8.2.5053: cannot have a comment halfway an expression in a block
Bram Moolenaar <Bram@vim.org>
parents:
29054
diff
changeset
|
3701 au! |
25463
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3702 augroup END |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3703 endfunc |
05f9e8f2016c
patch 8.2.3268: cannot use a block with :autocmd like with :command
Bram Moolenaar <Bram@vim.org>
parents:
24110
diff
changeset
|
3704 |
28167
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3705 func Test_closing_autocmd_window() |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3706 let lines =<< trim END |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3707 edit Xa.txt |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3708 tabnew Xb.txt |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3709 autocmd BufEnter Xa.txt unhide 1 |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3710 doautoall BufEnter |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3711 END |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3712 call v9.CheckScriptFailure(lines, 'E814:') |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3713 au! BufEnter |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3714 bwipe Xa.txt |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3715 bwipe Xb.txt |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3716 endfunc |
a52a5e3363c4
patch 8.2.4609: :unhide does not check for failing to close a window
Bram Moolenaar <Bram@vim.org>
parents:
27960
diff
changeset
|
3717 |
33341
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3718 func Test_switch_window_in_autocmd_window() |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3719 edit Xa.txt |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3720 tabnew Xb.txt |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3721 autocmd BufEnter Xa.txt wincmd w |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3722 doautoall BufEnter |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3723 au! BufEnter |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3724 bwipe Xa.txt |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3725 call assert_false(bufexists('Xa.txt')) |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3726 bwipe Xb.txt |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3727 call assert_false(bufexists('Xb.txt')) |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3728 endfunc |
3dd54b0dab14
patch 9.0.1934: :bwipe fails after switching window from aucmd_win.
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
3729 |
34799
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3730 " Test that using the autocommand window doesn't change current directory. |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3731 func Test_autocmd_window_cwd() |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3732 let saveddir = getcwd() |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3733 call mkdir('Xcwd/a/b/c/d', 'pR') |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3734 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3735 new Xa.txt |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3736 tabnew |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3737 new Xb.txt |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3738 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3739 tabprev |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3740 cd Xcwd |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3741 call assert_match('/Xcwd$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3742 call assert_match('\[global\] .*/Xcwd$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3743 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3744 autocmd BufEnter Xb.txt lcd ./a/b/c/d |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3745 doautoall BufEnter |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3746 au! BufEnter |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3747 call assert_match('/Xcwd$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3748 call assert_match('\[global\] .*/Xcwd$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3749 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3750 tabnext |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3751 cd ./a |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3752 tcd ./b |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3753 lcd ./c |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3754 call assert_match('/Xcwd/a/b/c$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3755 call assert_match('\[window\] .*/Xcwd/a/b/c$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3756 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3757 autocmd BufEnter Xa.txt call assert_match('Xcwd/a/b/c$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3758 doautoall BufEnter |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3759 au! BufEnter |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3760 call assert_match('/Xcwd/a/b/c$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3761 call assert_match('\[window\] .*/Xcwd/a/b/c$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3762 bwipe! |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3763 call assert_match('/Xcwd/a/b$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3764 call assert_match('\[tabpage\] .*/Xcwd/a/b$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3765 bwipe! |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3766 call assert_match('/Xcwd/a$', getcwd()) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3767 call assert_match('\[global\] .*/Xcwd/a$', trim(execute('verbose pwd'))) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3768 bwipe! |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3769 |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3770 call chdir(saveddir) |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3771 endfunc |
f9b510d3ed32
patch 9.1.0272: autocmd may change cwd after :tcd and :lcd
Christian Brabandt <cb@256bit.org>
parents:
34790
diff
changeset
|
3772 |
28211
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3773 func Test_bufwipeout_changes_window() |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3774 " This should not crash, but we don't have any expectations about what |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3775 " happens, changing window in BufWipeout has unpredictable results. |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3776 tabedit |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3777 let g:window_id = win_getid() |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3778 topleft new |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3779 setlocal bufhidden=wipe |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3780 autocmd BufWipeout <buffer> call win_gotoid(g:window_id) |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3781 tabprevious |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3782 +tabclose |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3783 |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3784 unlet g:window_id |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3785 au! BufWipeout |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3786 %bwipe! |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3787 endfunc |
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3788 |
28407
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3789 func Test_v_event_readonly() |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3790 autocmd CompleteChanged * let v:event.width = 0 |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3791 call assert_fails("normal! i\<C-X>\<C-V>", 'E46:') |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3792 au! CompleteChanged |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3793 |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3794 autocmd DirChangedPre * let v:event.directory = '' |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3795 call assert_fails('cd .', 'E46:') |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3796 au! DirChangedPre |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3797 |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3798 autocmd ModeChanged * let v:event.new_mode = '' |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3799 call assert_fails('normal! cc', 'E46:') |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3800 au! ModeChanged |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3801 |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3802 autocmd TextYankPost * let v:event.operator = '' |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3803 call assert_fails('normal! yy', 'E46:') |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3804 au! TextYankPost |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3805 endfunc |
ed9b6069858b
patch 8.2.4728: no test that v:event cannot be modified
Bram Moolenaar <Bram@vim.org>
parents:
28384
diff
changeset
|
3806 |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3807 " Test for ModeChanged pattern |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3808 func Test_mode_changes() |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3809 let g:index = 0 |
32317
39320e75f567
patch 9.0.1490: the ModeChanged event may be triggered too often
Bram Moolenaar <Bram@vim.org>
parents:
32250
diff
changeset
|
3810 let g:mode_seq = ['n', 'i', 'n', 'v', 'V', 'i', 'ix', 'i', 'ic', 'i', 'n', 'no', 'noV', 'n', 'V', 'v', 's', 'n'] |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3811 func! TestMode() |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3812 call assert_equal(g:mode_seq[g:index], get(v:event, "old_mode")) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3813 call assert_equal(g:mode_seq[g:index + 1], get(v:event, "new_mode")) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3814 call assert_equal(mode(1), get(v:event, "new_mode")) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3815 let g:index += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3816 endfunc |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3817 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3818 au ModeChanged * :call TestMode() |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3819 let g:n_to_any = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3820 au ModeChanged n:* let g:n_to_any += 1 |
32317
39320e75f567
patch 9.0.1490: the ModeChanged event may be triggered too often
Bram Moolenaar <Bram@vim.org>
parents:
32250
diff
changeset
|
3821 call feedkeys("i\<esc>vVca\<CR>\<C-X>\<C-L>\<esc>ggdV\<MouseMove>G", 'tnix') |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3822 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3823 let g:V_to_v = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3824 au ModeChanged V:v let g:V_to_v += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3825 call feedkeys("Vv\<C-G>\<esc>", 'tnix') |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3826 call assert_equal(len(filter(g:mode_seq[1:], {idx, val -> val == 'n'})), g:n_to_any) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3827 call assert_equal(1, g:V_to_v) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3828 call assert_equal(len(g:mode_seq) - 1, g:index) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3829 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3830 let g:n_to_i = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3831 au ModeChanged n:i let g:n_to_i += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3832 let g:n_to_niI = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3833 au ModeChanged i:niI let g:n_to_niI += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3834 let g:niI_to_i = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3835 au ModeChanged niI:i let g:niI_to_i += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3836 let g:nany_to_i = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3837 au ModeChanged n*:i let g:nany_to_i += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3838 let g:i_to_n = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3839 au ModeChanged i:n let g:i_to_n += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3840 let g:nori_to_any = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3841 au ModeChanged [ni]:* let g:nori_to_any += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3842 let g:i_to_any = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3843 au ModeChanged i:* let g:i_to_any += 1 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3844 let g:index = 0 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3845 let g:mode_seq = ['n', 'i', 'niI', 'i', 'n'] |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3846 call feedkeys("a\<C-O>l\<esc>", 'tnix') |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3847 call assert_equal(len(g:mode_seq) - 1, g:index) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3848 call assert_equal(1, g:n_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3849 call assert_equal(1, g:n_to_niI) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3850 call assert_equal(1, g:niI_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3851 call assert_equal(2, g:nany_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3852 call assert_equal(1, g:i_to_n) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3853 call assert_equal(2, g:i_to_any) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3854 call assert_equal(3, g:nori_to_any) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3855 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3856 if has('terminal') |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3857 let g:mode_seq += ['c', 'n', 't', 'nt', 'c', 'nt', 'n'] |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3858 call feedkeys(":term\<CR>\<C-W>N:bd!\<CR>", 'tnix') |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3859 call assert_equal(len(g:mode_seq) - 1, g:index) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3860 call assert_equal(1, g:n_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3861 call assert_equal(1, g:n_to_niI) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3862 call assert_equal(1, g:niI_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3863 call assert_equal(2, g:nany_to_i) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3864 call assert_equal(1, g:i_to_n) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3865 call assert_equal(2, g:i_to_any) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3866 call assert_equal(5, g:nori_to_any) |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3867 endif |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3868 |
30657
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3869 let g:n_to_c = 0 |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3870 au ModeChanged n:c let g:n_to_c += 1 |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3871 let g:c_to_n = 0 |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3872 au ModeChanged c:n let g:c_to_n += 1 |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3873 let g:mode_seq += ['c', 'n', 'c', 'n'] |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3874 call feedkeys("q:\<C-C>\<Esc>", 'tnix') |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3875 call assert_equal(len(g:mode_seq) - 1, g:index) |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3876 call assert_equal(2, g:n_to_c) |
ac908e454519
patch 9.0.0663: tests check for +cmdwin feature which is always present
Bram Moolenaar <Bram@vim.org>
parents:
30558
diff
changeset
|
3877 call assert_equal(2, g:c_to_n) |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3878 |
30908
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3879 let g:n_to_v = 0 |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3880 au ModeChanged n:v let g:n_to_v += 1 |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3881 let g:v_to_n = 0 |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3882 au ModeChanged v:n let g:v_to_n += 1 |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3883 let g:mode_seq += ['v', 'n'] |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3884 call feedkeys("v\<C-C>", 'tnix') |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3885 call assert_equal(len(g:mode_seq) - 1, g:index) |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3886 call assert_equal(1, g:n_to_v) |
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3887 call assert_equal(1, g:v_to_n) |
33848
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3888 |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3889 let g:mode_seq += ['c', 'cr', 'c', 'cr', 'n'] |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3890 call feedkeys(":\<Insert>\<Insert>\<Insert>\<CR>", 'tnix') |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3891 call assert_equal(len(g:mode_seq) - 1, g:index) |
30908
11115c806541
patch 9.0.0788: ModeChanged autocmd not executed when Visual ends with CTRL-C
Bram Moolenaar <Bram@vim.org>
parents:
30657
diff
changeset
|
3892 |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3893 au! ModeChanged |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3894 delfunc TestMode |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3895 unlet! g:mode_seq |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3896 unlet! g:index |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3897 unlet! g:n_to_any |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3898 unlet! g:V_to_v |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3899 unlet! g:n_to_i |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3900 unlet! g:n_to_niI |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3901 unlet! g:niI_to_i |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3902 unlet! g:nany_to_i |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3903 unlet! g:i_to_n |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3904 unlet! g:nori_to_any |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3905 unlet! g:i_to_any |
33848
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3906 unlet! g:n_to_c |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3907 unlet! g:c_to_n |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3908 unlet! g:n_to_v |
c3804ff17204
patch 9.0.2135: No test for mode() when executing Ex commands
Christian Brabandt <cb@256bit.org>
parents:
33676
diff
changeset
|
3909 unlet! g:v_to_n |
29483
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3910 endfunc |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3911 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3912 func Test_recursive_ModeChanged() |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3913 au! ModeChanged * norm 0u |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3914 sil! norm |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3915 au! ModeChanged |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3916 endfunc |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3917 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3918 func Test_ModeChanged_starts_visual() |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3919 " This was triggering ModeChanged before setting VIsual, causing a crash. |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3920 au! ModeChanged * norm 0u |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3921 sil! norm |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3922 |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3923 au! ModeChanged |
2a327999c05c
patch 9.0.0083: ModeChanged event not triggered when leaving cmdline window
Bram Moolenaar <Bram@vim.org>
parents:
29471
diff
changeset
|
3924 endfunc |
28211
522864f990ec
patch 8.2.4631: crash when switching window in BufWipeout autocommand
Bram Moolenaar <Bram@vim.org>
parents:
28167
diff
changeset
|
3925 |
28534
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3926 func Test_noname_autocmd() |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3927 augroup test_noname_autocmd_group |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3928 autocmd! |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3929 autocmd BufEnter * call add(s:li, ["BufEnter", expand("<afile>")]) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3930 autocmd BufDelete * call add(s:li, ["BufDelete", expand("<afile>")]) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3931 autocmd BufLeave * call add(s:li, ["BufLeave", expand("<afile>")]) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3932 autocmd BufUnload * call add(s:li, ["BufUnload", expand("<afile>")]) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3933 autocmd BufWipeout * call add(s:li, ["BufWipeout", expand("<afile>")]) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3934 augroup END |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3935 |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3936 let s:li = [] |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3937 edit foo |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3938 call assert_equal([['BufUnload', ''], ['BufDelete', ''], ['BufWipeout', ''], ['BufEnter', 'foo']], s:li) |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3939 |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3940 au! test_noname_autocmd_group |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3941 augroup! test_noname_autocmd_group |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3942 endfunc |
2d600e916978
patch 8.2.4791: events triggered in different order when reusing buffer
Bram Moolenaar <Bram@vim.org>
parents:
28429
diff
changeset
|
3943 |
28917
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3944 " Test for the autocmd_get() function |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3945 func Test_autocmd_get() |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3946 augroup TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3947 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3948 autocmd BufAdd *.vim echo "bufadd-vim" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3949 autocmd BufAdd *.py echo "bufadd-py" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3950 autocmd BufHidden *.vim echo "bufhidden" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3951 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3952 augroup TestAutoCmdFns2 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3953 autocmd BufAdd *.vim echo "bufadd-vim-2" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3954 autocmd BufRead *.a1b2c3 echo "bufadd-vim-2" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3955 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3956 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3957 let l = autocmd_get() |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3958 call assert_true(l->len() > 0) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3959 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3960 " Test for getting all the autocmds in a group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3961 let expected = [ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3962 \ #{cmd: 'echo "bufadd-vim"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3963 \ pattern: '*.vim', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3964 \ event: 'BufAdd'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3965 \ #{cmd: 'echo "bufadd-py"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3966 \ pattern: '*.py', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3967 \ event: 'BufAdd'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3968 \ #{cmd: 'echo "bufhidden"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3969 \ pattern: '*.vim', nested: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3970 \ once: v:false, event: 'BufHidden'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3971 call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3972 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3973 " Test for getting autocmds for all the patterns in a group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3974 call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3975 \ event: '*'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3976 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3977 " Test for getting autocmds for an event in a group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3978 let expected = [ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3979 \ #{cmd: 'echo "bufadd-vim"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3980 \ pattern: '*.vim', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3981 \ event: 'BufAdd'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3982 \ #{cmd: 'echo "bufadd-py"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3983 \ pattern: '*.py', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3984 \ event: 'BufAdd'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3985 call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3986 \ event: 'BufAdd'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3987 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3988 " Test for getting the autocmds for all the events in a group for particular |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3989 " pattern |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3990 call assert_equal([{'cmd': 'echo "bufadd-py"', 'group': 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3991 \ 'pattern': '*.py', 'nested': v:false, 'once': v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3992 \ 'event': 'BufAdd'}], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3993 \ autocmd_get(#{group: 'TestAutoCmdFns', event: '*', pattern: '*.py'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3994 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3995 " Test for getting the autocmds for an events in a group for particular |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3996 " pattern |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3997 let l = autocmd_get(#{group: 'TestAutoCmdFns', event: 'BufAdd', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3998 \ pattern: '*.vim'}) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
3999 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4000 \ #{cmd: 'echo "bufadd-vim"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4001 \ pattern: '*.vim', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4002 \ event: 'BufAdd'}], l) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4003 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4004 " Test for getting the autocmds for a pattern in a group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4005 let l = autocmd_get(#{group: 'TestAutoCmdFns', pattern: '*.vim'}) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4006 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4007 \ #{cmd: 'echo "bufadd-vim"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4008 \ pattern: '*.vim', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4009 \ event: 'BufAdd'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4010 \ #{cmd: 'echo "bufhidden"', group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4011 \ pattern: '*.vim', nested: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4012 \ once: v:false, event: 'BufHidden'}], l) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4013 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4014 " Test for getting the autocmds for a pattern in all the groups |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4015 let l = autocmd_get(#{pattern: '*.a1b2c3'}) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4016 call assert_equal([{'cmd': 'echo "bufadd-vim-2"', 'group': 'TestAutoCmdFns2', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4017 \ 'pattern': '*.a1b2c3', 'nested': v:false, 'once': v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4018 \ 'event': 'BufRead'}], l) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4019 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4020 " Test for getting autocmds for a pattern without any autocmds |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4021 call assert_equal([], autocmd_get(#{group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4022 \ pattern: '*.abc'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4023 call assert_equal([], autocmd_get(#{group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4024 \ event: 'BufAdd', pattern: '*.abc'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4025 call assert_equal([], autocmd_get(#{group: 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4026 \ event: 'BufWipeout'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4027 call assert_fails("call autocmd_get(#{group: 'abc', event: 'BufAdd'})", |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4028 \ 'E367:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4029 let cmd = "echo autocmd_get(#{group: 'TestAutoCmdFns', event: 'abc'})" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4030 call assert_fails(cmd, 'E216:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4031 call assert_fails("call autocmd_get(#{group: 'abc'})", 'E367:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4032 call assert_fails("echo autocmd_get(#{event: 'abc'})", 'E216:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4033 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4034 augroup TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4035 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4036 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4037 call assert_equal([], autocmd_get(#{group: 'TestAutoCmdFns'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4038 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4039 " Test for nested and once autocmds |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4040 augroup TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4041 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4042 autocmd VimSuspend * ++nested echo "suspend" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4043 autocmd VimResume * ++once echo "resume" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4044 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4045 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4046 let expected = [ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4047 \ {'cmd': 'echo "suspend"', 'group': 'TestAutoCmdFns', 'pattern': '*', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4048 \ 'nested': v:true, 'once': v:false, 'event': 'VimSuspend'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4049 \ {'cmd': 'echo "resume"', 'group': 'TestAutoCmdFns', 'pattern': '*', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4050 \ 'nested': v:false, 'once': v:true, 'event': 'VimResume'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4051 call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4052 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4053 " Test for buffer-local autocmd |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4054 augroup TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4055 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4056 autocmd TextYankPost <buffer> echo "textyankpost" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4057 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4058 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4059 let expected = [ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4060 \ {'cmd': 'echo "textyankpost"', 'group': 'TestAutoCmdFns', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4061 \ 'pattern': '<buffer=' .. bufnr() .. '>', 'nested': v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4062 \ 'once': v:false, 'bufnr': bufnr(), 'event': 'TextYankPost'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4063 call assert_equal(expected, autocmd_get(#{group: 'TestAutoCmdFns'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4064 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4065 augroup TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4066 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4067 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4068 augroup! TestAutoCmdFns |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4069 augroup TestAutoCmdFns2 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4070 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4071 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4072 augroup! TestAutoCmdFns2 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4073 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4074 call assert_fails("echo autocmd_get(#{group: []})", 'E730:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4075 call assert_fails("echo autocmd_get(#{event: {}})", 'E731:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4076 call assert_fails("echo autocmd_get([])", 'E1206:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4077 endfunc |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4078 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4079 " Test for the autocmd_add() function |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4080 func Test_autocmd_add() |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4081 " Define a single autocmd in a group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4082 call autocmd_add([#{group: 'TestAcSet', event: 'BufAdd', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4083 \ cmd: 'echo "bufadd"', once: v:true, nested: v:true}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4084 call assert_equal([#{cmd: 'echo "bufadd"', group: 'TestAcSet', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4085 \ pattern: '*.sh', nested: v:true, once: v:true, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4086 \ event: 'BufAdd'}], autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4087 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4088 " Define two autocmds in the same group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4089 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4090 call autocmd_add([#{group: 'TestAcSet', event: 'BufAdd', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4091 \ cmd: 'echo "bufadd"'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4092 \ #{group: 'TestAcSet', event: 'BufEnter', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4093 \ cmd: 'echo "bufenter"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4094 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4095 \ #{cmd: 'echo "bufadd"', group: 'TestAcSet', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4096 \ nested: v:false, once: v:false, event: 'BufAdd'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4097 \ #{cmd: 'echo "bufenter"', group: 'TestAcSet', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4098 \ nested: v:false, once: v:false, event: 'BufEnter'}], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4099 \ autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4100 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4101 " Define a buffer-local autocmd |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4102 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4103 call autocmd_add([#{group: 'TestAcSet', event: 'CursorHold', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4104 \ bufnr: bufnr(), cmd: 'echo "cursorhold"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4105 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4106 \ #{cmd: 'echo "cursorhold"', group: 'TestAcSet', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4107 \ pattern: '<buffer=' .. bufnr() .. '>', nested: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4108 \ once: v:false, bufnr: bufnr(), event: 'CursorHold'}], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4109 \ autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4110 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4111 " Use an invalid buffer number |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4112 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4113 call autocmd_add([#{group: 'TestAcSet', event: 'BufEnter', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4114 \ bufnr: -1, cmd: 'echo "bufenter"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4115 let l = [#{group: 'TestAcSet', event: 'BufAdd', bufnr: 9999, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4116 \ cmd: 'echo "bufadd"'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4117 call assert_fails("echo autocmd_add(l)", 'E680:') |
29054
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4118 let l = [#{group: 'TestAcSet', event: 'BufAdd', bufnr: 9999, |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4119 \ pattern: '*.py', cmd: 'echo "bufadd"'}] |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4120 call assert_fails("echo autocmd_add(l)", 'E680:') |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4121 let l = [#{group: 'TestAcSet', event: 'BufAdd', bufnr: 9999, |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4122 \ pattern: ['*.py', '*.c'], cmd: 'echo "bufadd"'}] |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4123 call assert_fails("echo autocmd_add(l)", 'E680:') |
28917
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4124 let l = [#{group: 'TestAcSet', event: 'BufRead', bufnr: [], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4125 \ cmd: 'echo "bufread"'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4126 call assert_fails("echo autocmd_add(l)", 'E745:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4127 call assert_equal([], autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4128 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4129 " Add two commands to the same group, event and pattern |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4130 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4131 call autocmd_add([#{group: 'TestAcSet', event: 'BufUnload', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4132 \ pattern: 'abc', cmd: 'echo "cmd1"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4133 call autocmd_add([#{group: 'TestAcSet', event: 'BufUnload', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4134 \ pattern: 'abc', cmd: 'echo "cmd2"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4135 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4136 \ #{cmd: 'echo "cmd1"', group: 'TestAcSet', pattern: 'abc', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4137 \ nested: v:false, once: v:false, event: 'BufUnload'}, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4138 \ #{cmd: 'echo "cmd2"', group: 'TestAcSet', pattern: 'abc', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4139 \ nested: v:false, once: v:false, event: 'BufUnload'}], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4140 \ autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4141 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4142 " When adding a new autocmd, if the autocmd 'group' is not specified, then |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4143 " the current autocmd group should be used. |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4144 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4145 augroup TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4146 call autocmd_add([#{event: 'BufHidden', pattern: 'abc', cmd: 'echo "abc"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4147 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4148 call assert_equal([ |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4149 \ #{cmd: 'echo "abc"', group: 'TestAcSet', pattern: 'abc', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4150 \ nested: v:false, once: v:false, event: 'BufHidden'}], |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4151 \ autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4152 |
28978
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4153 " Test for replacing a cmd for an event in a group |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4154 call autocmd_delete([#{group: 'TestAcSet'}]) |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4155 call autocmd_add([#{replace: v:true, group: 'TestAcSet', event: 'BufEnter', |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4156 \ pattern: '*.py', cmd: 'echo "bufenter"'}]) |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4157 call autocmd_add([#{replace: v:true, group: 'TestAcSet', event: 'BufEnter', |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4158 \ pattern: '*.py', cmd: 'echo "bufenter"'}]) |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4159 call assert_equal([ |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4160 \ #{cmd: 'echo "bufenter"', group: 'TestAcSet', pattern: '*.py', |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4161 \ nested: v:false, once: v:false, event: 'BufEnter'}], |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4162 \ autocmd_get(#{group: 'TestAcSet'})) |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4163 |
3c3bdb8069f5
patch 8.2.5011: Replacing an autocommand requires several lines
Bram Moolenaar <Bram@vim.org>
parents:
28917
diff
changeset
|
4164 " Test for adding a command for an unsupported autocmd event |
28917
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4165 let l = [#{group: 'TestAcSet', event: 'abc', pattern: '*.sh', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4166 \ cmd: 'echo "bufadd"'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4167 call assert_fails('call autocmd_add(l)', 'E216:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4168 |
29016
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4169 " Test for using a list of events and patterns |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4170 call autocmd_delete([#{group: 'TestAcSet'}]) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4171 let l = [#{group: 'TestAcSet', event: ['BufEnter', 'BufLeave'], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4172 \ pattern: ['*.py', '*.sh'], cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4173 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4174 call assert_equal([ |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4175 \ #{cmd: 'echo "bufcmds"', group: 'TestAcSet', pattern: '*.py', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4176 \ nested: v:false, once: v:false, event: 'BufEnter'}, |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4177 \ #{cmd: 'echo "bufcmds"', group: 'TestAcSet', pattern: '*.sh', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4178 \ nested: v:false, once: v:false, event: 'BufEnter'}, |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4179 \ #{cmd: 'echo "bufcmds"', group: 'TestAcSet', pattern: '*.py', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4180 \ nested: v:false, once: v:false, event: 'BufLeave'}, |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4181 \ #{cmd: 'echo "bufcmds"', group: 'TestAcSet', pattern: '*.sh', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4182 \ nested: v:false, once: v:false, event: 'BufLeave'}], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4183 \ autocmd_get(#{group: 'TestAcSet'})) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4184 |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4185 " Test for invalid values for 'event' item |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4186 call autocmd_delete([#{group: 'TestAcSet'}]) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4187 let l = [#{group: 'TestAcSet', event: test_null_string(), |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4188 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4189 call assert_fails('call autocmd_add(l)', 'E928:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4190 let l = [#{group: 'TestAcSet', event: test_null_list(), |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4191 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4192 call assert_fails('call autocmd_add(l)', 'E714:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4193 let l = [#{group: 'TestAcSet', event: {}, |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4194 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4195 call assert_fails('call autocmd_add(l)', 'E777:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4196 let l = [#{group: 'TestAcSet', event: [{}], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4197 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4198 call assert_fails('call autocmd_add(l)', 'E928:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4199 let l = [#{group: 'TestAcSet', event: [test_null_string()], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4200 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4201 call assert_fails('call autocmd_add(l)', 'E928:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4202 let l = [#{group: 'TestAcSet', event: 'BufEnter,BufLeave', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4203 \ pattern: '*.py', cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4204 call assert_fails('call autocmd_add(l)', 'E216:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4205 let l = [#{group: 'TestAcSet', event: [], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4206 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4207 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4208 let l = [#{group: 'TestAcSet', event: [""], |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4209 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4210 call assert_fails('call autocmd_add(l)', 'E216:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4211 let l = [#{group: 'TestAcSet', event: "", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4212 \ pattern: "*.py", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4213 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4214 call assert_equal([], autocmd_get(#{group: 'TestAcSet'})) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4215 |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4216 " Test for invalid values for 'pattern' item |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4217 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4218 \ pattern: test_null_string(), cmd: 'echo "bufcmds"'}] |
29054
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4219 call assert_fails('call autocmd_add(l)', 'E928:') |
29016
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4220 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4221 \ pattern: test_null_list(), cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4222 call assert_fails('call autocmd_add(l)', 'E714:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4223 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4224 \ pattern: {}, cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4225 call assert_fails('call autocmd_add(l)', 'E777:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4226 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4227 \ pattern: [{}], cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4228 call assert_fails('call autocmd_add(l)', 'E928:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4229 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4230 \ pattern: [test_null_string()], cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4231 call assert_fails('call autocmd_add(l)', 'E928:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4232 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4233 \ pattern: [], cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4234 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4235 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4236 \ pattern: [""], cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4237 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4238 let l = [#{group: 'TestAcSet', event: "BufEnter", |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4239 \ pattern: "", cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4240 call autocmd_add(l) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4241 call assert_equal([], autocmd_get(#{group: 'TestAcSet'})) |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4242 |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4243 let l = [#{group: 'TestAcSet', event: 'BufEnter,abc,BufLeave', |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4244 \ pattern: '*.py', cmd: 'echo "bufcmds"'}] |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4245 call assert_fails('call autocmd_add(l)', 'E216:') |
aadeddf38d9b
patch 8.2.5030: autocmd_add() can only handle one event and pattern
Bram Moolenaar <Bram@vim.org>
parents:
28978
diff
changeset
|
4246 |
28917
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4247 call assert_fails("call autocmd_add({})", 'E1211:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4248 call assert_equal(v:false, autocmd_add(test_null_list())) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4249 call assert_true(autocmd_add([[]])) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4250 call assert_true(autocmd_add([test_null_dict()])) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4251 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4252 augroup TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4253 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4254 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4255 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4256 call autocmd_add([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4257 call autocmd_add([#{group: 'TestAcSet', event: 'BufAdd'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4258 call autocmd_add([#{group: 'TestAcSet', pat: '*.sh'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4259 call autocmd_add([#{group: 'TestAcSet', cmd: 'echo "a"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4260 call autocmd_add([#{group: 'TestAcSet', event: 'BufAdd', pat: '*.sh'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4261 call autocmd_add([#{group: 'TestAcSet', event: 'BufAdd', cmd: 'echo "a"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4262 call autocmd_add([#{group: 'TestAcSet', pat: '*.sh', cmd: 'echo "a"'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4263 call assert_equal([], autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4264 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4265 augroup! TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4266 endfunc |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4267 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4268 " Test for deleting autocmd events and groups |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4269 func Test_autocmd_delete() |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4270 " Delete an event in an autocmd group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4271 augroup TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4272 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4273 au BufAdd *.sh echo "bufadd" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4274 au BufEnter *.sh echo "bufenter" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4275 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4276 call autocmd_delete([#{group: 'TestAcSet', event: 'BufAdd'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4277 call assert_equal([#{cmd: 'echo "bufenter"', group: 'TestAcSet', |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4278 \ pattern: '*.sh', nested: v:false, once: v:false, |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4279 \ event: 'BufEnter'}], autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4280 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4281 " Delete all the events in an autocmd group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4282 augroup TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4283 au BufAdd *.sh echo "bufadd" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4284 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4285 call autocmd_delete([#{group: 'TestAcSet', event: '*'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4286 call assert_equal([], autocmd_get(#{group: 'TestAcSet'})) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4287 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4288 " Delete a non-existing autocmd group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4289 call assert_fails("call autocmd_delete([#{group: 'abc'}])", 'E367:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4290 " Delete a non-existing autocmd event |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4291 let l = [#{group: 'TestAcSet', event: 'abc'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4292 call assert_fails("call autocmd_delete(l)", 'E216:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4293 " Delete a non-existing autocmd pattern |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4294 let l = [#{group: 'TestAcSet', event: 'BufAdd', pat: 'abc'}] |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4295 call assert_true(autocmd_delete(l)) |
29054
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4296 " Delete an autocmd for a non-existing buffer |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4297 let l = [#{event: '*', bufnr: 9999, cmd: 'echo "x"'}] |
e7bd4c788053
patch 8.2.5049: insufficient tests for autocommands
Bram Moolenaar <Bram@vim.org>
parents:
29016
diff
changeset
|
4298 call assert_fails('call autocmd_delete(l)', 'E680:') |
28917
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4299 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4300 " Delete an autocmd group |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4301 augroup TestAcSet |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4302 au! |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4303 au BufAdd *.sh echo "bufadd" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4304 au BufEnter *.sh echo "bufenter" |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4305 augroup END |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4306 call autocmd_delete([#{group: 'TestAcSet'}]) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4307 call assert_fails("call autocmd_get(#{group: 'TestAcSet'})", 'E367:') |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4308 |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4309 call assert_true(autocmd_delete([[]])) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4310 call assert_true(autocmd_delete([test_null_dict()])) |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4311 endfunc |
c5862dfaf0bd
patch 8.2.4981: it is not possible to manipulate autocommands
Bram Moolenaar <Bram@vim.org>
parents:
28558
diff
changeset
|
4312 |
30910
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4313 func Test_autocmd_split_dummy() |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4314 " Autocommand trying to split a window containing a dummy buffer. |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
31764
diff
changeset
|
4315 auto BufReadPre * exe "sbuf " .. expand("<abuf>") |
30910
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4316 " Avoid the "W11" prompt |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4317 au FileChangedShell * let v:fcs_choice = 'reload' |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4318 func Xautocmd_changelist() |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4319 cal writefile(['Xtestfile2:4:4'], 'Xerr') |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4320 edit Xerr |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4321 lex 'Xtestfile2:4:4' |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4322 endfunc |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4323 call Xautocmd_changelist() |
30912
f22e31128548
patch 9.0.0790: test for dummy buffer does not always produce the E86 error
Bram Moolenaar <Bram@vim.org>
parents:
30910
diff
changeset
|
4324 " Should get E86, but it doesn't always happen (timing?) |
f22e31128548
patch 9.0.0790: test for dummy buffer does not always produce the E86 error
Bram Moolenaar <Bram@vim.org>
parents:
30910
diff
changeset
|
4325 silent! call Xautocmd_changelist() |
30910
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4326 |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4327 au! BufReadPre |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4328 au! FileChangedShell |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4329 delfunc Xautocmd_changelist |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4330 bwipe! Xerr |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4331 call delete('Xerr') |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4332 endfunc |
6686e742a859
patch 9.0.0789: dummy buffer ends up in a window
Bram Moolenaar <Bram@vim.org>
parents:
30908
diff
changeset
|
4333 |
31263
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4334 " This was crashing because there was only one window to execute autocommands |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4335 " in. |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4336 func Test_autocmd_nested_setbufvar() |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4337 CheckFeature python3 |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4338 |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4339 set hidden |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4340 edit Xaaa |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4341 edit Xbbb |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4342 call setline(1, 'bar') |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4343 enew |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4344 au BufWriteCmd Xbbb ++nested call setbufvar('Xaaa', '&ft', 'foo') | bw! Xaaa |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4345 au FileType foo call py3eval('vim.current.buffer.options["cindent"]') |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4346 wall |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4347 |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4348 au! BufWriteCmd |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4349 au! FileType foo |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4350 set nohidden |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4351 call delete('Xaaa') |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4352 call delete('Xbbb') |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4353 %bwipe! |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4354 endfunc |
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4355 |
31463
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4356 func SetupVimTest_shm() |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4357 let g:bwe = [] |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4358 let g:brp = [] |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4359 set shortmess+=F |
32250
b1ea62e14b3c
patch 9.0.1456: shortmess test depends on order of test execution
Bram Moolenaar <Bram@vim.org>
parents:
31934
diff
changeset
|
4360 messages clear |
31463
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4361 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4362 let dirname='XVimTestSHM' |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4363 call mkdir(dirname, 'R') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4364 call writefile(['test'], dirname .. '/1') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4365 call writefile(['test'], dirname .. '/2') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4366 call writefile(['test'], dirname .. '/3') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4367 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4368 augroup test |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4369 autocmd! |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4370 autocmd BufWinEnter * call add(g:bwe, $'BufWinEnter: {expand('<amatch>')}') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4371 autocmd BufReadPost * call add(g:brp, $'BufReadPost: {expand('<amatch>')}') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4372 augroup END |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4373 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4374 call setqflist([ |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4375 \ {'filename': dirname .. '/1', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0}, |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4376 \ {'filename': dirname .. '/2', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0}, |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4377 \ {'filename': dirname .. '/3', 'lnum': 1, 'col': 1, 'text': 'test', 'vcol': 0} |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4378 \ ]) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4379 cdo! substitute/test/TEST |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4380 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4381 " clean up |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4382 noa enew! |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4383 set shortmess&vim |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4384 augroup test |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4385 autocmd! |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4386 augroup END |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4387 augroup! test |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4388 endfunc |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4389 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4390 func Test_autocmd_shortmess() |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4391 CheckNotMSWindows |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4392 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4393 call SetupVimTest_shm() |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4394 let output = execute(':mess')->split('\n') |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4395 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4396 let info = copy(output)->filter({idx, val -> val =~# '\d of 3'} ) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4397 let bytes = copy(output)->filter({idx, val -> val =~# 'bytes'} ) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4398 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4399 " We test the following here: |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4400 " BufReadPost should have been triggered 3 times, once per file |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4401 " BufWinEnter should have been triggered 3 times, once per file |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4402 " FileInfoMessage should have been shown 3 times, regardless of shm option |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4403 " "(x of 3)" message from :cnext has been shown 3 times |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4404 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4405 call assert_equal(3, g:brp->len()) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4406 call assert_equal(3, g:bwe->len()) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4407 call assert_equal(3, info->len()) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4408 call assert_equal(3, bytes->len()) |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4409 |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4410 delfunc SetupVimTest_shm |
db72745d328c
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents:
31412
diff
changeset
|
4411 endfunc |
31263
d8e7d725a666
patch 9.0.0965: using one window for executing autocommands is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
31231
diff
changeset
|
4412 |
34363
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4413 func Test_autocmd_invalidates_undo_on_textchanged() |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4414 CheckRunVimInTerminal |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4415 let script =<< trim END |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4416 set hidden |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4417 " create quickfix list (at least 2 lines to move line) |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4418 vimgrep /u/j % |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4419 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4420 " enter quickfix window |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4421 cwindow |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4422 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4423 " set modifiable |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4424 setlocal modifiable |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4425 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4426 " set autocmd to clear quickfix list |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4427 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4428 autocmd! TextChanged <buffer> call setqflist([]) |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4429 " move line |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4430 move+1 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4431 END |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4432 call writefile(script, 'XTest_autocmd_invalidates_undo_on_textchanged', 'D') |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4433 let buf = RunVimInTerminal('XTest_autocmd_invalidates_undo_on_textchanged', {'rows': 20}) |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4434 call term_sendkeys(buf, ":so %\<cr>") |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4435 call term_sendkeys(buf, "G") |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4436 call WaitForAssert({-> assert_match('^XTest_autocmd_invalidates_undo_on_textchanged\s*$', term_getline(buf, 20))}, 1000) |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4437 |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4438 call StopVimInTerminal(buf) |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4439 endfunc |
3b654f4462c5
patch 9.1.0112: Remove undo information, when cleaning quickfix buffer
Christian Brabandt <cb@256bit.org>
parents:
34307
diff
changeset
|
4440 |
34454
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4441 func Test_autocmd_creates_new_buffer_on_bufleave() |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4442 e a.txt |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4443 e b.txt |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4444 setlocal bufhidden=wipe |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4445 autocmd BufLeave <buffer> diffsplit c.txt |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4446 bn |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4447 call assert_equal(1, winnr('$')) |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4448 call assert_equal('a.txt', bufname('%')) |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4449 bw a.txt |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4450 bw c.txt |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4451 endfunc |
f8fed6c8bb60
patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf()
Christian Brabandt <cb@256bit.org>
parents:
34363
diff
changeset
|
4452 |
34645
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4453 " Ensure `expected` was just recently written as a Vim session |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4454 func s:assert_session_path(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4455 call assert_equal(a:expected, v:this_session) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4456 endfunc |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4457 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4458 " Check for `expected` after a session is written to-disk. |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4459 func s:watch_for_session_path(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4460 execute 'autocmd SessionWritePost * ++once execute "call s:assert_session_path(\"' |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4461 \ . a:expected |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4462 \ . '\")"' |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4463 endfunc |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4464 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4465 " Ensure v:this_session gets the full session path, if explicitly stated |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4466 func Test_explicit_session_absolute_path() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4467 %bwipeout! |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4468 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4469 let directory = getcwd() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4470 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4471 let v:this_session = "" |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4472 let name = "some_file.vim" |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4473 let expected = fnamemodify(name, ":p") |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4474 call s:watch_for_session_path(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4475 execute "mksession! " .. expected |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4476 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4477 call delete(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4478 endfunc |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4479 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4480 " Ensure v:this_session gets the full session path, if explicitly stated |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4481 func Test_explicit_session_relative_path() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4482 %bwipeout! |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4483 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4484 let directory = getcwd() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4485 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4486 let v:this_session = "" |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4487 let name = "some_file.vim" |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4488 let expected = fnamemodify(name, ":p") |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4489 call s:watch_for_session_path(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4490 execute "mksession! " .. name |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4491 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4492 call delete(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4493 endfunc |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4494 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4495 " Ensure v:this_session gets the full session path, if not specified |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4496 func Test_implicit_session() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4497 %bwipeout! |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4498 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4499 let directory = getcwd() |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4500 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4501 let v:this_session = "" |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4502 let expected = fnamemodify("Session.vim", ":p") |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4503 call s:watch_for_session_path(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4504 mksession! |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4505 |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4506 call delete(expected) |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4507 endfunc |
172f30203d25
patch 9.1.0207: No autocommand when writing session file
Christian Brabandt <cb@256bit.org>
parents:
34506
diff
changeset
|
4508 |
34703
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4509 " Test TextChangedI and TextChanged |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4510 func Test_Changed_ChangedI() |
34746
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4511 " Run this test in a terminal because it requires running the main loop. |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4512 " Don't use CheckRunVimInTerminal as that will skip the test on Windows. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4513 CheckFeature terminal |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4514 CheckNotGui |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4515 " Starting a terminal to run Vim is always considered flaky. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4516 let g:test_is_flaky = 1 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4517 |
34703
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4518 call writefile(['one', 'two', 'three'], 'XTextChangedI2', 'D') |
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4519 let before =<< trim END |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4520 set ttimeout ttimeoutlen=10 |
34746
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4521 let [g:autocmd_n, g:autocmd_i] = ['',''] |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4522 |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4523 func TextChangedAutocmd(char) |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4524 let g:autocmd_{tolower(a:char)} = a:char .. b:changedtick |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4525 call writefile([$'{g:autocmd_n},{g:autocmd_i}'], 'XTextChangedI3') |
34746
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4526 endfunc |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4527 |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4528 au TextChanged <buffer> :call TextChangedAutocmd('N') |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4529 au TextChangedI <buffer> :call TextChangedAutocmd('I') |
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4530 |
34703
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4531 nnoremap <CR> o<Esc> |
34771
3d063c753d40
patch 9.1.0262: Test for TextChanged is flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34763
diff
changeset
|
4532 autocmd SafeState * ++once call writefile([''], 'XTextChangedI3') |
34703
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4533 END |
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4534 |
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4535 call writefile(before, 'Xinit', 'D') |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4536 let buf = term_start( |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4537 \ GetVimCommandCleanTerm() .. '-n -S Xinit XTextChangedI2', |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4538 \ {'term_rows': 10}) |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4539 call assert_equal('running', term_getstatus(buf)) |
34746
d537272fa503
patch 9.1.0251: Filetype test fails
Christian Brabandt <cb@256bit.org>
parents:
34705
diff
changeset
|
4540 call WaitForAssert({-> assert_true(filereadable('XTextChangedI3'))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4541 defer delete('XTextChangedI3') |
34771
3d063c753d40
patch 9.1.0262: Test for TextChanged is flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34763
diff
changeset
|
4542 call WaitForAssert({-> assert_equal([''], readfile('XTextChangedI3'))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4543 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4544 " TextChanged should trigger if a mapping enters and leaves Insert mode. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4545 call term_sendkeys(buf, "\<CR>") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4546 call WaitForAssert({-> assert_equal('N4,', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4547 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4548 call term_sendkeys(buf, "i") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4549 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4550 call WaitForAssert({-> assert_equal('N4,', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4551 " TextChangedI should trigger if change is done in Insert mode. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4552 call term_sendkeys(buf, "f") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4553 call WaitForAssert({-> assert_equal('N4,I5', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4554 call term_sendkeys(buf, "o") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4555 call WaitForAssert({-> assert_equal('N4,I6', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4556 call term_sendkeys(buf, "o") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4557 call WaitForAssert({-> assert_equal('N4,I7', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4558 " TextChanged shouldn't trigger when leaving Insert mode and TextChangedI |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4559 " has been triggered. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4560 call term_sendkeys(buf, "\<Esc>") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4561 call WaitForAssert({-> assert_notmatch('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4562 call WaitForAssert({-> assert_equal('N4,I7', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4563 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4564 " TextChanged should trigger if change is done in Normal mode. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4565 call term_sendkeys(buf, "yyp") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4566 call WaitForAssert({-> assert_equal('N8,I7', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4567 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4568 " TextChangedI shouldn't trigger if change isn't done in Insert mode. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4569 call term_sendkeys(buf, "i") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4570 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4571 call WaitForAssert({-> assert_equal('N8,I7', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4572 call term_sendkeys(buf, "\<Esc>") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4573 call WaitForAssert({-> assert_notmatch('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4574 call WaitForAssert({-> assert_equal('N8,I7', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4575 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4576 " TextChangedI should trigger if change is a mix of Normal and Insert modes. |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4577 func! s:validate_mixed_textchangedi(buf, keys) |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4578 let buf = a:buf |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4579 call term_sendkeys(buf, "ifoo") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4580 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 10))}) |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4581 call term_sendkeys(buf, "\<Esc>") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4582 call WaitForAssert({-> assert_notmatch('^-- INSERT --', term_getline(buf, 10))}) |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4583 call term_sendkeys(buf, ":let [g:autocmd_n, g:autocmd_i] = ['', '']\<CR>") |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4584 call writefile([], 'XTextChangedI3') |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4585 call term_sendkeys(buf, a:keys) |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4586 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4587 call WaitForAssert({-> assert_match('^,I\d\+', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4588 call term_sendkeys(buf, "\<Esc>") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4589 call WaitForAssert({-> assert_notmatch('^-- INSERT --', term_getline(buf, 10))}) |
34790
1104d85c7dcc
patch 9.1.0269: Test for TextChanged is still flaky with ASAN
Christian Brabandt <cb@256bit.org>
parents:
34771
diff
changeset
|
4590 call WaitForAssert({-> assert_match('^,I\d\+', readfile('XTextChangedI3')->join("\n"))}) |
34763
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4591 endfunc |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4592 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4593 call s:validate_mixed_textchangedi(buf, "o") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4594 call s:validate_mixed_textchangedi(buf, "O") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4595 call s:validate_mixed_textchangedi(buf, "ciw") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4596 call s:validate_mixed_textchangedi(buf, "cc") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4597 call s:validate_mixed_textchangedi(buf, "C") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4598 call s:validate_mixed_textchangedi(buf, "s") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4599 call s:validate_mixed_textchangedi(buf, "S") |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4600 |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4601 " clean up |
82e65843c29d
patch 9.1.0259: Normal mode TextChanged isn't tested properly
Christian Brabandt <cb@256bit.org>
parents:
34746
diff
changeset
|
4602 bwipe! |
34703
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4603 endfunc |
d432af20fe54
patch 9.1.0230: TextChanged autocommand not triggered under some circumstances
Christian Brabandt <cb@256bit.org>
parents:
34645
diff
changeset
|
4604 |
34705
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4605 " Test that filetype detection still works when SwapExists autocommand sets |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4606 " filetype in another buffer. |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4607 func Test_SwapExists_set_other_buf_filetype() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4608 let lines =<< trim END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4609 set nocompatible directory=. |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4610 filetype on |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4611 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4612 let g:buf = bufnr() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4613 new |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4614 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4615 func SwapExists() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4616 let v:swapchoice = 'o' |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4617 call setbufvar(g:buf, '&filetype', 'text') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4618 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4619 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4620 func SafeState() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4621 edit <script> |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4622 redir! > XftSwapExists.out |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4623 set readonly? filetype? |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4624 redir END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4625 qall! |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4626 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4627 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4628 autocmd SwapExists * ++nested call SwapExists() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4629 autocmd SafeState * ++nested ++once call SafeState() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4630 END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4631 call writefile(lines, 'XftSwapExists.vim', 'D') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4632 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4633 new XftSwapExists.vim |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4634 if RunVim('', '', ' -S XftSwapExists.vim') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4635 call assert_equal( |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4636 \ ['', ' readonly', ' filetype=vim'], |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4637 \ readfile('XftSwapExists.out')) |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4638 call delete('XftSwapExists.out') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4639 endif |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4640 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4641 bwipe! |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4642 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4643 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4644 " Test that file is not marked as modified when SwapExists autocommand sets |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4645 " 'modified' in another buffer. |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4646 func Test_SwapExists_set_other_buf_modified() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4647 let lines =<< trim END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4648 set nocompatible directory=. |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4649 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4650 let g:buf = bufnr() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4651 new |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4652 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4653 func SwapExists() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4654 let v:swapchoice = 'o' |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4655 call setbufvar(g:buf, '&modified', 1) |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4656 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4657 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4658 func SafeState() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4659 edit <script> |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4660 redir! > XmodSwapExists.out |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4661 set readonly? modified? |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4662 redir END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4663 qall! |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4664 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4665 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4666 autocmd SwapExists * ++nested call SwapExists() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4667 autocmd SafeState * ++nested ++once call SafeState() |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4668 END |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4669 call writefile(lines, 'XmodSwapExists.vim', 'D') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4670 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4671 new XmodSwapExists.vim |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4672 if RunVim('', '', ' -S XmodSwapExists.vim') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4673 call assert_equal( |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4674 \ ['', ' readonly', 'nomodified'], |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4675 \ readfile('XmodSwapExists.out')) |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4676 call delete('XmodSwapExists.out') |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4677 endif |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4678 |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4679 bwipe! |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4680 endfunc |
159d598e6781
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
Christian Brabandt <cb@256bit.org>
parents:
34703
diff
changeset
|
4681 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19073
diff
changeset
|
4682 " vim: shiftwidth=2 sts=2 expandtab |