Mercurial > vim
annotate src/testdir/test_usercommands.vim @ 11398:30af33f4d353 v8.0.0584
patch 8.0.0584: memory leak when executing quickfix tests
commit https://github.com/vim/vim/commit/d788f6fe89c77262c474de323f5dab6d1c814e27
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 23 17:19:43 2017 +0200
patch 8.0.0584: memory leak when executing quickfix tests
Problem: Memory leak when executing quickfix tests.
Solution: Free the list reference. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 23 Apr 2017 17:30:03 +0200 |
parents | ae45d497868f |
children | 1fad9675d8fd |
rev | line source |
---|---|
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for user defined commands |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " Test for <mods> in user defined commands |
11091
ae45d497868f
patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents:
10704
diff
changeset
|
4 set belloff=all |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 function Test_cmdmods() |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let g:mods = '' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 command! -nargs=* MyCmd let g:mods .= '<mods> ' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 MyCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 aboveleft MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
12 abo MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 belowright MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
14 bel MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 botright MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
16 bo MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 browse MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
18 bro MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 confirm MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
20 conf MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 hide MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
22 hid MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 keepalt MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
24 keepa MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 keepjumps MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
26 keepj MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 keepmarks MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
28 kee MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 keeppatterns MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
30 keepp MyCmd |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
31 leftabove MyCmd " results in :aboveleft |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
32 lefta MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 lockmarks MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
34 loc MyCmd |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
35 " noautocmd MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 noswapfile MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
37 nos MyCmd |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
38 rightbelow MyCmd " results in :belowright |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
39 rightb MyCmd |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
40 " sandbox MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 silent MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
42 sil MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 tab MyCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 topleft MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
45 to MyCmd |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
46 " unsilent MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 verbose MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
48 verb MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 vertical MyCmd |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
50 vert MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 aboveleft belowright botright browse confirm hide keepalt keepjumps |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 \ keepmarks keeppatterns lockmarks noswapfile silent tab |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 \ topleft verbose vertical MyCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
56 call assert_equal(' aboveleft aboveleft belowright belowright botright ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
57 \ 'botright browse browse confirm confirm hide hide ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
58 \ 'keepalt keepalt keepjumps keepjumps keepmarks keepmarks ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
59 \ 'keeppatterns keeppatterns aboveleft aboveleft lockmarks lockmarks noswapfile ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
60 \ 'noswapfile belowright belowright silent silent tab topleft topleft verbose verbose ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
61 \ 'vertical vertical ' . |
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
62 \ 'aboveleft belowright botright browse confirm hide keepalt keepjumps ' . |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 \ 'keepmarks keeppatterns lockmarks noswapfile silent tab topleft ' . |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 \ 'verbose vertical ', g:mods) |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 let g:mods = '' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 command! -nargs=* MyQCmd let g:mods .= '<q-mods> ' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 vertical MyQCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal('"vertical" ', g:mods) |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 delcommand MyCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 delcommand MyQCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 unlet g:mods |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 endfunction |
9667
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
76 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
77 func Test_Ambiguous() |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
78 command Doit let g:didit = 'yes' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
79 command Dothat let g:didthat = 'also' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
80 call assert_fails('Do', 'E464:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
81 Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
82 call assert_equal('yes', g:didit) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
83 Dothat |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
84 call assert_equal('also', g:didthat) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
85 unlet g:didit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
86 unlet g:didthat |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
87 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
88 delcommand Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
89 Do |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
90 call assert_equal('also', g:didthat) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
91 delcommand Dothat |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
92 endfunc |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
93 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
94 func Test_CmdUndefined() |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
95 call assert_fails('Doit', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
96 au CmdUndefined Doit :command Doit let g:didit = 'yes' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
97 Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
98 call assert_equal('yes', g:didit) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
99 delcommand Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
100 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
101 call assert_fails('Dothat', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
102 au CmdUndefined * let g:didnot = 'yes' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
103 call assert_fails('Dothat', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
104 call assert_equal('yes', g:didnot) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
105 endfunc |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
106 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
107 func Test_CmdErrors() |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
108 call assert_fails('com! docmd :', 'E183:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
109 call assert_fails('com! \<Tab> :', 'E182:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
110 call assert_fails('com! _ :', 'E182:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
111 call assert_fails('com! X :', 'E841:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
112 call assert_fails('com! - DoCmd :', 'E175:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
113 call assert_fails('com! -xxx DoCmd :', 'E181:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
114 call assert_fails('com! -addr DoCmd :', 'E179:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
115 call assert_fails('com! -complete DoCmd :', 'E179:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
116 call assert_fails('com! -complete=xxx DoCmd :', 'E180:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
117 call assert_fails('com! -complete=custom DoCmd :', 'E467:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
118 call assert_fails('com! -complete=customlist DoCmd :', 'E467:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
119 call assert_fails('com! -complete=behave,CustomComplete DoCmd :', 'E468:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
120 call assert_fails('com! -nargs=x DoCmd :', 'E176:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
121 call assert_fails('com! -count=1 -count=2 DoCmd :', 'E177:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
122 call assert_fails('com! -count=x DoCmd :', 'E178:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
123 call assert_fails('com! -range=x DoCmd :', 'E178:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
124 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
125 com! -nargs=0 DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
126 call assert_fails('DoCmd x', 'E488:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
127 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
128 com! -nargs=1 DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
129 call assert_fails('DoCmd', 'E471:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
130 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
131 com! -nargs=+ DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
132 call assert_fails('DoCmd', 'E471:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
133 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
134 call assert_fails('com DoCmd :', 'E174:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
135 comclear |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
136 call assert_fails('delcom DoCmd', 'E184:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
137 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
138 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
139 func CustomComplete(A, L, P) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
140 return "January\nFebruary\nMars\n" |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
141 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
142 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
143 func CustomCompleteList(A, L, P) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
144 return [ "Monday", "Tuesday", "Wednesday" ] |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
145 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
146 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
147 func Test_CmdCompletion() |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
148 call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
149 call assert_equal('"com -addr bang bar buffer complete count nargs range register', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
150 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
151 call feedkeys(":com -nargs=0 -\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
152 call assert_equal('"com -nargs=0 -addr bang bar buffer complete count nargs range register', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
153 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
154 call feedkeys(":com -nargs=\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
155 call assert_equal('"com -nargs=* + 0 1 ?', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
156 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
157 call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
158 call assert_equal('"com -addr=arguments buffers lines loaded_buffers quickfix tabs windows', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
159 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
160 call feedkeys(":com -complete=co\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
161 call assert_equal('"com -complete=color command compiler', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
162 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
163 command! DoCmd1 : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
164 command! DoCmd2 : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
165 call feedkeys(":com \<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
166 call assert_equal('"com DoCmd1 DoCmd2', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
167 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
168 call feedkeys(":DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
169 call assert_equal('"DoCmd1 DoCmd2', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
170 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
171 call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
172 call assert_equal('"delcom DoCmd1 DoCmd2', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
173 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
174 delcom DoCmd1 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
175 call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
176 call assert_equal('"delcom DoCmd2', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
177 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
178 call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
179 call assert_equal('"com DoCmd2', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
180 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
181 delcom DoCmd2 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
182 call feedkeys(":delcom DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
183 call assert_equal('"delcom DoC', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
184 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
185 call feedkeys(":com DoC\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
186 call assert_equal('"com DoC', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
187 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
188 com! -complete=behave DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
189 call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
190 call assert_equal('"DoCmd mswin xterm', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
191 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
192 " This does not work. Why? |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
193 "call feedkeys(":DoCmd x\<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
194 "call assert_equal('"DoCmd xterm', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
195 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
196 com! -complete=custom,CustomComplete DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
197 call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
198 call assert_equal('"DoCmd January February Mars', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
199 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
200 com! -complete=customlist,CustomCompleteList DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
201 call feedkeys(":DoCmd \<C-A>\<C-B>\"\<CR>", 'tx') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
202 call assert_equal('"DoCmd Monday Tuesday Wednesday', @:) |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
203 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
204 com! -complete=custom,CustomCompleteList DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
205 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E730:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
206 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
207 com! -complete=customlist,CustomComp DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
208 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:') |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
209 endfunc |