blob: 22ef0d7b34b33f58d88b9c3da4623784ff1fff07 [file] [log] [blame]
Bram Moolenaarf10911e2022-01-29 22:20:48 +00001*testing.txt* For Vim version 8.2. Last change: 2022 Jan 23
Bram Moolenaared997ad2019-07-21 16:42:00 +02002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Testing Vim and Vim script *testing-support*
8
9Expression evaluation is explained in |eval.txt|. This file goes into details
10about writing tests in Vim script. This can be used for testing Vim itself
11and for testing plugins.
12
131. Testing Vim |testing|
Bram Moolenaar54775062019-07-31 21:07:14 +0200142. Test functions |test-functions-details|
153. Assert functions |assert-functions-details|
Bram Moolenaared997ad2019-07-21 16:42:00 +020016
17==============================================================================
181. Testing Vim *testing*
19
20Vim can be tested after building it, usually with "make test".
21The tests are located in the directory "src/testdir".
22
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020023There are two types of tests added over time:
24 test20.in oldest, only for tiny and small builds
25 test_something.vim new style tests
26
Bram Moolenaared997ad2019-07-21 16:42:00 +020027 *new-style-testing*
Bram Moolenaarf7c4d832020-08-11 20:42:19 +020028New tests should be added as new style tests. The test scripts are named
29test_<feature>.vim (replace <feature> with the feature under test). These use
30functions such as |assert_equal()| to keep the test commands and the expected
31result in one place.
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020032 *old-style-testing*
33These tests are used only for testing Vim without the |+eval| feature.
Bram Moolenaared997ad2019-07-21 16:42:00 +020034
35Find more information in the file src/testdir/README.txt.
36
37==============================================================================
Bram Moolenaar54775062019-07-31 21:07:14 +0200382. Test functions *test-functions-details*
Bram Moolenaared997ad2019-07-21 16:42:00 +020039
40test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()*
41 This is for testing: If the memory allocation with {id} is
42 called, then decrement {countdown}, and when it reaches zero
43 let memory allocation fail {repeat} times. When {repeat} is
44 smaller than one it fails one time.
45
Bram Moolenaarce90e362019-09-08 18:58:44 +020046 Can also be used as a |method|: >
47 GetAllocId()->test_alloc_fail()
Bram Moolenaared997ad2019-07-21 16:42:00 +020048
Bram Moolenaar89a9c152021-08-29 21:55:35 +020049
Bram Moolenaared997ad2019-07-21 16:42:00 +020050test_autochdir() *test_autochdir()*
51 Set a flag to enable the effect of 'autochdir' before Vim
52 startup has finished.
53
54
55test_feedinput({string}) *test_feedinput()*
56 Characters in {string} are queued for processing as if they
57 were typed by the user. This uses a low level input buffer.
58 This function works only when with |+unix| or GUI is running.
59
Bram Moolenaarce90e362019-09-08 18:58:44 +020060 Can also be used as a |method|: >
61 GetText()->test_feedinput()
Bram Moolenaared997ad2019-07-21 16:42:00 +020062
Bram Moolenaar89a9c152021-08-29 21:55:35 +020063
Bram Moolenaared997ad2019-07-21 16:42:00 +020064test_garbagecollect_now() *test_garbagecollect_now()*
65 Like garbagecollect(), but executed right away. This must
66 only be called directly to avoid any structure to exist
67 internally, and |v:testing| must have been set before calling
Bram Moolenaar0e6adf82021-12-16 14:41:10 +000068 any function. This will not work when called from a :def
69 function, because variables on the stack will be freed.
Bram Moolenaared997ad2019-07-21 16:42:00 +020070
71
72test_garbagecollect_soon() *test_garbagecollect_soon()*
73 Set the flag to call the garbagecollector as if in the main
74 loop. Only to be used in tests.
75
76
77test_getvalue({name}) *test_getvalue()*
78 Get the value of an internal variable. These values for
79 {name} are supported:
80 need_fileinfo
81
Bram Moolenaarce90e362019-09-08 18:58:44 +020082 Can also be used as a |method|: >
83 GetName()->test_getvalue()
Yegappan Lakshmananf1e74492021-06-21 18:44:26 +020084<
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +000085 *test_gui_event()*
86test_gui_event({event}, {args})
87 Generate a GUI {event} with arguments {args} for testing Vim
88 functionality.
Bram Moolenaar22863042021-10-16 15:23:36 +010089
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +000090 {event} is a String and the supported values are:
91 "dropfiles" drop one or more files in a window.
92 "mouse" mouse button click event.
93 "tabline" select a tab page by mouse click.
94 "tabmenu" select a tabline menu entry.
Yegappan Lakshmanan18d46582021-06-23 20:46:52 +020095
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +000096 {args} is a Dict and contains the arguments for the event.
97
98 "dropfiles":
99 Drop one or more files in a specified window. The supported
100 items in {args} are:
101 files: List of file names
102 row: window row number
103 col: window column number
104 modifiers: key modifiers. The supported values are:
105 0x4 Shift
106 0x8 Alt
107 0x10 Ctrl
108 The files are added to the |argument-list| and the first
109 file in {files} is edited in the window. See |drag-n-drop|
110 for more information. This function only works when the GUI
111 is running and the |drop_file| feature is present.
112
113 "mouse":
114 Inject a mouse button click event. This function only works
115 when the GUI is running. The supported items in {args} are:
116 button: mouse button. The supported values are:
117 0 right mouse button
118 1 middle mouse button
119 2 left mouse button
120 3 mouse button release
121 4 scroll wheel down
122 5 scroll wheel up
123 6 scroll wheel left
124 7 scroll wheel right
125 row: mouse click row number. The first row of the
126 Vim window is 1 and the last row is 'lines'.
127 col: mouse click column number. The maximum value
128 of {col} is 'columns'.
129 multiclick: set to 1 to inject a multiclick mouse event.
130 modifiers: key modifiers. The supported values are:
131 4 shift is pressed
132 8 alt is pressed
133 16 ctrl is pressed
134
135 "tabline":
136 Inject a mouse click event on the tabline to select a
137 tabpage. The supported items in {args} are:
138 tabnr: tab page number
139
140 "tabmenu":
141 Inject an event to select a tabline menu entry. The
142 supported items in {args} are:
143 tabnr: tab page number
144 item: tab page menu item number. 1 for the first
145 menu item, 2 for the second item and so on.
146
147 After injecting the GUI events you probably should call
Yegappan Lakshmananf1e74492021-06-21 18:44:26 +0200148 |feedkeys()| to have them processed, e.g.: >
149 call feedkeys("y", 'Lx!')
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +0000150<
Yegappan Lakshmananb0ad2d92022-01-27 13:16:59 +0000151 Returns TRUE if the event is successfully added, FALSE if
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +0000152 there is a failure.
Yegappan Lakshmananb0ad2d92022-01-27 13:16:59 +0000153
Yegappan Lakshmanan06011e12022-01-30 12:37:29 +0000154 Can also be used as a |method|: >
155 GetEvent()->test_gui_event({args})
156<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200157test_ignore_error({expr}) *test_ignore_error()*
158 Ignore any error containing {expr}. A normal message is given
159 instead.
160 This is only meant to be used in tests, where catching the
161 error with try/catch cannot be used (because it skips over
162 following code).
163 {expr} is used literally, not as a pattern.
164 When the {expr} is the string "RESET" then the list of ignored
165 errors is made empty.
166
Bram Moolenaarce90e362019-09-08 18:58:44 +0200167 Can also be used as a |method|: >
168 GetErrorText()->test_ignore_error()
Bram Moolenaared997ad2019-07-21 16:42:00 +0200169
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200170
Bram Moolenaared997ad2019-07-21 16:42:00 +0200171test_null_blob() *test_null_blob()*
172 Return a |Blob| that is null. Only useful for testing.
173
174
175test_null_channel() *test_null_channel()*
176 Return a |Channel| that is null. Only useful for testing.
177 {only available when compiled with the +channel feature}
178
179
180test_null_dict() *test_null_dict()*
181 Return a |Dict| that is null. Only useful for testing.
182
183
Bram Moolenaare69f6d02020-04-01 22:11:01 +0200184test_null_function() *test_null_function()*
Bram Moolenaard1caa942020-04-10 22:10:56 +0200185 Return a |Funcref| that is null. Only useful for testing.
Bram Moolenaare69f6d02020-04-01 22:11:01 +0200186
187
Bram Moolenaared997ad2019-07-21 16:42:00 +0200188test_null_job() *test_null_job()*
189 Return a |Job| that is null. Only useful for testing.
190 {only available when compiled with the +job feature}
191
192
193test_null_list() *test_null_list()*
194 Return a |List| that is null. Only useful for testing.
195
196
197test_null_partial() *test_null_partial()*
198 Return a |Partial| that is null. Only useful for testing.
199
200
201test_null_string() *test_null_string()*
202 Return a |String| that is null. Only useful for testing.
203
204
205test_option_not_set({name}) *test_option_not_set()*
206 Reset the flag that indicates option {name} was set. Thus it
207 looks like it still has the default value. Use like this: >
208 set ambiwidth=double
209 call test_option_not_set('ambiwidth')
210< Now the 'ambiwidth' option behaves like it was never changed,
211 even though the value is "double".
212 Only to be used for testing!
213
Bram Moolenaarce90e362019-09-08 18:58:44 +0200214 Can also be used as a |method|: >
215 GetOptionName()->test_option_not_set()
216
Bram Moolenaared997ad2019-07-21 16:42:00 +0200217
218test_override({name}, {val}) *test_override()*
219 Overrides certain parts of Vim's internal processing to be able
220 to run tests. Only to be used for testing Vim!
221 The override is enabled when {val} is non-zero and removed
222 when {val} is zero.
Bram Moolenaar3e4fa3d2022-01-13 22:05:09 +0000223 Current supported values for {name} are:
Bram Moolenaared997ad2019-07-21 16:42:00 +0200224
Bram Moolenaar3e4fa3d2022-01-13 22:05:09 +0000225 {name} effect when {val} is non-zero ~
226 autoload `import autoload` will load the script right
227 away, not postponed until an item is used
Bram Moolenaared997ad2019-07-21 16:42:00 +0200228 char_avail disable the char_avail() function
Bram Moolenaared997ad2019-07-21 16:42:00 +0200229 nfa_fail makes the NFA regexp engine fail to force a
230 fallback to the old engine
231 no_query_mouse do not query the mouse position for "dec"
232 terminals
233 no_wait_return set the "no_wait_return" flag. Not restored
234 with "ALL".
Bram Moolenaar3e4fa3d2022-01-13 22:05:09 +0000235 redraw disable the redrawing() function
236 redraw_flag ignore the RedrawingDisabled flag
237 starting reset the "starting" variable, see below
Bram Moolenaar0c0eddd2020-06-13 15:47:25 +0200238 term_props reset all terminal properties when the version
239 string is detected
Bram Moolenaar3e4fa3d2022-01-13 22:05:09 +0000240 ui_delay time in msec to use in ui_delay(); overrules a
241 wait time of up to 3 seconds for messages
Bram Moolenaarc8cdf0f2021-03-13 13:28:13 +0100242 uptime overrules sysinfo.uptime
ichizokae1bd872022-01-20 14:57:29 +0000243 vterm_title setting the window title by a job running in a
244 terminal window
Bram Moolenaared997ad2019-07-21 16:42:00 +0200245 ALL clear all overrides ({val} is not used)
246
247 "starting" is to be used when a test should behave like
248 startup was done. Since the tests are run by sourcing a
249 script the "starting" variable is non-zero. This is usually a
250 good thing (tests run faster), but sometimes changes behavior
251 in a way that the test doesn't work properly.
252 When using: >
253 call test_override('starting', 1)
254< The value of "starting" is saved. It is restored by: >
255 call test_override('starting', 0)
256
Bram Moolenaarce90e362019-09-08 18:58:44 +0200257< Can also be used as a |method|: >
258 GetOverrideVal()-> test_override('starting')
Bram Moolenaared997ad2019-07-21 16:42:00 +0200259
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200260
Bram Moolenaared997ad2019-07-21 16:42:00 +0200261test_refcount({expr}) *test_refcount()*
262 Return the reference count of {expr}. When {expr} is of a
263 type that does not have a reference count, returns -1. Only
264 to be used for testing.
265
Bram Moolenaarce90e362019-09-08 18:58:44 +0200266 Can also be used as a |method|: >
267 GetVarname()->test_refcount()
268
Bram Moolenaared997ad2019-07-21 16:42:00 +0200269
270test_scrollbar({which}, {value}, {dragging}) *test_scrollbar()*
271 Pretend using scrollbar {which} to move it to position
272 {value}. {which} can be:
273 left Left scrollbar of the current window
274 right Right scrollbar of the current window
275 hor Horizontal scrollbar
276
277 For the vertical scrollbars {value} can be 1 to the
278 line-count of the buffer. For the horizontal scrollbar the
279 {value} can be between 1 and the maximum line length, assuming
280 'wrap' is not set.
281
282 When {dragging} is non-zero it's like dragging the scrollbar,
283 otherwise it's like clicking in the scrollbar.
284 Only works when the {which} scrollbar actually exists,
285 obviously only when using the GUI.
286
Bram Moolenaarce90e362019-09-08 18:58:44 +0200287 Can also be used as a |method|: >
288 GetValue()->test_scrollbar('right', 0)
Bram Moolenaared997ad2019-07-21 16:42:00 +0200289
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200290
Bram Moolenaared997ad2019-07-21 16:42:00 +0200291test_setmouse({row}, {col}) *test_setmouse()*
292 Set the mouse position to be used for the next mouse action.
293 {row} and {col} are one based.
294 For example: >
295 call test_setmouse(4, 20)
296 call feedkeys("\<LeftMouse>", "xt")
297
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200298
Bram Moolenaared997ad2019-07-21 16:42:00 +0200299test_settime({expr}) *test_settime()*
300 Set the time Vim uses internally. Currently only used for
301 timestamps in the history, as they are used in viminfo, and
302 for undo.
303 Using a value of 1 makes Vim not sleep after a warning or
304 error message.
305 {expr} must evaluate to a number. When the value is zero the
306 normal behavior is restored.
307
Bram Moolenaarce90e362019-09-08 18:58:44 +0200308 Can also be used as a |method|: >
309 GetTime()->test_settime()
310
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200311
Bram Moolenaar4f645c52020-02-08 16:40:39 +0100312test_srand_seed([seed]) *test_srand_seed()*
313 When [seed] is given this sets the seed value used by
314 `srand()`. When omitted the test seed is removed.
315
Bram Moolenaar89a9c152021-08-29 21:55:35 +0200316
317test_unknown() *test_unknown()*
318 Return a value with unknown type. Only useful for testing.
319
320
321test_void() *test_void()*
322 Return a value with void type. Only useful for testing.
323
Bram Moolenaared997ad2019-07-21 16:42:00 +0200324==============================================================================
Bram Moolenaar54775062019-07-31 21:07:14 +02003253. Assert functions *assert-functions-details*
Bram Moolenaared997ad2019-07-21 16:42:00 +0200326
327
328assert_beeps({cmd}) *assert_beeps()*
329 Run {cmd} and add an error message to |v:errors| if it does
330 NOT produce a beep or visual bell.
Bram Moolenaar5b8cabf2021-04-02 18:55:57 +0200331 Also see |assert_fails()|, |assert_nobeep()| and
332 |assert-return|.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200333
Bram Moolenaar24278d22019-08-16 21:49:22 +0200334 Can also be used as a |method|: >
335 GetCmd()->assert_beeps()
336<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200337 *assert_equal()*
338assert_equal({expected}, {actual} [, {msg}])
339 When {expected} and {actual} are not equal an error message is
340 added to |v:errors| and 1 is returned. Otherwise zero is
341 returned |assert-return|.
342 There is no automatic conversion, the String "4" is different
343 from the Number 4. And the number 4 is different from the
344 Float 4.0. The value of 'ignorecase' is not used here, case
345 always matters.
346 When {msg} is omitted an error in the form "Expected
347 {expected} but got {actual}" is produced.
348 Example: >
349 assert_equal('foo', 'bar')
350< Will result in a string to be added to |v:errors|:
351 test.vim line 12: Expected 'foo' but got 'bar' ~
352
Bram Moolenaar7ff78462020-07-10 22:00:53 +0200353 Can also be used as a |method|, the base is passed as the
354 second argument: >
Bram Moolenaar25e42232019-08-04 15:04:10 +0200355 mylist->assert_equal([1, 2, 3])
356
Bram Moolenaar25e42232019-08-04 15:04:10 +0200357< *assert_equalfile()*
Bram Moolenaarfb517ba2020-06-03 19:55:35 +0200358assert_equalfile({fname-one}, {fname-two} [, {msg}])
Bram Moolenaared997ad2019-07-21 16:42:00 +0200359 When the files {fname-one} and {fname-two} do not contain
360 exactly the same text an error message is added to |v:errors|.
361 Also see |assert-return|.
362 When {fname-one} or {fname-two} does not exist the error will
363 mention that.
364 Mainly useful with |terminal-diff|.
365
Bram Moolenaare49fbff2019-08-21 22:50:07 +0200366 Can also be used as a |method|: >
367 GetLog()->assert_equalfile('expected.log')
368
Bram Moolenaared997ad2019-07-21 16:42:00 +0200369assert_exception({error} [, {msg}]) *assert_exception()*
370 When v:exception does not contain the string {error} an error
371 message is added to |v:errors|. Also see |assert-return|.
372 This can be used to assert that a command throws an exception.
373 Using the error number, followed by a colon, avoids problems
374 with translations: >
375 try
376 commandthatfails
377 call assert_false(1, 'command should have failed')
378 catch
379 call assert_exception('E492:')
380 endtry
Bram Moolenaar1d634542020-08-18 13:41:50 +0200381<
382 *assert_fails()*
Bram Moolenaar9bd5d872020-09-06 21:47:48 +0200383assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
Bram Moolenaared997ad2019-07-21 16:42:00 +0200384 Run {cmd} and add an error message to |v:errors| if it does
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200385 NOT produce an error or when {error} is not found in the
386 error message. Also see |assert-return|.
Bram Moolenaar6f4754b2022-01-23 12:07:04 +0000387 *E856*
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200388 When {error} is a string it must be found literally in the
389 first reported error. Most often this will be the error code,
390 including the colon, e.g. "E123:". >
391 assert_fails('bad cmd', 'E987:')
392<
393 When {error} is a |List| with one or two strings, these are
394 used as patterns. The first pattern is matched against the
395 first reported error: >
396 assert_fails('cmd', ['E987:.*expected bool'])
397< The second pattern, if present, is matched against the last
Bram Moolenaar4072ba52020-12-23 13:56:35 +0100398 reported error.
399 If there is only one error then both patterns must match. This
400 can be used to check that there is only one error.
401 To only match the last error use an empty string for the first
402 error: >
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200403 assert_fails('cmd', ['', 'E987:'])
404<
Bram Moolenaar1d634542020-08-18 13:41:50 +0200405 If {msg} is empty then it is not used. Do this to get the
406 default message when passing the {lnum} argument.
Bram Moolenaarf10911e2022-01-29 22:20:48 +0000407 *E1115*
Bram Moolenaar1d634542020-08-18 13:41:50 +0200408 When {lnum} is present and not negative, and the {error}
409 argument is present and matches, then this is compared with
410 the line number at which the error was reported. That can be
411 the line number in a function or in a script.
Bram Moolenaarf10911e2022-01-29 22:20:48 +0000412 *E1116*
Bram Moolenaar9bd5d872020-09-06 21:47:48 +0200413 When {context} is present it is used as a pattern and matched
414 against the context (script name or function name) where
415 {lnum} is located in.
416
Bram Moolenaared997ad2019-07-21 16:42:00 +0200417 Note that beeping is not considered an error, and some failing
418 commands only beep. Use |assert_beeps()| for those.
419
Bram Moolenaar24278d22019-08-16 21:49:22 +0200420 Can also be used as a |method|: >
421 GetCmd()->assert_fails('E99:')
422
Bram Moolenaar1d634542020-08-18 13:41:50 +0200423assert_false({actual} [, {msg}]) *assert_false()*
Bram Moolenaared997ad2019-07-21 16:42:00 +0200424 When {actual} is not false an error message is added to
425 |v:errors|, like with |assert_equal()|.
426 Also see |assert-return|.
427 A value is false when it is zero. When {actual} is not a
428 number the assert fails.
429 When {msg} is omitted an error in the form
430 "Expected False but got {actual}" is produced.
431
Bram Moolenaar24278d22019-08-16 21:49:22 +0200432 Can also be used as a |method|: >
433 GetResult()->assert_false()
434
Bram Moolenaared997ad2019-07-21 16:42:00 +0200435assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
436 This asserts number and |Float| values. When {actual} is lower
437 than {lower} or higher than {upper} an error message is added
438 to |v:errors|. Also see |assert-return|.
439 When {msg} is omitted an error in the form
440 "Expected range {lower} - {upper}, but got {actual}" is
441 produced.
442
443 *assert_match()*
444assert_match({pattern}, {actual} [, {msg}])
445 When {pattern} does not match {actual} an error message is
446 added to |v:errors|. Also see |assert-return|.
447
448 {pattern} is used as with |=~|: The matching is always done
449 like 'magic' was set and 'cpoptions' is empty, no matter what
450 the actual value of 'magic' or 'cpoptions' is.
451
452 {actual} is used as a string, automatic conversion applies.
453 Use "^" and "$" to match with the start and end of the text.
454 Use both to match the whole text.
455
456 When {msg} is omitted an error in the form
457 "Pattern {pattern} does not match {actual}" is produced.
458 Example: >
459 assert_match('^f.*o$', 'foobar')
460< Will result in a string to be added to |v:errors|:
461 test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
462
Bram Moolenaar24278d22019-08-16 21:49:22 +0200463 Can also be used as a |method|: >
464 getFile()->assert_match('foo.*')
465<
Bram Moolenaar5b8cabf2021-04-02 18:55:57 +0200466assert_nobeep({cmd}) *assert_nobeep()*
467 Run {cmd} and add an error message to |v:errors| if it
468 produces a beep or visual bell.
469 Also see |assert_beeps()|.
470
471 Can also be used as a |method|: >
472 GetCmd()->assert_nobeep()
473<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200474 *assert_notequal()*
475assert_notequal({expected}, {actual} [, {msg}])
476 The opposite of `assert_equal()`: add an error message to
477 |v:errors| when {expected} and {actual} are equal.
478 Also see |assert-return|.
479
Bram Moolenaar25e42232019-08-04 15:04:10 +0200480 Can also be used as a |method|: >
481 mylist->assert_notequal([1, 2, 3])
482
483< *assert_notmatch()*
Bram Moolenaared997ad2019-07-21 16:42:00 +0200484assert_notmatch({pattern}, {actual} [, {msg}])
485 The opposite of `assert_match()`: add an error message to
486 |v:errors| when {pattern} matches {actual}.
487 Also see |assert-return|.
488
Bram Moolenaar24278d22019-08-16 21:49:22 +0200489 Can also be used as a |method|: >
490 getFile()->assert_notmatch('bar.*')
491
Bram Moolenaare49fbff2019-08-21 22:50:07 +0200492
Bram Moolenaared997ad2019-07-21 16:42:00 +0200493assert_report({msg}) *assert_report()*
Bram Moolenaar6aa57292021-08-14 21:25:52 +0200494 Report a test failure directly, using String {msg}.
Bram Moolenaared997ad2019-07-21 16:42:00 +0200495 Always returns one.
496
Bram Moolenaare49fbff2019-08-21 22:50:07 +0200497 Can also be used as a |method|: >
498 GetMessage()->assert_report()
499
500
Bram Moolenaared997ad2019-07-21 16:42:00 +0200501assert_true({actual} [, {msg}]) *assert_true()*
502 When {actual} is not true an error message is added to
503 |v:errors|, like with |assert_equal()|.
504 Also see |assert-return|.
505 A value is TRUE when it is a non-zero number. When {actual}
506 is not a number the assert fails.
507 When {msg} is omitted an error in the form "Expected True but
508 got {actual}" is produced.
509
Bram Moolenaar24278d22019-08-16 21:49:22 +0200510 Can also be used as a |method|: >
511 GetResult()->assert_true()
512<
Bram Moolenaared997ad2019-07-21 16:42:00 +0200513
514 vim:tw=78:ts=8:noet:ft=help:norl: