Mercurial > vim
annotate src/testdir/test_usercommands.vim @ 31353:49bd0e97549d v9.0.1010
patch 9.0.1010: stray warnings for existing swap files
Commit: https://github.com/vim/vim/commit/23526d2539e8679ea8df14e3a018101dedc3f391
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 5 15:50:41 2022 +0000
patch 9.0.1010: stray warnings for existing swap files
Problem: Stray warnings for existing swap files.
Solution: Wipe out the buffer until it has no name and no swap file.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Dec 2022 17:00:05 +0100 |
parents | 8c10a0b22015 |
children | 6c32d1072f82 |
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 |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
3 import './vim9.vim' as v9 |
25226
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
4 |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
5 source check.vim |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
6 source screendump.vim |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
7 |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " Test for <mods> in user defined commands |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 function Test_cmdmods() |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let g:mods = '' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
12 command! -nargs=* MyCmd let g:mods = '<mods>' |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
15 call assert_equal('', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 aboveleft MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
17 call assert_equal('aboveleft', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
18 abo MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
19 call assert_equal('aboveleft', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 belowright MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
21 call assert_equal('belowright', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
22 bel MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
23 call assert_equal('belowright', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 botright MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
25 call assert_equal('botright', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
26 bo MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
27 call assert_equal('botright', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 browse MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
29 call assert_equal('browse', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
30 bro MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
31 call assert_equal('browse', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 confirm MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
33 call assert_equal('confirm', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
34 conf MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
35 call assert_equal('confirm', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 hide MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
37 call assert_equal('hide', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
38 hid MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
39 call assert_equal('hide', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 keepalt MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
41 call assert_equal('keepalt', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
42 keepa MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
43 call assert_equal('keepalt', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 keepjumps MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
45 call assert_equal('keepjumps', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
46 keepj MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
47 call assert_equal('keepjumps', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 keepmarks MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
49 call assert_equal('keepmarks', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
50 kee MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
51 call assert_equal('keepmarks', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 keeppatterns MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
53 call assert_equal('keeppatterns', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
54 keepp MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
55 call assert_equal('keeppatterns', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
56 leftabove MyCmd " results in :aboveleft |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
57 call assert_equal('aboveleft', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
58 lefta MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
59 call assert_equal('aboveleft', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 lockmarks MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
61 call assert_equal('lockmarks', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
62 loc MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
63 call assert_equal('lockmarks', g:mods) |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
64 noautocmd MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
65 call assert_equal('noautocmd', g:mods) |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
66 noa MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
67 call assert_equal('noautocmd', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 noswapfile MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
69 call assert_equal('noswapfile', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
70 nos MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
71 call assert_equal('noswapfile', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
72 rightbelow MyCmd " results in :belowright |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
73 call assert_equal('belowright', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
74 rightb MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
75 call assert_equal('belowright', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
76 " sandbox MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 silent MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
78 call assert_equal('silent', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
79 sil MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
80 call assert_equal('silent', g:mods) |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
81 silent! MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
82 call assert_equal('silent!', g:mods) |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
83 sil! MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
84 call assert_equal('silent!', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 tab MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
86 call assert_equal('tab', g:mods) |
30904
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
87 0tab MyCmd |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
88 call assert_equal('0tab', g:mods) |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
89 tab split |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
90 tab MyCmd |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
91 call assert_equal('tab', g:mods) |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
92 1tab MyCmd |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
93 call assert_equal('1tab', g:mods) |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
94 tabprev |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
95 tab MyCmd |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
96 call assert_equal('tab', g:mods) |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
97 2tab MyCmd |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
98 call assert_equal('2tab', g:mods) |
8c7495056f35
patch 9.0.0786: user command does not get number from :tab modifier
Bram Moolenaar <Bram@vim.org>
parents:
30867
diff
changeset
|
99 2tabclose |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 topleft MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
101 call assert_equal('topleft', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
102 to MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
103 call assert_equal('topleft', g:mods) |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
104 unsilent MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
105 call assert_equal('unsilent', g:mods) |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
106 uns MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
107 call assert_equal('unsilent', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 verbose MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
109 call assert_equal('verbose', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
110 verb MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
111 call assert_equal('verbose', g:mods) |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
112 0verbose MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
113 call assert_equal('0verbose', g:mods) |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
114 3verbose MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
115 call assert_equal('3verbose', g:mods) |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
116 999verbose MyCmd |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
117 call assert_equal('999verbose', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 vertical MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
119 call assert_equal('vertical', g:mods) |
9703
1f33aece8e55
commit https://github.com/vim/vim/commit/3bcfca3ab4db415d0e750e00204dd25a91fcee77
Christian Brabandt <cb@256bit.org>
parents:
9667
diff
changeset
|
120 vert MyCmd |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
121 call assert_equal('vertical', g:mods) |
30017
578e71f924fe
patch 9.0.0346: :horizontal modifier not fully supported
Bram Moolenaar <Bram@vim.org>
parents:
29377
diff
changeset
|
122 horizontal MyCmd |
578e71f924fe
patch 9.0.0346: :horizontal modifier not fully supported
Bram Moolenaar <Bram@vim.org>
parents:
29377
diff
changeset
|
123 call assert_equal('horizontal', g:mods) |
578e71f924fe
patch 9.0.0346: :horizontal modifier not fully supported
Bram Moolenaar <Bram@vim.org>
parents:
29377
diff
changeset
|
124 hor MyCmd |
578e71f924fe
patch 9.0.0346: :horizontal modifier not fully supported
Bram Moolenaar <Bram@vim.org>
parents:
29377
diff
changeset
|
125 call assert_equal('horizontal', g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 aboveleft belowright botright browse confirm hide keepalt keepjumps |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
128 \ keepmarks keeppatterns lockmarks noautocmd noswapfile silent |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
129 \ tab topleft unsilent verbose vertical MyCmd |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 |
20043
d13f8ae3b1de
patch 8.2.0577: not all modifiers supported for :options
Bram Moolenaar <Bram@vim.org>
parents:
19724
diff
changeset
|
131 call assert_equal('browse confirm hide keepalt keepjumps ' . |
29377
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
132 \ 'keepmarks keeppatterns lockmarks noswapfile unsilent noautocmd ' . |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
133 \ 'silent verbose aboveleft belowright botright tab topleft vertical', |
48b086982c01
patch 9.0.0031: <cmod> of user command does not have correct verbose value
Bram Moolenaar <Bram@vim.org>
parents:
28743
diff
changeset
|
134 \ g:mods) |
9230
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 let g:mods = '' |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 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
|
138 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 vertical MyQCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 call assert_equal('"vertical" ', g:mods) |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 delcommand MyCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 delcommand MyQCmd |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 unlet g:mods |
f7fb117883ba
commit https://github.com/vim/vim/commit/63a60ded3fd584847a05dccf058026e682abad90
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 endfunction |
9667
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
146 |
16413
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
147 func SaveCmdArgs(...) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
148 let g:args = a:000 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
149 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
150 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
151 func Test_f_args() |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
152 command -nargs=* TestFArgs call SaveCmdArgs(<f-args>) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
153 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
154 TestFArgs |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
155 call assert_equal([], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
156 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
157 TestFArgs one two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
158 call assert_equal(['one', 'two', 'three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
159 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
160 TestFArgs one\\two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
161 call assert_equal(['one\two', 'three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
162 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
163 TestFArgs one\ two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
164 call assert_equal(['one two', 'three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
165 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
166 TestFArgs one\"two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
167 call assert_equal(['one\"two', 'three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
168 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
169 delcommand TestFArgs |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
170 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
171 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
172 func Test_q_args() |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
173 command -nargs=* TestQArgs call SaveCmdArgs(<q-args>) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
174 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
175 TestQArgs |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
176 call assert_equal([''], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
177 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
178 TestQArgs one two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
179 call assert_equal(['one two three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
180 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
181 TestQArgs one\\two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
182 call assert_equal(['one\\two three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
183 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
184 TestQArgs one\ two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
185 call assert_equal(['one\ two three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
186 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
187 TestQArgs one\"two three |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
188 call assert_equal(['one\"two three'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
189 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
190 delcommand TestQArgs |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
191 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
192 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
193 func Test_reg_arg() |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
194 command -nargs=* -reg TestRegArg call SaveCmdArgs("<reg>", "<register>") |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
195 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
196 TestRegArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
197 call assert_equal(['', ''], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
198 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
199 TestRegArg x |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
200 call assert_equal(['x', 'x'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
201 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
202 delcommand TestRegArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
203 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
204 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
205 func Test_no_arg() |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
206 command -nargs=* TestNoArg call SaveCmdArgs("<args>", "<>", "<x>", "<lt>") |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
207 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
208 TestNoArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
209 call assert_equal(['', '<>', '<x>', '<'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
210 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
211 TestNoArg one |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
212 call assert_equal(['one', '<>', '<x>', '<'], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
213 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
214 delcommand TestNoArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
215 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
216 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
217 func Test_range_arg() |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
218 command -range TestRangeArg call SaveCmdArgs(<range>, <line1>, <line2>) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
219 new |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
220 call setline(1, range(100)) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
221 let lnum = line('.') |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
222 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
223 TestRangeArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
224 call assert_equal([0, lnum, lnum], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
225 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
226 99TestRangeArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
227 call assert_equal([1, 99, 99], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
228 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
229 88,99TestRangeArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
230 call assert_equal([2, 88, 99], g:args) |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
231 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
232 call assert_fails('102TestRangeArg', 'E16:') |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
233 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
234 bwipe! |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
235 delcommand TestRangeArg |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
236 endfunc |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
237 |
9667
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
238 func Test_Ambiguous() |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
239 command Doit let g:didit = 'yes' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
240 command Dothat let g:didthat = 'also' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
241 call assert_fails('Do', 'E464:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
242 Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
243 call assert_equal('yes', g:didit) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
244 Dothat |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
245 call assert_equal('also', g:didthat) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
246 unlet g:didit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
247 unlet g:didthat |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
248 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
249 delcommand Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
250 Do |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
251 call assert_equal('also', g:didthat) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
252 delcommand Dothat |
16413
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
253 |
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
254 call assert_fails("\x4ei\041", ' you demand a ') |
9667
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
255 endfunc |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
256 |
15125
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
257 func Test_redefine_on_reload() |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30203
diff
changeset
|
258 call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists', 'D') |
15125
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
259 call assert_equal(0, exists(':ExistingCommand')) |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
260 source Xcommandexists |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
261 call assert_equal(2, exists(':ExistingCommand')) |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
262 " Redefining a command when reloading a script is OK. |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
263 source Xcommandexists |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
264 call assert_equal(2, exists(':ExistingCommand')) |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
265 |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
266 " But redefining in another script is not OK. |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30203
diff
changeset
|
267 call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists2', 'D') |
15125
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
268 call assert_fails('source Xcommandexists2', 'E174:') |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
269 |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
270 " And defining twice in one script is not OK. |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
271 delcommand ExistingCommand |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
272 call assert_equal(0, exists(':ExistingCommand')) |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
273 call writefile([ |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
274 \ 'command ExistingCommand echo "yes"', |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
275 \ 'command ExistingCommand echo "no"', |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
276 \ ], 'Xcommandexists') |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
277 call assert_fails('source Xcommandexists', 'E174:') |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
278 call assert_equal(2, exists(':ExistingCommand')) |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
279 |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
280 delcommand ExistingCommand |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
281 endfunc |
b101b193d5ff
patch 8.1.0573: cannot redefine user command without ! in same script
Bram Moolenaar <Bram@vim.org>
parents:
15099
diff
changeset
|
282 |
9667
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
283 func Test_CmdUndefined() |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
284 call assert_fails('Doit', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
285 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
|
286 Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
287 call assert_equal('yes', g:didit) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
288 delcommand Doit |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
289 |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
290 call assert_fails('Dothat', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
291 au CmdUndefined * let g:didnot = 'yes' |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
292 call assert_fails('Dothat', 'E492:') |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
293 call assert_equal('yes', g:didnot) |
c27052511998
commit https://github.com/vim/vim/commit/eac784eced501c54d2c99e18a1af96cd996f3a6c
Christian Brabandt <cb@256bit.org>
parents:
9230
diff
changeset
|
294 endfunc |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
295 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
296 func Test_CmdErrors() |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
297 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
|
298 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
|
299 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
|
300 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
|
301 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
|
302 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
|
303 call assert_fails('com! -addr DoCmd :', 'E179:') |
16413
4734d601ebdd
patch 8.1.1211: not all user command code is tested
Bram Moolenaar <Bram@vim.org>
parents:
16403
diff
changeset
|
304 call assert_fails('com! -addr=asdf DoCmd :', 'E180:') |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 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
|
311 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
|
312 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
|
313 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
|
314 |
25226
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
315 com! -complete=file DoCmd : |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
316 call assert_match('E1208:', v:warningmsg) |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
317 let v:warningmsg = '' |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
318 com! -nargs=0 -complete=file DoCmd : |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
319 call assert_match('E1208:', v:warningmsg) |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
320 |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
321 let lines =<< trim END |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
322 vim9script |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
323 com! -complete=file DoCmd : |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
324 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
325 call v9.CheckScriptFailure(lines, 'E1208', 2) |
25226
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
326 |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
327 let lines =<< trim END |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
328 vim9script |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
329 com! -nargs=0 -complete=file DoCmd : |
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
330 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
331 call v9.CheckScriptFailure(lines, 'E1208', 2) |
25226
a9ea83a3659a
patch 8.2.3149: some plugins have a problem with the error check
Bram Moolenaar <Bram@vim.org>
parents:
25210
diff
changeset
|
332 |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
333 com! -nargs=0 DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
334 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
|
335 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
336 com! -nargs=1 DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
337 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
|
338 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
339 com! -nargs=+ DoCmd : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
340 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
|
341 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
342 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
|
343 comclear |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
344 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
|
345 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
346 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
347 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
|
348 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
|
349 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
350 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
351 func CustomCompleteList(A, L, P) |
27700
3f57b0a8cd29
patch 8.2.4376: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27680
diff
changeset
|
352 return [ "Monday", "Tuesday", "Wednesday", {}, test_null_string()] |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
353 endfunc |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
354 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
355 func Test_CmdCompletion() |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
356 call feedkeys(":com -\<C-A>\<C-B>\"\<CR>", 'tx') |
26107
012faa52874b
patch 8.2.3586: command completion test fails
Bram Moolenaar <Bram@vim.org>
parents:
25796
diff
changeset
|
357 call assert_equal('"com -addr bang bar buffer complete count keepscript nargs range register', @:) |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
358 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
359 call feedkeys(":com -nargs=0 -\<C-A>\<C-B>\"\<CR>", 'tx') |
26107
012faa52874b
patch 8.2.3586: command completion test fails
Bram Moolenaar <Bram@vim.org>
parents:
25796
diff
changeset
|
360 call assert_equal('"com -nargs=0 -addr bang bar buffer complete count keepscript nargs range register', @:) |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
361 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
362 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
|
363 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
|
364 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
365 call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx') |
15099
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
366 call assert_equal('"com -addr=arguments buffers lines loaded_buffers other quickfix tabs windows', @:) |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
367 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
368 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
|
369 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
|
370 |
27760
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
371 " try completion for unsupported argument values |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
372 call feedkeys(":com -newarg=\<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
373 call assert_equal("\"com -newarg=\t", @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
374 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
375 " command completion after the name in a user defined command |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
376 call feedkeys(":com MyCmd chist\<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
377 call assert_equal("\"com MyCmd chistory", @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
378 |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
379 " delete the Check commands to avoid them showing up |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
380 call feedkeys(":com Check\<C-A>\<C-B>\"\<CR>", 'tx') |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
381 let cmds = substitute(@:, '"com ', '', '')->split() |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
382 for cmd in cmds |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
383 exe 'delcommand ' .. cmd |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
384 endfor |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
385 delcommand MissingFeature |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
386 |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
387 command! DoCmd1 : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
388 command! DoCmd2 : |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
389 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
|
390 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
|
391 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
392 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
|
393 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
|
394 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
395 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
|
396 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
|
397 |
27760
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
398 " try argument completion for a command without completion |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
399 call feedkeys(":DoCmd1 \<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
400 call assert_equal("\"DoCmd1 \t", @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
401 |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
402 delcom DoCmd1 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
403 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
|
404 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
|
405 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
406 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
|
407 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
|
408 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
409 delcom DoCmd2 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
410 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
|
411 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
|
412 |
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
413 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
|
414 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
|
415 |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
416 com! -nargs=1 -complete=behave DoCmd : |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
417 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
|
418 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
|
419 |
27760
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
420 " Test for file name completion |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
421 com! -nargs=1 -complete=file DoCmd : |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
422 call feedkeys(":DoCmd READM\<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
423 call assert_equal('"DoCmd README.txt', @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
424 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
425 " Test for buffer name completion |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
426 com! -nargs=1 -complete=buffer DoCmd : |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
427 let bnum = bufadd('BufForUserCmd') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
428 call setbufvar(bnum, '&buflisted', 1) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
429 call feedkeys(":DoCmd BufFor\<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
430 call assert_equal('"DoCmd BufForUserCmd', @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
431 bwipe BufForUserCmd |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
432 call feedkeys(":DoCmd BufFor\<Tab>\<C-B>\"\<CR>", 'tx') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
433 call assert_equal('"DoCmd BufFor', @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
434 |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
435 com! -nargs=* -complete=custom,CustomComplete DoCmd : |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
436 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
|
437 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
|
438 |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
439 com! -nargs=? -complete=customlist,CustomCompleteList DoCmd : |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
440 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
|
441 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
|
442 |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
443 com! -nargs=+ -complete=custom,CustomCompleteList DoCmd : |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
444 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
|
445 |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
446 com! -nargs=+ -complete=customlist,CustomComp DoCmd : |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
447 call assert_fails("call feedkeys(':DoCmd \<C-D>', 'tx')", 'E117:') |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
448 |
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
449 " custom completion without a function |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
450 com! -nargs=? -complete=custom, DoCmd |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
451 call assert_beeps("call feedkeys(':DoCmd \t', 'tx')") |
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
452 |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
453 " custom completion failure with the wrong function |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
454 com! -nargs=? -complete=custom,min DoCmd |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
455 call assert_fails("call feedkeys(':DoCmd \t', 'tx')", 'E118:') |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
20128
diff
changeset
|
456 |
27680
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
457 " custom completion for a pattern with a backslash |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
458 let g:ArgLead = '' |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
459 func! CustCompl(A, L, P) |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
460 let g:ArgLead = a:A |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
461 return ['one', 'two', 'three'] |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
462 endfunc |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
463 com! -nargs=? -complete=customlist,CustCompl DoCmd |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
464 call feedkeys(":DoCmd a\\\t", 'xt') |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
465 call assert_equal('a\', g:ArgLead) |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
466 delfunc CustCompl |
38eab98ef5a9
patch 8.2.4366: not enough tests for command line completion
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
467 |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
468 delcom DoCmd |
10704
6736cb425720
patch 8.0.0242: no tests for user command completion
Christian Brabandt <cb@256bit.org>
parents:
9703
diff
changeset
|
469 endfunc |
13101
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
470 |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
471 func CallExecute(A, L, P) |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
472 " Drop first '\n' |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
473 return execute('echo "hi"')[1:] |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
474 endfunc |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
475 |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
476 func Test_use_execute_in_completion() |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
477 command! -nargs=* -complete=custom,CallExecute DoExec : |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
478 call feedkeys(":DoExec \<C-A>\<C-B>\"\<CR>", 'tx') |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
479 call assert_equal('"DoExec hi', @:) |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
480 delcommand DoExec |
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
12644
diff
changeset
|
481 endfunc |
15099
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
482 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
483 func Test_addr_all() |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
484 command! -addr=lines DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
485 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
486 call assert_equal(1, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
487 call assert_equal(line('$'), g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
488 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
489 command! -addr=arguments DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
490 args one two three |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
491 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
492 call assert_equal(1, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
493 call assert_equal(3, g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
494 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
495 command! -addr=buffers DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
496 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
497 for low in range(1, bufnr('$')) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
498 if buflisted(low) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
499 break |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
500 endif |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
501 endfor |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
502 call assert_equal(low, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
503 call assert_equal(bufnr('$'), g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
504 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
505 command! -addr=loaded_buffers DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
506 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
507 for low in range(1, bufnr('$')) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
508 if bufloaded(low) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
509 break |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
510 endif |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
511 endfor |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
512 call assert_equal(low, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
513 for up in range(bufnr('$'), 1, -1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
514 if bufloaded(up) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
515 break |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
516 endif |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
517 endfor |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
518 call assert_equal(up, g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
519 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
520 command! -addr=windows DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
521 new |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
522 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
523 call assert_equal(1, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
524 call assert_equal(winnr('$'), g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
525 bwipe |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
526 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
527 command! -addr=tabs DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
528 tabnew |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
529 %DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
530 call assert_equal(1, g:a1) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
531 call assert_equal(len(gettabinfo()), g:a2) |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
532 bwipe |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
533 |
16475
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
534 command! -addr=other DoSomething let g:a1 = <line1> | let g:a2 = <line2> |
15099
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
535 DoSomething |
16475
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
536 call assert_equal(line('.'), g:a1) |
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
537 call assert_equal(line('.'), g:a2) |
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
538 %DoSomething |
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
539 call assert_equal(1, g:a1) |
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
540 call assert_equal(line('$'), g:a2) |
15099
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
541 |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
542 delcommand DoSomething |
39728d503e47
patch 8.1.0560: cannot use address type "other" with with user command
Bram Moolenaar <Bram@vim.org>
parents:
13101
diff
changeset
|
543 endfunc |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
544 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
545 func Test_command_list() |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
546 command! DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
547 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
548 \ .. "\n DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
549 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
550 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
551 " Test with various -range= and -count= argument values. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
552 command! -range DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
553 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
554 \ .. "\n DoCmd 0 . :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
555 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
556 command! -range=% DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
557 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
558 \ .. "\n DoCmd 0 % :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
559 \ execute('command! DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
560 command! -range=2 DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
561 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
562 \ .. "\n DoCmd 0 2 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
563 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
564 command! -count=2 DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
565 call assert_equal("\n Name Args Address Complete Definition" |
16475
854fb0ad4be6
patch 8.1.1241: Ex command info contains confusing information
Bram Moolenaar <Bram@vim.org>
parents:
16413
diff
changeset
|
566 \ .. "\n DoCmd 0 2c ? :", |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
567 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
568 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
569 " Test with various -addr= argument values. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
570 command! -addr=lines DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
571 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
572 \ .. "\n DoCmd 0 . :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
573 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
574 command! -addr=arguments DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
575 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
576 \ .. "\n DoCmd 0 . arg :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
577 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
578 command! -addr=buffers DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
579 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
580 \ .. "\n DoCmd 0 . buf :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
581 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
582 command! -addr=loaded_buffers DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
583 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
584 \ .. "\n DoCmd 0 . load :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
585 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
586 command! -addr=windows DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
587 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
588 \ .. "\n DoCmd 0 . win :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
589 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
590 command! -addr=tabs DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
591 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
592 \ .. "\n DoCmd 0 . tab :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
593 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
594 command! -addr=other DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
595 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
596 \ .. "\n DoCmd 0 . ? :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
597 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
598 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
599 " Test with various -complete= argument values (non-exhaustive list) |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
600 command! -nargs=1 -complete=arglist DoCmd : |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
601 call assert_equal("\n Name Args Address Complete Definition" |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
602 \ .. "\n DoCmd 1 arglist :", |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
603 \ execute('command DoCmd')) |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
604 command! -nargs=* -complete=augroup DoCmd : |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
605 call assert_equal("\n Name Args Address Complete Definition" |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
606 \ .. "\n DoCmd * augroup :", |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
607 \ execute('command DoCmd')) |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
608 command! -nargs=? -complete=custom,CustomComplete DoCmd : |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
609 call assert_equal("\n Name Args Address Complete Definition" |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
610 \ .. "\n DoCmd ? custom :", |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
611 \ execute('command DoCmd')) |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
612 command! -nargs=+ -complete=customlist,CustomComplete DoCmd : |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
613 call assert_equal("\n Name Args Address Complete Definition" |
25210
8d816c266ceb
patch 8.2.3141: no error when using :complete for :command without -nargs
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
614 \ .. "\n DoCmd + customlist :", |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
615 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
616 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
617 " Test with various -narg= argument values. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
618 command! -nargs=0 DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
619 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
620 \ .. "\n DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
621 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
622 command! -nargs=1 DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
623 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
624 \ .. "\n DoCmd 1 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
625 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
626 command! -nargs=* DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
627 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
628 \ .. "\n DoCmd * :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
629 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
630 command! -nargs=? DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
631 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
632 \ .. "\n DoCmd ? :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
633 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
634 command! -nargs=+ DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
635 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
636 \ .. "\n DoCmd + :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
637 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
638 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
639 " Test with other arguments. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
640 command! -bang DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
641 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
642 \ .. "\n! DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
643 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
644 command! -bar DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
645 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
646 \ .. "\n| DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
647 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
648 command! -register DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
649 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
650 \ .. "\n\" DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
651 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
652 command! -buffer DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
653 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
654 \ .. "\nb DoCmd 0 :" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
655 \ .. "\n\" DoCmd 0 :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
656 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
657 comclear |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
658 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
659 " Test with many args. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
660 command! -bang -bar -register -buffer -nargs=+ -complete=environment -addr=windows -count=3 DoCmd : |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
661 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
662 \ .. "\n!\"b|DoCmd + 3c win environment :", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
663 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
664 comclear |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
665 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
666 " Test with special characters in command definition. |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
667 command! DoCmd :<cr><tab><c-d> |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
668 call assert_equal("\n Name Args Address Complete Definition" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
669 \ .. "\n DoCmd 0 :<CR><Tab><C-D>", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
670 \ execute('command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
671 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
672 " Test output in verbose mode. |
27187
8950a7b6cc89
patch 8.2.4122: ":command Cmd" does not show custom completion argument
Bram Moolenaar <Bram@vim.org>
parents:
26576
diff
changeset
|
673 command! -nargs=+ -complete=customlist,SomeFunc DoCmd :ls |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
674 call assert_match("^\n" |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
675 \ .. " Name Args Address Complete Definition\n" |
27187
8950a7b6cc89
patch 8.2.4122: ":command Cmd" does not show custom completion argument
Bram Moolenaar <Bram@vim.org>
parents:
26576
diff
changeset
|
676 \ .. " DoCmd + customlist,SomeFunc :ls\n" |
16403
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
677 \ .. "\tLast set from .*/test_usercommands.vim line \\d\\+$", |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
678 \ execute('verbose command DoCmd')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
679 |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
680 comclear |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
681 call assert_equal("\nNo user-defined commands found", execute(':command Xxx')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
682 call assert_equal("\nNo user-defined commands found", execute('command')) |
250420b35b10
patch 8.1.1206: user command parsing and listing not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
15125
diff
changeset
|
683 endfunc |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
684 |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
685 " Test for a custom user completion returning the wrong value type |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
686 func Test_usercmd_custom() |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
687 func T1(a, c, p) |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
688 return "a\nb\n" |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
689 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
690 command -nargs=* -complete=customlist,T1 TCmd1 |
30203
a3016780f346
patch 9.0.0437: no error when custom completion function returns wrong type
Bram Moolenaar <Bram@vim.org>
parents:
30017
diff
changeset
|
691 call assert_fails('call feedkeys(":TCmd1 \<C-A>\<C-B>\"\<CR>", "xt")', 'E1303: Custom list completion function does not return a List but a string') |
20128
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20043
diff
changeset
|
692 call assert_equal('"TCmd1 ', @:) |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
693 delcommand TCmd1 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
694 delfunc T1 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
695 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
696 func T2(a, c, p) |
20128
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20043
diff
changeset
|
697 return {} |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
698 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
699 command -nargs=* -complete=customlist,T2 TCmd2 |
30203
a3016780f346
patch 9.0.0437: no error when custom completion function returns wrong type
Bram Moolenaar <Bram@vim.org>
parents:
30017
diff
changeset
|
700 call assert_fails('call feedkeys(":TCmd2 \<C-A>\<C-B>\"\<CR>", "xt")', 'E1303: Custom list completion function does not return a List but a dict') |
20128
0b35a7ffceb2
patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents:
20043
diff
changeset
|
701 call assert_equal('"TCmd2 ', @:) |
19724
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
702 delcommand TCmd2 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
703 delfunc T2 |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
704 endfunc |
b3e93a05c3ca
patch 8.2.0418: code in eval.c not sufficiently covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
705 |
25382
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
706 func Test_usercmd_with_block() |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
707 command DoSomething { |
25739
8c4dee4d1ac6
patch 8.2.3405: cannot have a comment line in a {} block of a user command
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
708 g:didit = 'yes' # comment |
8c4dee4d1ac6
patch 8.2.3405: cannot have a comment line in a {} block of a user command
Bram Moolenaar <Bram@vim.org>
parents:
25521
diff
changeset
|
709 # comment line |
25382
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
710 g:didmore = 'more' |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
711 } |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
712 DoSomething |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
713 call assert_equal('yes', g:didit) |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
714 call assert_equal('more', g:didmore) |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
715 unlet g:didit |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
716 unlet g:didmore |
25396
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
717 delcommand DoSomething |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
718 |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
719 command DoMap { |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
720 echo [1, 2, 3]->map((_, v) => v + 1) |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
721 } |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
722 DoMap |
8ecd3575bc8c
patch 8.2.3235: cannot use lambda in {} block in user command
Bram Moolenaar <Bram@vim.org>
parents:
25382
diff
changeset
|
723 delcommand DoMap |
25382
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
724 |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
725 let lines =<< trim END |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
726 command DoesNotEnd { |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
727 echo 'hello' |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
728 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
729 call v9.CheckScriptFailure(lines, 'E1026:') |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
730 delcommand DoesNotEnd |
25521
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25396
diff
changeset
|
731 |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25396
diff
changeset
|
732 let lines =<< trim END |
26576
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
733 command HelloThere { |
25521
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25396
diff
changeset
|
734 echo 'hello' | echo 'there' |
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25396
diff
changeset
|
735 } |
26576
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
736 HelloThere |
25521
2063b858cad9
patch 8.2.3297: cannot use all commands inside a {} block
Bram Moolenaar <Bram@vim.org>
parents:
25396
diff
changeset
|
737 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
738 call v9.CheckScriptSuccess(lines) |
26576
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
739 delcommand HelloThere |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
740 |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
741 let lines =<< trim END |
28690
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
742 command EchoCond { |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
743 const test: string = true |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
744 ? 'true' |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
745 : 'false' |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
746 g:result = test |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
747 } |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
748 EchoCond |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
749 END |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
750 call v9.CheckScriptSuccess(lines) |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
751 call assert_equal('true', g:result) |
28743
cf6bba7a9b0f
patch 8.2.4896: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28690
diff
changeset
|
752 unlet g:result |
cf6bba7a9b0f
patch 8.2.4896: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28690
diff
changeset
|
753 |
cf6bba7a9b0f
patch 8.2.4896: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28690
diff
changeset
|
754 call feedkeys(":EchoCond\<CR>", 'xt') |
cf6bba7a9b0f
patch 8.2.4896: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28690
diff
changeset
|
755 call assert_equal('true', g:result) |
cf6bba7a9b0f
patch 8.2.4896: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28690
diff
changeset
|
756 |
28690
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
757 delcommand EchoCond |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
758 unlet g:result |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
759 |
9a7a2908e1a8
patch 8.2.4869: expression in command block does not look after NL
Bram Moolenaar <Bram@vim.org>
parents:
28181
diff
changeset
|
760 let lines =<< trim END |
26576
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
761 command BadCommand { |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
762 echo { |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
763 'key': 'value', |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
764 } |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
765 } |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
766 BadCommand |
5ea6db641b5e
patch 8.2.3817: Vim9: Not using NL as command end does not work for :autocmd
Bram Moolenaar <Bram@vim.org>
parents:
26498
diff
changeset
|
767 END |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
27187
diff
changeset
|
768 call v9.CheckScriptFailure(lines, 'E1128:') |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
769 delcommand BadCommand |
25382
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
770 endfunc |
b80e4e9c4988
patch 8.2.3228: cannot use a simple block for the :command argument
Bram Moolenaar <Bram@vim.org>
parents:
25226
diff
changeset
|
771 |
25796
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
772 func Test_delcommand_buffer() |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
773 command Global echo 'global' |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
774 command -buffer OneBuffer echo 'one' |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
775 new |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
776 command -buffer TwoBuffer echo 'two' |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
777 call assert_equal(0, exists(':OneBuffer')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
778 call assert_equal(2, exists(':Global')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
779 call assert_equal(2, exists(':TwoBuffer')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
780 delcommand -buffer TwoBuffer |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
781 call assert_equal(0, exists(':TwoBuffer')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
782 call assert_fails('delcommand -buffer Global', 'E1237:') |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
783 call assert_fails('delcommand -buffer OneBuffer', 'E1237:') |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
784 bwipe! |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
785 call assert_equal(2, exists(':OneBuffer')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
786 delcommand -buffer OneBuffer |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
787 call assert_equal(0, exists(':OneBuffer')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
788 call assert_fails('delcommand -buffer Global', 'E1237:') |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
789 delcommand Global |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
790 call assert_equal(0, exists(':Global')) |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
791 endfunc |
60e4892dfa45
patch 8.2.3433: :delcommand does not take a -buffer option
Bram Moolenaar <Bram@vim.org>
parents:
25739
diff
changeset
|
792 |
26327
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
793 def Test_count_with_quotes() |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
794 command -count GetCount g:nr = <count> |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
795 execute("GetCount 1'2") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
796 assert_equal(12, g:nr) |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
797 execute("GetCount 1'234'567") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
798 assert_equal(1'234'567, g:nr) |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
799 |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
800 execute("GetCount 1'234'567'890'123'456'789'012") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
801 assert_equal(v:sizeoflong == 8 ? 9223372036854775807 : 2147483647, g:nr) |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
802 |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
803 # TODO: test with negative number once this is supported |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
804 |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
805 assert_fails("GetCount '12", "E488:") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
806 assert_fails("GetCount 12'", "E488:") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
807 assert_fails("GetCount 1''2", "E488:") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
808 |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
809 assert_fails(":1'2GetCount", 'E492:') |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
810 new |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
811 setline(1, 'text') |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
812 normal ma |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
813 execute(":1, 'aprint") |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
814 bwipe! |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
815 |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
816 unlet g:nr |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
817 delcommand GetCount |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
818 enddef |
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
819 |
26498
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
820 func DefCmd(name) |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
821 if len(a:name) > 30 |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
822 return |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
823 endif |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
824 exe 'command ' .. a:name .. ' call DefCmd("' .. a:name .. 'x")' |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
825 echo a:name |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
826 exe a:name |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
827 endfunc |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
828 |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
829 func Test_recursive_define() |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
830 call DefCmd('Command') |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
831 |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
832 let name = 'Command' |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
833 while len(name) <= 30 |
26498
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
834 exe 'delcommand ' .. name |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
835 let name ..= 'x' |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
836 endwhile |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
837 endfunc |
e36aefc588c2
patch 8.2.3779: using freed memory when defining a user command recursively
Bram Moolenaar <Bram@vim.org>
parents:
26327
diff
changeset
|
838 |
27760
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
839 " Test for using buffer-local ambiguous user-defined commands |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
840 func Test_buflocal_ambiguous_usercmd() |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
841 new |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
842 command -buffer -nargs=1 -complete=sign TestCmd1 echo "Hello" |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
843 command -buffer -nargs=1 -complete=sign TestCmd2 echo "World" |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
844 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
845 call assert_fails("call feedkeys(':TestCmd\<CR>', 'xt')", 'E464:') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
846 call feedkeys(":TestCmd \<Tab>\<C-B>\"\<CR>", 'xt') |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
847 call assert_equal('"TestCmd ', @:) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
848 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
849 delcommand TestCmd1 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
850 delcommand TestCmd2 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
851 bw! |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
852 endfunc |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
853 |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
854 " Test for using a multibyte character in a user command |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
855 func Test_multibyte_in_usercmd() |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
856 command SubJapanesePeriodToDot exe "%s/\u3002/./g" |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
857 new |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
858 call setline(1, "Hello\u3002") |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
859 SubJapanesePeriodToDot |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
860 call assert_equal('Hello.', getline(1)) |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
861 bw! |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
862 delcommand SubJapanesePeriodToDot |
010fa62d6fe2
patch 8.2.4406: expand functions use confusing argument names
Bram Moolenaar <Bram@vim.org>
parents:
27700
diff
changeset
|
863 endfunc |
26327
227543e4181f
patch 8.2.3694: cannot use quotes in the count of an Ex command
Bram Moolenaar <Bram@vim.org>
parents:
26107
diff
changeset
|
864 |
28181
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
865 " Declaring a variable in a {} uses Vim9 script rules, even when defined in a |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
866 " legacy script. |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
867 func Test_block_declaration_legacy_script() |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
868 let lines =<< trim END |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
869 command -range Rename { |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
870 var save = @a |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
871 @a = 'something' |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
872 g:someExpr = @a |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
873 @a = save |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
874 } |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
875 END |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30203
diff
changeset
|
876 call writefile(lines, 'Xlegacy', 'D') |
28181
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
877 source Xlegacy |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
878 |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
879 let lines =<< trim END |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
880 let @a = 'saved' |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
881 Rename |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
882 call assert_equal('something', g:someExpr) |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
883 call assert_equal('saved', @a) |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
884 |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
885 let g:someExpr = 'xxx' |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
886 let @a = 'also' |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
887 Rename |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
888 call assert_equal('something', g:someExpr) |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
889 call assert_equal('also', @a) |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
890 END |
30867
0913cd44fdfa
patch 9.0.0768: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30203
diff
changeset
|
891 call writefile(lines, 'Xother', 'D') |
28181
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
892 source Xother |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
893 |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
894 unlet g:someExpr |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
895 delcommand Rename |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
896 endfunc |
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
897 |
31085
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
898 func Test_comclear_while_listing() |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
899 call CheckRunVimInTerminal() |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
900 |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
901 let lines =<< trim END |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
902 set nocompatible |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
903 comclear |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
904 for i in range(1, 999) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
905 exe 'command ' .. 'Foo' .. i .. ' bar' |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
906 endfor |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
907 au CmdlineLeave : call timer_start(0, {-> execute('comclear')}) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
908 END |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
909 call writefile(lines, 'Xcommandclear', 'D') |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
910 let buf = RunVimInTerminal('-S Xcommandclear', {'rows': 10}) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
911 |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
912 " this was using freed memory |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
913 call term_sendkeys(buf, ":command\<CR>") |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
914 call TermWait(buf, 50) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
915 call term_sendkeys(buf, "j") |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
916 call TermWait(buf, 50) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
917 call term_sendkeys(buf, "G") |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
918 call term_sendkeys(buf, "\<CR>") |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
919 |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
920 call StopVimInTerminal(buf) |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
921 endfunc |
8c10a0b22015
patch 9.0.0877: using freed memory with :comclear while listing commands
Bram Moolenaar <Bram@vim.org>
parents:
30904
diff
changeset
|
922 |
28181
2961a18f9cbf
patch 8.2.4616: Vim9: Declarations in a {} block of a user command remain
Bram Moolenaar <Bram@vim.org>
parents:
27760
diff
changeset
|
923 |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
16475
diff
changeset
|
924 " vim: shiftwidth=2 sts=2 expandtab |