1
- *testing.txt* For Vim version 8.2. Last change: 2021 Dec 11
1
+ *testing.txt* For Vim version 8.2. Last change: 2022 Apr 03
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -65,8 +65,9 @@ test_garbagecollect_now() *test_garbagecollect_now()*
65
65
Like garbagecollect(), but executed right away. This must
66
66
only be called directly to avoid any structure to exist
67
67
internally, and | v:testing | must have been set before calling
68
- any function. This will not work when called from a :def
69
- function, because variables on the stack will be freed.
68
+ any function. *E1142*
69
+ This will not work when called from a :def function, because
70
+ variables on the stack will be freed.
70
71
71
72
72
73
test_garbagecollect_soon() *test_garbagecollect_soon()*
@@ -82,46 +83,119 @@ test_getvalue({name}) *test_getvalue()*
82
83
Can also be used as a | method | : >
83
84
GetName()->test_getvalue()
84
85
<
85
- *test_gui_drop_files()*
86
- test_gui_drop_files({list} , {row} , {col} , {mods} )
87
- Drop one or more files in {list} in the window at {row} , {col} .
88
- This function only works when the GUI is running and the
89
- | drop_file | feature is present.
90
-
91
- The supported values for {mods} are:
92
- 0x4 Shift
93
- 0x8 Alt
94
- 0x10 Ctrl
95
- The files are added to the | argument-list | and the first file
96
- in {list} is edited in the window. See | drag-n-drop | for more
97
- information.
98
-
99
- *test_gui_mouse_event()*
100
- test_gui_mouse_event({button} , {row} , {col} , {multiclick} , {modifiers} )
101
- Inject a mouse button click event. This function only works
102
- when the GUI is running.
103
- The supported values for {button} are:
104
- 0 right mouse button
105
- 1 middle mouse button
106
- 2 left mouse button
107
- 3 mouse button release
108
- 4 scroll wheel down
109
- 5 scroll wheel up
110
- 6 scroll wheel left
111
- 7 scroll wheel right
112
- {row} and {col} specify the location of the mouse click. The
113
- first row of the Vim window is 1 and the last row is 'lines' .
114
- The maximum value of {col} is 'columns' .
115
- To inject a multiclick event, set {multiclick} to 1.
116
- The supported values for {modifiers} are:
117
- 4 shift is pressed
118
- 8 alt is pressed
119
- 16 ctrl is pressed
120
- After injecting the mouse event you probably should call
86
+ *test_gui_event()*
87
+ test_gui_event({event} , {args} )
88
+ Generate a GUI {event} with arguments {args} for testing Vim
89
+ functionality. This function works only when the GUI is
90
+ running.
91
+
92
+ {event} is a String and the supported values are:
93
+ "dropfiles" drop one or more files in a window.
94
+ "findrepl" search and replace text
95
+ "mouse" mouse button click event.
96
+ "scrollbar" move or drag the scrollbar
97
+ "tabline" select a tab page by mouse click.
98
+ "tabmenu" select a tabline menu entry.
99
+
100
+ {args} is a Dict and contains the arguments for the event.
101
+
102
+ "dropfiles":
103
+ Drop one or more files in a specified window. The supported
104
+ items in {args} are:
105
+ files: List of file names
106
+ row: window row number
107
+ col: window column number
108
+ modifiers: key modifiers. The supported values are:
109
+ 0x4 Shift
110
+ 0x8 Alt
111
+ 0x10 Ctrl
112
+ The files are added to the | argument-list | and the first
113
+ file in {files} is edited in the window. See | drag-n-drop |
114
+ for more information. This event works only when the
115
+ | drop_file | feature is present.
116
+
117
+ "findrepl":
118
+ {only available when the GUI has a find/replace dialog}
119
+ Perform a search and replace of text. The supported items
120
+ in {args} are:
121
+ find_text: string to find.
122
+ repl_text: replacement string
123
+ flags: flags controlling the find/replace. Supported
124
+ values are:
125
+ 1 search next string (find dialog)
126
+ 2 search next string (replace dialog)
127
+ 3 replace string once
128
+ 4 replace all matches
129
+ 8 match whole words only
130
+ 16 match case
131
+ forward: set to 1 for forward search.
132
+
133
+ "mouse":
134
+ Inject either a mouse button click, or a mouse move, event.
135
+ The supported items in {args} are:
136
+ button: mouse button. The supported values are:
137
+ 0 right mouse button
138
+ 1 middle mouse button
139
+ 2 left mouse button
140
+ 3 mouse button release
141
+ 4 scroll wheel down
142
+ 5 scroll wheel up
143
+ 6 scroll wheel left
144
+ 7 scroll wheel right
145
+ row: mouse click row number. The first row of the
146
+ Vim window is 1 and the last row is 'lines' .
147
+ col: mouse click column number. The maximum value
148
+ of {col} is 'columns' .
149
+ multiclick: set to 1 to inject a multiclick mouse event.
150
+ modifiers: key modifiers. The supported values are:
151
+ 4 shift is pressed
152
+ 8 alt is pressed
153
+ 16 ctrl is pressed
154
+ move: Optional; if used and TRUE then a mouse move
155
+ event can be generated.
156
+ Only {args} row: and col: are used and
157
+ required; they are interpreted as pixels.
158
+ Only results in an event when 'mousemoveevent'
159
+ is set or a popup uses mouse move events.
160
+
161
+ "scrollbar":
162
+ Set or drag the left, right or horizontal scrollbar. Only
163
+ works when the scrollbar actually exists. The supported
164
+ items in {args} are:
165
+ which: scrollbar. The supported values are:
166
+ left Left scrollbar of the current window
167
+ right Right scrollbar of the current window
168
+ hor Horizontal scrollbar
169
+ value: amount to scroll. For the vertical scrollbars
170
+ the value can be 1 to the line-count of the
171
+ buffer. For the horizontal scrollbar the
172
+ value can be between 1 and the maximum line
173
+ length, assuming 'wrap' is not set.
174
+ dragging: 1 to drag the scrollbar and 0 to click in the
175
+ scrollbar.
176
+
177
+ "tabline":
178
+ Inject a mouse click event on the tabline to select a
179
+ tabpage. The supported items in {args} are:
180
+ tabnr: tab page number
181
+
182
+ "tabmenu":
183
+ Inject an event to select a tabline menu entry. The
184
+ supported items in {args} are:
185
+ tabnr: tab page number
186
+ item: tab page menu item number. 1 for the first
187
+ menu item, 2 for the second item and so on.
188
+
189
+ After injecting the GUI events you probably should call
121
190
| feedkeys() | to have them processed, e.g.: >
122
191
call feedkeys("y", 'Lx!')
192
+ <
193
+ Returns TRUE if the event is successfully added, FALSE if
194
+ there is a failure.
123
195
124
-
196
+ Can also be used as a | method | : >
197
+ GetEvent()->test_gui_event({args})
198
+ <
125
199
test_ignore_error({expr} ) *test_ignore_error()*
126
200
Ignore any error containing {expr} . A normal message is given
127
201
instead.
@@ -188,24 +262,28 @@ test_override({name}, {val}) *test_override()*
188
262
to run tests. Only to be used for testing Vim!
189
263
The override is enabled when {val} is non-zero and removed
190
264
when {val} is zero.
191
- Current supported values for name are:
265
+ Current supported values for { name} are:
192
266
193
- name effect when {val} is non-zero ~
194
- redraw disable the redrawing() function
195
- redraw_flag ignore the RedrawingDisabled flag
267
+ { name} effect when {val} is non-zero ~
268
+ autoload `import autoload` will load the script right
269
+ away, not postponed until an item is used
196
270
char_avail disable the char_avail() function
197
- starting reset the "starting" variable, see below
198
271
nfa_fail makes the NFA regexp engine fail to force a
199
272
fallback to the old engine
200
273
no_query_mouse do not query the mouse position for "dec"
201
274
terminals
202
275
no_wait_return set the "no_wait_return" flag. Not restored
203
276
with "ALL".
204
- ui_delay time in msec to use in ui_delay(); overrules a
205
- wait time of up to 3 seconds for messages
277
+ redraw disable the redrawing() function
278
+ redraw_flag ignore the RedrawingDisabled flag
279
+ starting reset the "starting" variable, see below
206
280
term_props reset all terminal properties when the version
207
281
string is detected
282
+ ui_delay time in msec to use in ui_delay(); overrules a
283
+ wait time of up to 3 seconds for messages
208
284
uptime overrules sysinfo.uptime
285
+ vterm_title setting the window title by a job running in a
286
+ terminal window
209
287
ALL clear all overrides ({val} is not used)
210
288
211
289
"starting" is to be used when a test should behave like
@@ -231,27 +309,6 @@ test_refcount({expr}) *test_refcount()*
231
309
GetVarname()->test_refcount()
232
310
233
311
234
- test_scrollbar({which} , {value} , {dragging} ) *test_scrollbar()*
235
- Pretend using scrollbar {which} to move it to position
236
- {value} . {which} can be:
237
- left Left scrollbar of the current window
238
- right Right scrollbar of the current window
239
- hor Horizontal scrollbar
240
-
241
- For the vertical scrollbars {value} can be 1 to the
242
- line-count of the buffer. For the horizontal scrollbar the
243
- {value} can be between 1 and the maximum line length, assuming
244
- 'wrap' is not set.
245
-
246
- When {dragging} is non-zero it's like dragging the scrollbar,
247
- otherwise it's like clicking in the scrollbar.
248
- Only works when the {which} scrollbar actually exists,
249
- obviously only when using the GUI.
250
-
251
- Can also be used as a | method | : >
252
- GetValue()->test_scrollbar('right', 0)
253
-
254
-
255
312
test_setmouse({row} , {col} ) *test_setmouse()*
256
313
Set the mouse position to be used for the next mouse action.
257
314
{row} and {col} are one based.
@@ -348,7 +405,7 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
348
405
Run {cmd} and add an error message to | v:errors | if it does
349
406
NOT produce an error or when {error} is not found in the
350
407
error message. Also see | assert-return | .
351
-
408
+ *E856*
352
409
When {error} is a string it must be found literally in the
353
410
first reported error. Most often this will be the error code,
354
411
including the colon, e.g. "E123:". >
@@ -368,12 +425,12 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
368
425
<
369
426
If {msg} is empty then it is not used. Do this to get the
370
427
default message when passing the {lnum} argument.
371
-
428
+ *E1115*
372
429
When {lnum} is present and not negative, and the {error}
373
430
argument is present and matches, then this is compared with
374
431
the line number at which the error was reported. That can be
375
432
the line number in a function or in a script.
376
-
433
+ *E1116*
377
434
When {context} is present it is used as a pattern and matched
378
435
against the context (script name or function name) where
379
436
{lnum} is located in.
0 commit comments