xref: /vim-8.2.3635/runtime/doc/testing.txt (revision f7c4d836)
12547aa93SBram Moolenaar*testing.txt*	For Vim version 8.2.  Last change: 2020 Jul 11
2ed997adaSBram Moolenaar
3ed997adaSBram Moolenaar
4ed997adaSBram Moolenaar		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5ed997adaSBram Moolenaar
6ed997adaSBram Moolenaar
7ed997adaSBram MoolenaarTesting Vim and Vim script			*testing-support*
8ed997adaSBram Moolenaar
9ed997adaSBram MoolenaarExpression evaluation is explained in |eval.txt|.  This file goes into details
10ed997adaSBram Moolenaarabout writing tests in Vim script.  This can be used for testing Vim itself
11ed997adaSBram Moolenaarand for testing plugins.
12ed997adaSBram Moolenaar
13ed997adaSBram Moolenaar1. Testing Vim				|testing|
145477506aSBram Moolenaar2. Test functions			|test-functions-details|
155477506aSBram Moolenaar3. Assert functions			|assert-functions-details|
16ed997adaSBram Moolenaar
17ed997adaSBram Moolenaar==============================================================================
18ed997adaSBram Moolenaar1. Testing Vim						*testing*
19ed997adaSBram Moolenaar
20ed997adaSBram MoolenaarVim can be tested after building it, usually with "make test".
21ed997adaSBram MoolenaarThe tests are located in the directory "src/testdir".
22ed997adaSBram Moolenaar
23ed997adaSBram Moolenaar						*new-style-testing*
24*f7c4d836SBram MoolenaarNew tests should be added as new style tests.  The test scripts are named
25*f7c4d836SBram Moolenaartest_<feature>.vim (replace <feature> with the feature under test). These use
26*f7c4d836SBram Moolenaarfunctions such as |assert_equal()| to keep the test commands and the expected
27*f7c4d836SBram Moolenaarresult in one place.
28ed997adaSBram Moolenaar
29ed997adaSBram MoolenaarFind more information in the file src/testdir/README.txt.
30ed997adaSBram Moolenaar
31ed997adaSBram Moolenaar==============================================================================
325477506aSBram Moolenaar2. Test functions				*test-functions-details*
33ed997adaSBram Moolenaar
34ed997adaSBram Moolenaartest_alloc_fail({id}, {countdown}, {repeat})		*test_alloc_fail()*
35ed997adaSBram Moolenaar		This is for testing: If the memory allocation with {id} is
36ed997adaSBram Moolenaar		called, then decrement {countdown}, and when it reaches zero
37ed997adaSBram Moolenaar		let memory allocation fail {repeat} times.  When {repeat} is
38ed997adaSBram Moolenaar		smaller than one it fails one time.
39ed997adaSBram Moolenaar
40ce90e36fSBram Moolenaar		Can also be used as a |method|: >
41ce90e36fSBram Moolenaar			GetAllocId()->test_alloc_fail()
42ed997adaSBram Moolenaar
43ed997adaSBram Moolenaartest_autochdir()					*test_autochdir()*
44ed997adaSBram Moolenaar		Set a flag to enable the effect of 'autochdir' before Vim
45ed997adaSBram Moolenaar		startup has finished.
46ed997adaSBram Moolenaar
47ed997adaSBram Moolenaar
48ed997adaSBram Moolenaartest_feedinput({string})				*test_feedinput()*
49ed997adaSBram Moolenaar		Characters in {string} are queued for processing as if they
50ed997adaSBram Moolenaar		were typed by the user. This uses a low level input buffer.
51ed997adaSBram Moolenaar		This function works only when with |+unix| or GUI is running.
52ed997adaSBram Moolenaar
53ce90e36fSBram Moolenaar		Can also be used as a |method|: >
54ce90e36fSBram Moolenaar			GetText()->test_feedinput()
55ed997adaSBram Moolenaar
56ed997adaSBram Moolenaartest_garbagecollect_now()			 *test_garbagecollect_now()*
57ed997adaSBram Moolenaar		Like garbagecollect(), but executed right away.  This must
58ed997adaSBram Moolenaar		only be called directly to avoid any structure to exist
59ed997adaSBram Moolenaar		internally, and |v:testing| must have been set before calling
60ed997adaSBram Moolenaar		any function.
61ed997adaSBram Moolenaar
62ed997adaSBram Moolenaar
63ed997adaSBram Moolenaartest_garbagecollect_soon()			 *test_garbagecollect_soon()*
64ed997adaSBram Moolenaar		Set the flag to call the garbagecollector as if in the main
65ed997adaSBram Moolenaar		loop.  Only to be used in tests.
66ed997adaSBram Moolenaar
67ed997adaSBram Moolenaar
68ed997adaSBram Moolenaartest_getvalue({name})					*test_getvalue()*
69ed997adaSBram Moolenaar		Get the value of an internal variable.  These values for
70ed997adaSBram Moolenaar		{name} are supported:
71ed997adaSBram Moolenaar			need_fileinfo
72ed997adaSBram Moolenaar
73ce90e36fSBram Moolenaar		Can also be used as a |method|: >
74ce90e36fSBram Moolenaar			GetName()->test_getvalue()
75ed997adaSBram Moolenaar
76ed997adaSBram Moolenaartest_ignore_error({expr})			 *test_ignore_error()*
77ed997adaSBram Moolenaar		Ignore any error containing {expr}.  A normal message is given
78ed997adaSBram Moolenaar		instead.
79ed997adaSBram Moolenaar		This is only meant to be used in tests, where catching the
80ed997adaSBram Moolenaar		error with try/catch cannot be used (because it skips over
81ed997adaSBram Moolenaar		following code).
82ed997adaSBram Moolenaar		{expr} is used literally, not as a pattern.
83ed997adaSBram Moolenaar		When the {expr} is the string "RESET" then the list of ignored
84ed997adaSBram Moolenaar		errors is made empty.
85ed997adaSBram Moolenaar
86ce90e36fSBram Moolenaar		Can also be used as a |method|: >
87ce90e36fSBram Moolenaar			GetErrorText()->test_ignore_error()
88ed997adaSBram Moolenaar
89ed997adaSBram Moolenaartest_null_blob()					*test_null_blob()*
90ed997adaSBram Moolenaar		Return a |Blob| that is null. Only useful for testing.
91ed997adaSBram Moolenaar
92ed997adaSBram Moolenaar
93ed997adaSBram Moolenaartest_null_channel()					*test_null_channel()*
94ed997adaSBram Moolenaar		Return a |Channel| that is null. Only useful for testing.
95ed997adaSBram Moolenaar		{only available when compiled with the +channel feature}
96ed997adaSBram Moolenaar
97ed997adaSBram Moolenaar
98ed997adaSBram Moolenaartest_null_dict()					*test_null_dict()*
99ed997adaSBram Moolenaar		Return a |Dict| that is null. Only useful for testing.
100ed997adaSBram Moolenaar
101ed997adaSBram Moolenaar
102e69f6d04SBram Moolenaartest_null_function()					*test_null_function()*
103d1caa941SBram Moolenaar		Return a |Funcref| that is null. Only useful for testing.
104e69f6d04SBram Moolenaar
105e69f6d04SBram Moolenaar
106ed997adaSBram Moolenaartest_null_job()						*test_null_job()*
107ed997adaSBram Moolenaar		Return a |Job| that is null. Only useful for testing.
108ed997adaSBram Moolenaar		{only available when compiled with the +job feature}
109ed997adaSBram Moolenaar
110ed997adaSBram Moolenaar
111ed997adaSBram Moolenaartest_null_list()					*test_null_list()*
112ed997adaSBram Moolenaar		Return a |List| that is null. Only useful for testing.
113ed997adaSBram Moolenaar
114ed997adaSBram Moolenaar
115ed997adaSBram Moolenaartest_null_partial()					*test_null_partial()*
116ed997adaSBram Moolenaar		Return a |Partial| that is null. Only useful for testing.
117ed997adaSBram Moolenaar
118ed997adaSBram Moolenaar
119ed997adaSBram Moolenaartest_null_string()					*test_null_string()*
120ed997adaSBram Moolenaar		Return a |String| that is null. Only useful for testing.
121ed997adaSBram Moolenaar
122ed997adaSBram Moolenaar
1238ed04587SBram Moolenaartest_unknown()						*test_unknown()*
1248ed04587SBram Moolenaar		Return a value with unknown type. Only useful for testing.
1258ed04587SBram Moolenaar
1268ed04587SBram Moolenaartest_void()						*test_void()*
1278ed04587SBram Moolenaar		Return a value with void type. Only useful for testing.
1288ed04587SBram Moolenaar
1298ed04587SBram Moolenaar
130ed997adaSBram Moolenaartest_option_not_set({name})				*test_option_not_set()*
131ed997adaSBram Moolenaar		Reset the flag that indicates option {name} was set.  Thus it
132ed997adaSBram Moolenaar		looks like it still has the default value. Use like this: >
133ed997adaSBram Moolenaar			set ambiwidth=double
134ed997adaSBram Moolenaar			call test_option_not_set('ambiwidth')
135ed997adaSBram Moolenaar<		Now the 'ambiwidth' option behaves like it was never changed,
136ed997adaSBram Moolenaar		even though the value is "double".
137ed997adaSBram Moolenaar		Only to be used for testing!
138ed997adaSBram Moolenaar
139ce90e36fSBram Moolenaar		Can also be used as a |method|: >
140ce90e36fSBram Moolenaar			GetOptionName()->test_option_not_set()
141ce90e36fSBram Moolenaar
142ed997adaSBram Moolenaar
143ed997adaSBram Moolenaartest_override({name}, {val})				*test_override()*
144ed997adaSBram Moolenaar		Overrides certain parts of Vim's internal processing to be able
145ed997adaSBram Moolenaar		to run tests. Only to be used for testing Vim!
146ed997adaSBram Moolenaar		The override is enabled when {val} is non-zero and removed
147ed997adaSBram Moolenaar		when {val} is zero.
148ed997adaSBram Moolenaar		Current supported values for name are:
149ed997adaSBram Moolenaar
150ed997adaSBram Moolenaar		name	     effect when {val} is non-zero ~
151ed997adaSBram Moolenaar		redraw       disable the redrawing() function
152ed997adaSBram Moolenaar		redraw_flag  ignore the RedrawingDisabled flag
153ed997adaSBram Moolenaar		char_avail   disable the char_avail() function
154ed997adaSBram Moolenaar		starting     reset the "starting" variable, see below
155ed997adaSBram Moolenaar		nfa_fail     makes the NFA regexp engine fail to force a
156ed997adaSBram Moolenaar			     fallback to the old engine
157ed997adaSBram Moolenaar		no_query_mouse  do not query the mouse position for "dec"
158ed997adaSBram Moolenaar				terminals
159ed997adaSBram Moolenaar		no_wait_return	set the "no_wait_return" flag.  Not restored
160ed997adaSBram Moolenaar				with "ALL".
161b340baedSBram Moolenaar		ui_delay     time in msec to use in ui_delay(); overrules a
162b340baedSBram Moolenaar			     wait time of up to 3 seconds for messages
1630c0eddd3SBram Moolenaar		term_props   reset all terminal properties when the version
1640c0eddd3SBram Moolenaar			     string is detected
165ed997adaSBram Moolenaar		ALL	     clear all overrides ({val} is not used)
166ed997adaSBram Moolenaar
167ed997adaSBram Moolenaar		"starting" is to be used when a test should behave like
168ed997adaSBram Moolenaar		startup was done.  Since the tests are run by sourcing a
169ed997adaSBram Moolenaar		script the "starting" variable is non-zero. This is usually a
170ed997adaSBram Moolenaar		good thing (tests run faster), but sometimes changes behavior
171ed997adaSBram Moolenaar		in a way that the test doesn't work properly.
172ed997adaSBram Moolenaar		When using: >
173ed997adaSBram Moolenaar			call test_override('starting', 1)
174ed997adaSBram Moolenaar<		The value of "starting" is saved.  It is restored by: >
175ed997adaSBram Moolenaar			call test_override('starting', 0)
176ed997adaSBram Moolenaar
177ce90e36fSBram Moolenaar<		Can also be used as a |method|: >
178ce90e36fSBram Moolenaar			GetOverrideVal()-> test_override('starting')
179ed997adaSBram Moolenaar
180ed997adaSBram Moolenaartest_refcount({expr})					*test_refcount()*
181ed997adaSBram Moolenaar		Return the reference count of {expr}.  When {expr} is of a
182ed997adaSBram Moolenaar		type that does not have a reference count, returns -1.  Only
183ed997adaSBram Moolenaar		to be used for testing.
184ed997adaSBram Moolenaar
185ce90e36fSBram Moolenaar		Can also be used as a |method|: >
186ce90e36fSBram Moolenaar			GetVarname()->test_refcount()
187ce90e36fSBram Moolenaar
188ed997adaSBram Moolenaar
189ed997adaSBram Moolenaartest_scrollbar({which}, {value}, {dragging})		*test_scrollbar()*
190ed997adaSBram Moolenaar		Pretend using scrollbar {which} to move it to position
191ed997adaSBram Moolenaar		{value}.  {which} can be:
192ed997adaSBram Moolenaar			left	Left scrollbar of the current window
193ed997adaSBram Moolenaar			right	Right scrollbar of the current window
194ed997adaSBram Moolenaar			hor	Horizontal scrollbar
195ed997adaSBram Moolenaar
196ed997adaSBram Moolenaar		For the vertical scrollbars {value} can be 1 to the
197ed997adaSBram Moolenaar		line-count of the buffer.  For the horizontal scrollbar the
198ed997adaSBram Moolenaar		{value} can be between 1 and the maximum line length, assuming
199ed997adaSBram Moolenaar		'wrap' is not set.
200ed997adaSBram Moolenaar
201ed997adaSBram Moolenaar		When {dragging} is non-zero it's like dragging the scrollbar,
202ed997adaSBram Moolenaar		otherwise it's like clicking in the scrollbar.
203ed997adaSBram Moolenaar		Only works when the {which} scrollbar actually exists,
204ed997adaSBram Moolenaar		obviously only when using the GUI.
205ed997adaSBram Moolenaar
206ce90e36fSBram Moolenaar		Can also be used as a |method|: >
207ce90e36fSBram Moolenaar			GetValue()->test_scrollbar('right', 0)
208ed997adaSBram Moolenaar
209ed997adaSBram Moolenaartest_setmouse({row}, {col})				*test_setmouse()*
210ed997adaSBram Moolenaar		Set the mouse position to be used for the next mouse action.
211ed997adaSBram Moolenaar		{row} and {col} are one based.
212ed997adaSBram Moolenaar		For example: >
213ed997adaSBram Moolenaar			call test_setmouse(4, 20)
214ed997adaSBram Moolenaar			call feedkeys("\<LeftMouse>", "xt")
215ed997adaSBram Moolenaar
216ed997adaSBram Moolenaartest_settime({expr})					*test_settime()*
217ed997adaSBram Moolenaar		Set the time Vim uses internally.  Currently only used for
218ed997adaSBram Moolenaar		timestamps in the history, as they are used in viminfo, and
219ed997adaSBram Moolenaar		for undo.
220ed997adaSBram Moolenaar		Using a value of 1 makes Vim not sleep after a warning or
221ed997adaSBram Moolenaar		error message.
222ed997adaSBram Moolenaar		{expr} must evaluate to a number.  When the value is zero the
223ed997adaSBram Moolenaar		normal behavior is restored.
224ed997adaSBram Moolenaar
225ce90e36fSBram Moolenaar		Can also be used as a |method|: >
226ce90e36fSBram Moolenaar			GetTime()->test_settime()
227ce90e36fSBram Moolenaar
2284f645c54SBram Moolenaartest_srand_seed([seed])					*test_srand_seed()*
2294f645c54SBram Moolenaar		When [seed] is given this sets the seed value used by
2304f645c54SBram Moolenaar		`srand()`.  When omitted the test seed is removed.
2314f645c54SBram Moolenaar
232ed997adaSBram Moolenaar==============================================================================
2335477506aSBram Moolenaar3. Assert functions				*assert-functions-details*
234ed997adaSBram Moolenaar
235ed997adaSBram Moolenaar
236ed997adaSBram Moolenaarassert_beeps({cmd})					*assert_beeps()*
237ed997adaSBram Moolenaar		Run {cmd} and add an error message to |v:errors| if it does
238ed997adaSBram Moolenaar		NOT produce a beep or visual bell.
239ed997adaSBram Moolenaar		Also see |assert_fails()| and |assert-return|.
240ed997adaSBram Moolenaar
24124278d24SBram Moolenaar		Can also be used as a |method|: >
24224278d24SBram Moolenaar			GetCmd()->assert_beeps()
24324278d24SBram Moolenaar<
244ed997adaSBram Moolenaar							*assert_equal()*
245ed997adaSBram Moolenaarassert_equal({expected}, {actual} [, {msg}])
246ed997adaSBram Moolenaar		When {expected} and {actual} are not equal an error message is
247ed997adaSBram Moolenaar		added to |v:errors| and 1 is returned.  Otherwise zero is
248ed997adaSBram Moolenaar		returned |assert-return|.
249ed997adaSBram Moolenaar		There is no automatic conversion, the String "4" is different
250ed997adaSBram Moolenaar		from the Number 4.  And the number 4 is different from the
251ed997adaSBram Moolenaar		Float 4.0.  The value of 'ignorecase' is not used here, case
252ed997adaSBram Moolenaar		always matters.
253ed997adaSBram Moolenaar		When {msg} is omitted an error in the form "Expected
254ed997adaSBram Moolenaar		{expected} but got {actual}" is produced.
255ed997adaSBram Moolenaar		Example: >
256ed997adaSBram Moolenaar	assert_equal('foo', 'bar')
257ed997adaSBram Moolenaar<		Will result in a string to be added to |v:errors|:
258ed997adaSBram Moolenaar	test.vim line 12: Expected 'foo' but got 'bar' ~
259ed997adaSBram Moolenaar
2607ff78465SBram Moolenaar		Can also be used as a |method|, the base is passed as the
2617ff78465SBram Moolenaar		second argument: >
26225e42231SBram Moolenaar			mylist->assert_equal([1, 2, 3])
26325e42231SBram Moolenaar
26425e42231SBram Moolenaar<							*assert_equalfile()*
265fb517bacSBram Moolenaarassert_equalfile({fname-one}, {fname-two} [, {msg}])
266ed997adaSBram Moolenaar		When the files {fname-one} and {fname-two} do not contain
267ed997adaSBram Moolenaar		exactly the same text an error message is added to |v:errors|.
268ed997adaSBram Moolenaar		Also see |assert-return|.
269ed997adaSBram Moolenaar		When {fname-one} or {fname-two} does not exist the error will
270ed997adaSBram Moolenaar		mention that.
271ed997adaSBram Moolenaar		Mainly useful with |terminal-diff|.
272ed997adaSBram Moolenaar
273e49fbff3SBram Moolenaar		Can also be used as a |method|: >
274e49fbff3SBram Moolenaar			GetLog()->assert_equalfile('expected.log')
275e49fbff3SBram Moolenaar
276ed997adaSBram Moolenaarassert_exception({error} [, {msg}])			*assert_exception()*
277ed997adaSBram Moolenaar		When v:exception does not contain the string {error} an error
278ed997adaSBram Moolenaar		message is added to |v:errors|.  Also see |assert-return|.
279ed997adaSBram Moolenaar		This can be used to assert that a command throws an exception.
280ed997adaSBram Moolenaar		Using the error number, followed by a colon, avoids problems
281ed997adaSBram Moolenaar		with translations: >
282ed997adaSBram Moolenaar			try
283ed997adaSBram Moolenaar			  commandthatfails
284ed997adaSBram Moolenaar			  call assert_false(1, 'command should have failed')
285ed997adaSBram Moolenaar			catch
286ed997adaSBram Moolenaar			  call assert_exception('E492:')
287ed997adaSBram Moolenaar			endtry
288ed997adaSBram Moolenaar
289ed997adaSBram Moolenaarassert_fails({cmd} [, {error} [, {msg}]])			*assert_fails()*
290ed997adaSBram Moolenaar		Run {cmd} and add an error message to |v:errors| if it does
2919b7bf9e9SBram Moolenaar		NOT produce an error or when {error} is not found in the
2929b7bf9e9SBram Moolenaar		error message.  Also see |assert-return|.
2939b7bf9e9SBram Moolenaar
2949b7bf9e9SBram Moolenaar		When {error} is a string it must be found literally in the
2959b7bf9e9SBram Moolenaar		first reported error. Most often this will be the error code,
2969b7bf9e9SBram Moolenaar		including the colon, e.g. "E123:". >
2979b7bf9e9SBram Moolenaar			assert_fails('bad cmd', 'E987:')
2989b7bf9e9SBram Moolenaar<
2999b7bf9e9SBram Moolenaar		When {error} is a |List| with one or two strings, these are
3009b7bf9e9SBram Moolenaar		used as patterns.  The first pattern is matched against the
3019b7bf9e9SBram Moolenaar		first reported error: >
3029b7bf9e9SBram Moolenaar			assert_fails('cmd', ['E987:.*expected bool'])
3039b7bf9e9SBram Moolenaar<		The second pattern, if present, is matched against the last
3049b7bf9e9SBram Moolenaar		reported error.  To only match the last error use an empty
3059b7bf9e9SBram Moolenaar		string for the first error: >
3069b7bf9e9SBram Moolenaar			assert_fails('cmd', ['', 'E987:'])
3079b7bf9e9SBram Moolenaar<
308ed997adaSBram Moolenaar		Note that beeping is not considered an error, and some failing
309ed997adaSBram Moolenaar		commands only beep.  Use |assert_beeps()| for those.
310ed997adaSBram Moolenaar
31124278d24SBram Moolenaar		Can also be used as a |method|: >
31224278d24SBram Moolenaar			GetCmd()->assert_fails('E99:')
31324278d24SBram Moolenaar
314ed997adaSBram Moolenaarassert_false({actual} [, {msg}])				*assert_false()*
315ed997adaSBram Moolenaar		When {actual} is not false an error message is added to
316ed997adaSBram Moolenaar		|v:errors|, like with |assert_equal()|.
317ed997adaSBram Moolenaar		Also see |assert-return|.
318ed997adaSBram Moolenaar		A value is false when it is zero. When {actual} is not a
319ed997adaSBram Moolenaar		number the assert fails.
320ed997adaSBram Moolenaar		When {msg} is omitted an error in the form
321ed997adaSBram Moolenaar		"Expected False but got {actual}" is produced.
322ed997adaSBram Moolenaar
32324278d24SBram Moolenaar		Can also be used as a |method|: >
32424278d24SBram Moolenaar			GetResult()->assert_false()
32524278d24SBram Moolenaar
326ed997adaSBram Moolenaarassert_inrange({lower}, {upper}, {actual} [, {msg}])	 *assert_inrange()*
327ed997adaSBram Moolenaar		This asserts number and |Float| values.  When {actual}  is lower
328ed997adaSBram Moolenaar		than {lower} or higher than {upper} an error message is added
329ed997adaSBram Moolenaar		to |v:errors|.  Also see |assert-return|.
330ed997adaSBram Moolenaar		When {msg} is omitted an error in the form
331ed997adaSBram Moolenaar		"Expected range {lower} - {upper}, but got {actual}" is
332ed997adaSBram Moolenaar		produced.
333ed997adaSBram Moolenaar
334ed997adaSBram Moolenaar								*assert_match()*
335ed997adaSBram Moolenaarassert_match({pattern}, {actual} [, {msg}])
336ed997adaSBram Moolenaar		When {pattern} does not match {actual} an error message is
337ed997adaSBram Moolenaar		added to |v:errors|.  Also see |assert-return|.
338ed997adaSBram Moolenaar
339ed997adaSBram Moolenaar		{pattern} is used as with |=~|: The matching is always done
340ed997adaSBram Moolenaar		like 'magic' was set and 'cpoptions' is empty, no matter what
341ed997adaSBram Moolenaar		the actual value of 'magic' or 'cpoptions' is.
342ed997adaSBram Moolenaar
343ed997adaSBram Moolenaar		{actual} is used as a string, automatic conversion applies.
344ed997adaSBram Moolenaar		Use "^" and "$" to match with the start and end of the text.
345ed997adaSBram Moolenaar		Use both to match the whole text.
346ed997adaSBram Moolenaar
347ed997adaSBram Moolenaar		When {msg} is omitted an error in the form
348ed997adaSBram Moolenaar		"Pattern {pattern} does not match {actual}" is produced.
349ed997adaSBram Moolenaar		Example: >
350ed997adaSBram Moolenaar	assert_match('^f.*o$', 'foobar')
351ed997adaSBram Moolenaar<		Will result in a string to be added to |v:errors|:
352ed997adaSBram Moolenaar	test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
353ed997adaSBram Moolenaar
35424278d24SBram Moolenaar		Can also be used as a |method|: >
35524278d24SBram Moolenaar			getFile()->assert_match('foo.*')
35624278d24SBram Moolenaar<
357ed997adaSBram Moolenaar							*assert_notequal()*
358ed997adaSBram Moolenaarassert_notequal({expected}, {actual} [, {msg}])
359ed997adaSBram Moolenaar		The opposite of `assert_equal()`: add an error message to
360ed997adaSBram Moolenaar		|v:errors| when {expected} and {actual} are equal.
361ed997adaSBram Moolenaar		Also see |assert-return|.
362ed997adaSBram Moolenaar
36325e42231SBram Moolenaar		Can also be used as a |method|: >
36425e42231SBram Moolenaar			mylist->assert_notequal([1, 2, 3])
36525e42231SBram Moolenaar
36625e42231SBram Moolenaar<							*assert_notmatch()*
367ed997adaSBram Moolenaarassert_notmatch({pattern}, {actual} [, {msg}])
368ed997adaSBram Moolenaar		The opposite of `assert_match()`: add an error message to
369ed997adaSBram Moolenaar		|v:errors| when {pattern} matches {actual}.
370ed997adaSBram Moolenaar		Also see |assert-return|.
371ed997adaSBram Moolenaar
37224278d24SBram Moolenaar		Can also be used as a |method|: >
37324278d24SBram Moolenaar			getFile()->assert_notmatch('bar.*')
37424278d24SBram Moolenaar
375e49fbff3SBram Moolenaar
376ed997adaSBram Moolenaarassert_report({msg})					*assert_report()*
377ed997adaSBram Moolenaar		Report a test failure directly, using {msg}.
378ed997adaSBram Moolenaar		Always returns one.
379ed997adaSBram Moolenaar
380e49fbff3SBram Moolenaar		Can also be used as a |method|: >
381e49fbff3SBram Moolenaar			GetMessage()->assert_report()
382e49fbff3SBram Moolenaar
383e49fbff3SBram Moolenaar
384ed997adaSBram Moolenaarassert_true({actual} [, {msg}])				*assert_true()*
385ed997adaSBram Moolenaar		When {actual} is not true an error message is added to
386ed997adaSBram Moolenaar		|v:errors|, like with |assert_equal()|.
387ed997adaSBram Moolenaar		Also see |assert-return|.
388ed997adaSBram Moolenaar		A value is TRUE when it is a non-zero number.  When {actual}
389ed997adaSBram Moolenaar		is not a number the assert fails.
390ed997adaSBram Moolenaar		When {msg} is omitted an error in the form "Expected True but
391ed997adaSBram Moolenaar		got {actual}" is produced.
392ed997adaSBram Moolenaar
39324278d24SBram Moolenaar		Can also be used as a |method|: >
39424278d24SBram Moolenaar			GetResult()->assert_true()
39524278d24SBram Moolenaar<
396ed997adaSBram Moolenaar
397ed997adaSBram Moolenaar vim:tw=78:ts=8:noet:ft=help:norl:
398