summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1206
blob: a42bd51e7965c496c894424c3e33e6ac53be5215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1206
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1206
Problem:    User command parsing and listing not properly tested.
Solution:   Add more tests. (Dominique Pelle, closes #4296)
Files:	    src/testdir/test_usercommands.vim


*** ../vim-8.1.1205/src/testdir/test_usercommands.vim	2018-12-08 16:03:18.656085902 +0100
--- src/testdir/test_usercommands.vim	2019-04-25 22:39:52.634511195 +0200
***************
*** 304,306 ****
--- 304,446 ----
  
    delcommand DoSomething
  endfunc
+ 
+ func Test_command_list()
+   command! DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0                        :",
+         \           execute('command DoCmd'))
+ 
+   " Test with various -range= and -count= argument values.
+   command! -range DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .                   :",
+         \           execute('command DoCmd'))
+   command! -range=% DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    %                   :",
+         \           execute('command! DoCmd'))
+   command! -range=2 DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    2                   :",
+         \           execute('command DoCmd'))
+   command! -count=2 DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    2c                  :",
+         \           execute('command DoCmd'))
+ 
+   " Test with various -addr= argument values.
+   command! -addr=lines DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .                   :",
+         \           execute('command DoCmd'))
+   command! -addr=arguments DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  arg              :",
+         \           execute('command DoCmd'))
+   command! -addr=buffers DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  buf              :",
+         \           execute('command DoCmd'))
+   command! -addr=loaded_buffers DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  load             :",
+         \           execute('command DoCmd'))
+   command! -addr=windows DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  win              :",
+         \           execute('command DoCmd'))
+   command! -addr=tabs DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  tab              :",
+         \           execute('command DoCmd'))
+   command! -addr=other DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0    .  ?                :",
+         \           execute('command DoCmd'))
+ 
+   " Test with various -complete= argument values (non-exhaustive list)
+   command! -complete=arglist DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0            arglist     :",
+         \           execute('command DoCmd'))
+   command! -complete=augroup DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0            augroup     :",
+         \           execute('command DoCmd'))
+   command! -complete=custom,CustomComplete DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0            custom      :",
+         \           execute('command DoCmd'))
+   command! -complete=customlist,CustomComplete DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0            customlist  :",
+         \           execute('command DoCmd'))
+ 
+   " Test with various -narg= argument values.
+   command! -nargs=0 DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0                        :",
+         \           execute('command DoCmd'))
+   command! -nargs=1 DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             1                        :",
+         \           execute('command DoCmd'))
+   command! -nargs=* DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             *                        :",
+         \           execute('command DoCmd'))
+   command! -nargs=? DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             ?                        :",
+         \           execute('command DoCmd'))
+   command! -nargs=+ DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             +                        :",
+         \           execute('command DoCmd'))
+ 
+   " Test with other arguments.
+   command! -bang DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n!   DoCmd             0                        :",
+         \           execute('command DoCmd'))
+   command! -bar DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n|   DoCmd             0                        :",
+         \           execute('command DoCmd'))
+   command! -register DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n\"   DoCmd             0                        :",
+         \           execute('command DoCmd'))
+   command! -buffer DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\nb   DoCmd             0                        :"
+         \        .. "\n\"   DoCmd             0                        :",
+         \           execute('command DoCmd'))
+   comclear
+ 
+   " Test with many args.
+   command! -bang -bar -register -buffer -nargs=+ -complete=environment -addr=windows -count=3 DoCmd :
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n!\"b|DoCmd             +    3c win  environment :",
+         \           execute('command DoCmd'))
+   comclear
+ 
+   " Test with special characters in command definition.
+   command! DoCmd :<cr><tab><c-d>
+   call assert_equal("\n    Name              Args Address Complete    Definition"
+         \        .. "\n    DoCmd             0                        :<CR><Tab><C-D>",
+         \           execute('command DoCmd'))
+ 
+   " Test output in verbose mode.
+   command! DoCmd :
+   call assert_match("^\n"
+         \        .. "    Name              Args Address Complete    Definition\n"
+         \        .. "    DoCmd             0                        :\n"
+         \        .. "\tLast set from .*/test_usercommands.vim line \\d\\+$",
+         \           execute('verbose command DoCmd'))
+ 
+   comclear
+   call assert_equal("\nNo user-defined commands found", execute(':command Xxx'))
+   call assert_equal("\nNo user-defined commands found", execute('command'))
+ endfunc
*** ../vim-8.1.1205/src/version.c	2019-04-25 22:21:56.935749161 +0200
--- src/version.c	2019-04-25 22:40:47.594283304 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1206,
  /**/

-- 
Futility Factor: No experiment is ever a complete failure - it can always
serve as a negative example.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///