| 
									
										
										
										
											2024-02-18 18:53:08 +01:00
										 |  |  | *testing.txt*	For Vim version 9.1.  Last change: 2024 Feb 18 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		  VIM REFERENCE MANUAL	  by Bram Moolenaar | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Testing Vim and Vim script			*testing-support* | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Expression evaluation is explained in |eval.txt|.  This file goes into details | 
					
						
							|  |  |  | about writing tests in Vim script.  This can be used for testing Vim itself | 
					
						
							|  |  |  | and for testing plugins. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 1. Testing Vim				|testing| | 
					
						
							| 
									
										
										
										
											2019-07-31 21:07:14 +02:00
										 |  |  | 2. Test functions			|test-functions-details| | 
					
						
							|  |  |  | 3. Assert functions			|assert-functions-details| | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | ============================================================================== | 
					
						
							|  |  |  | 1. Testing Vim						*testing* | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Vim can be tested after building it, usually with "make test". | 
					
						
							|  |  |  | The tests are located in the directory "src/testdir". | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-13 18:59:55 +02:00
										 |  |  | There are two types of tests added over time: | 
					
						
							| 
									
										
										
										
											2023-10-05 22:25:12 +02:00
										 |  |  | 	test20.in		oldest, only for tiny builds | 
					
						
							| 
									
										
										
										
											2020-08-13 18:59:55 +02:00
										 |  |  | 	test_something.vim	new style tests | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 						*new-style-testing* | 
					
						
							| 
									
										
										
										
											2020-08-11 20:42:19 +02:00
										 |  |  | New tests should be added as new style tests.  The test scripts are named | 
					
						
							|  |  |  | test_<feature>.vim (replace <feature> with the feature under test). These use | 
					
						
							|  |  |  | functions such as |assert_equal()| to keep the test commands and the expected | 
					
						
							|  |  |  | result in one place. | 
					
						
							| 
									
										
										
										
											2020-08-13 18:59:55 +02:00
										 |  |  | 						*old-style-testing* | 
					
						
							|  |  |  | These tests are used only for testing Vim without the |+eval| feature. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | Find more information in the file src/testdir/README.txt. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ============================================================================== | 
					
						
							| 
									
										
										
										
											2019-07-31 21:07:14 +02:00
										 |  |  | 2. Test functions				*test-functions-details* | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | test_alloc_fail({id}, {countdown}, {repeat})		*test_alloc_fail()* | 
					
						
							|  |  |  | 		This is for testing: If the memory allocation with {id} is | 
					
						
							|  |  |  | 		called, then decrement {countdown}, and when it reaches zero | 
					
						
							|  |  |  | 		let memory allocation fail {repeat} times.  When {repeat} is | 
					
						
							|  |  |  | 		smaller than one it fails one time. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetAllocId()->test_alloc_fail() | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_autochdir()					*test_autochdir()* | 
					
						
							|  |  |  | 		Set a flag to enable the effect of 'autochdir' before Vim | 
					
						
							|  |  |  | 		startup has finished. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_feedinput({string})				*test_feedinput()* | 
					
						
							|  |  |  | 		Characters in {string} are queued for processing as if they | 
					
						
							|  |  |  | 		were typed by the user. This uses a low level input buffer. | 
					
						
							|  |  |  | 		This function works only when with |+unix| or GUI is running. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetText()->test_feedinput() | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_garbagecollect_now()			 *test_garbagecollect_now()* | 
					
						
							|  |  |  | 		Like garbagecollect(), but executed right away.  This must | 
					
						
							|  |  |  | 		only be called directly to avoid any structure to exist | 
					
						
							|  |  |  | 		internally, and |v:testing| must have been set before calling | 
					
						
							| 
									
										
										
										
											2022-02-04 16:09:54 +00:00
										 |  |  | 		any function.   *E1142* | 
					
						
							|  |  |  | 		This will not work when called from a :def function, because | 
					
						
							|  |  |  | 		variables on the stack will be freed. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_garbagecollect_soon()			 *test_garbagecollect_soon()* | 
					
						
							|  |  |  | 		Set the flag to call the garbagecollector as if in the main | 
					
						
							|  |  |  | 		loop.  Only to be used in tests. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_getvalue({name})					*test_getvalue()* | 
					
						
							|  |  |  | 		Get the value of an internal variable.  These values for | 
					
						
							|  |  |  | 		{name} are supported: | 
					
						
							|  |  |  | 			need_fileinfo | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetName()->test_getvalue() | 
					
						
							| 
									
										
										
										
											2021-06-21 18:44:26 +02:00
										 |  |  | < | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 						*test_gui_event()* | 
					
						
							|  |  |  | test_gui_event({event}, {args}) | 
					
						
							|  |  |  | 		Generate a GUI {event} with arguments {args} for testing Vim | 
					
						
							| 
									
										
										
										
											2022-01-30 18:01:24 +00:00
										 |  |  | 		functionality. This function works only when the GUI is | 
					
						
							|  |  |  | 		running. | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		{event} is a String and the supported values are: | 
					
						
							|  |  |  | 		    "dropfiles"	drop one or more files in a window. | 
					
						
							| 
									
										
										
										
											2022-06-26 12:21:15 +01:00
										 |  |  | 		    "findrepl"  search and replace text. | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		    "mouse"	mouse button click event. | 
					
						
							| 
									
										
										
										
											2022-06-26 12:21:15 +01:00
										 |  |  | 		    "scrollbar" move or drag the scrollbar. | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 		    "key"	send a low-level keyboard event. | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		    "tabline"	select a tab page by mouse click. | 
					
						
							|  |  |  | 		    "tabmenu"	select a tabline menu entry. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		{args} is a Dict and contains the arguments for the event. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		"dropfiles": | 
					
						
							|  |  |  | 		  Drop one or more files in a specified window.  The supported | 
					
						
							|  |  |  | 		  items in {args} are: | 
					
						
							|  |  |  | 		    files:	List of file names | 
					
						
							|  |  |  | 		    row:	window row number | 
					
						
							|  |  |  | 		    col:	window column number | 
					
						
							|  |  |  | 		    modifiers:	key modifiers. The supported values are: | 
					
						
							|  |  |  | 				    0x4	Shift | 
					
						
							|  |  |  | 				    0x8	Alt | 
					
						
							|  |  |  | 				   0x10	Ctrl | 
					
						
							|  |  |  | 		  The files are added to the |argument-list| and the first | 
					
						
							|  |  |  | 		  file in {files} is edited in the window.  See |drag-n-drop| | 
					
						
							| 
									
										
										
										
											2022-01-30 18:01:24 +00:00
										 |  |  | 		  for more information.  This event works only when the | 
					
						
							|  |  |  | 		  |drop_file| feature is present. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		"findrepl": | 
					
						
							| 
									
										
										
										
											2022-02-04 16:09:54 +00:00
										 |  |  | 		  {only available when the GUI has a find/replace dialog} | 
					
						
							| 
									
										
										
										
											2022-01-30 18:01:24 +00:00
										 |  |  | 		  Perform a search and replace of text.  The supported items | 
					
						
							|  |  |  | 		  in {args} are: | 
					
						
							|  |  |  | 		    find_text:	string to find. | 
					
						
							| 
									
										
										
										
											2022-06-26 12:21:15 +01:00
										 |  |  | 		    repl_text:	replacement string. | 
					
						
							| 
									
										
										
										
											2022-01-30 18:01:24 +00:00
										 |  |  | 		    flags:	flags controlling the find/replace. Supported | 
					
						
							|  |  |  | 				values are: | 
					
						
							|  |  |  | 				    1	search next string (find dialog) | 
					
						
							|  |  |  | 				    2	search next string (replace dialog) | 
					
						
							|  |  |  | 				    3	replace string once | 
					
						
							|  |  |  | 				    4	replace all matches | 
					
						
							|  |  |  | 				    8	match whole words only | 
					
						
							|  |  |  | 				   16	match case | 
					
						
							|  |  |  | 		    forward:	set to 1 for forward search. | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		"mouse": | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 		  Inject either a mouse button click, or a mouse move, event. | 
					
						
							|  |  |  | 		  The supported items in {args} are: | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		    button:	mouse button.  The supported values are: | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | 				    0	left mouse button | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 				    1	middle mouse button | 
					
						
							| 
									
										
										
										
											2022-12-06 18:20:10 +00:00
										 |  |  | 				    2	right mouse button | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 				    3	mouse button release | 
					
						
							|  |  |  | 				    4	scroll wheel down | 
					
						
							|  |  |  | 				    5	scroll wheel up | 
					
						
							|  |  |  | 				    6	scroll wheel left | 
					
						
							|  |  |  | 				    7	scroll wheel right | 
					
						
							|  |  |  | 		    row:	mouse click row number.  The first row of the | 
					
						
							|  |  |  | 				Vim window is 1 and the last row is 'lines'. | 
					
						
							|  |  |  | 		    col:	mouse click column number.  The maximum value | 
					
						
							|  |  |  | 				of {col} is 'columns'. | 
					
						
							|  |  |  | 		    multiclick:	set to 1 to inject a multiclick mouse event. | 
					
						
							|  |  |  | 		    modifiers:	key modifiers.  The supported values are: | 
					
						
							|  |  |  | 				    4	shift is pressed | 
					
						
							|  |  |  | 				    8	alt is pressed | 
					
						
							|  |  |  | 				   16	ctrl is pressed | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 		    move:	Optional; if used and TRUE then a mouse move | 
					
						
							|  |  |  | 			        event can be generated. | 
					
						
							|  |  |  | 				Only {args} row: and col: are used and | 
					
						
							| 
									
										
										
										
											2022-05-16 15:27:46 +01:00
										 |  |  | 				required; they are interpreted as pixels or | 
					
						
							|  |  |  | 				screen cells, depending on "cell". | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 				Only results in an event when 'mousemoveevent' | 
					
						
							|  |  |  | 				is set or a popup uses mouse move events. | 
					
						
							| 
									
										
										
										
											2022-05-16 15:27:46 +01:00
										 |  |  | 		    cell:	Optional: when present and TRUE then "move" | 
					
						
							|  |  |  | 				uses screen cells instead of pixel positions | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		"scrollbar": | 
					
						
							|  |  |  | 		  Set or drag the left, right or horizontal scrollbar.  Only | 
					
						
							|  |  |  | 		  works when the scrollbar actually exists.  The supported | 
					
						
							|  |  |  | 		  items in {args} are: | 
					
						
							| 
									
										
										
										
											2023-06-10 21:40:39 +01:00
										 |  |  | 		    which:	Selects the scrollbar. The supported values | 
					
						
							|  |  |  | 				are: | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 				    left  Left scrollbar of the current window | 
					
						
							|  |  |  | 				    right Right scrollbar of the current window | 
					
						
							|  |  |  | 				    hor   Horizontal scrollbar | 
					
						
							| 
									
										
										
										
											2023-06-10 21:40:39 +01:00
										 |  |  | 		    value:	Amount to scroll.  For the vertical scrollbars | 
					
						
							|  |  |  | 				the value can be between 0 to the line-count | 
					
						
							|  |  |  | 				of the buffer minus one.  For the horizontal | 
					
						
							|  |  |  | 				scrollbar the value can be between 1 and the | 
					
						
							|  |  |  | 				maximum line length, assuming 'wrap' is not | 
					
						
							|  |  |  | 				set. | 
					
						
							| 
									
										
										
										
											2022-04-03 15:47:28 +01:00
										 |  |  | 		    dragging:	1 to drag the scrollbar and 0 to click in the | 
					
						
							|  |  |  | 				scrollbar. | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 		"key": | 
					
						
							|  |  |  | 		  Send a low-level keyboard event (e.g. key-up or down). | 
					
						
							| 
									
										
										
										
											2022-07-23 05:04:16 +01:00
										 |  |  | 		  Currently only supported on MS-Windows. | 
					
						
							|  |  |  | 		  The supported items in {args} are: | 
					
						
							|  |  |  | 		    event:	The supported string values are: | 
					
						
							|  |  |  | 				    keyup   generate a keyup event | 
					
						
							|  |  |  | 				    keydown generate a keydown event | 
					
						
							|  |  |  | 		    keycode:    Keycode to use for a keyup or a keydown event. | 
					
						
							| 
									
										
										
										
											2022-07-29 21:36:21 +01:00
										 |  |  | 								*E1291* | 
					
						
							| 
									
										
										
										
											2022-07-23 05:04:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		"tabline": | 
					
						
							|  |  |  | 		  Inject a mouse click event on the tabline to select a | 
					
						
							|  |  |  | 		  tabpage. The supported items in {args} are: | 
					
						
							|  |  |  | 		    tabnr:	tab page number | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		"tabmenu": | 
					
						
							|  |  |  | 		  Inject an event to select a tabline menu entry. The | 
					
						
							|  |  |  | 		  supported items in {args} are: | 
					
						
							|  |  |  | 		    tabnr:	tab page number | 
					
						
							| 
									
										
										
										
											2023-02-20 20:44:55 +00:00
										 |  |  | 		    item:	tab page menu item number. 1 for the first | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 				menu item, 2 for the second item and so on. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		After injecting the GUI events you probably should call | 
					
						
							| 
									
										
										
										
											2021-06-21 18:44:26 +02:00
										 |  |  | 		|feedkeys()| to have them processed, e.g.: > | 
					
						
							|  |  |  | 			call feedkeys("y", 'Lx!') | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | < | 
					
						
							| 
									
										
										
										
											2022-01-27 13:16:59 +00:00
										 |  |  | 		Returns TRUE if the event is successfully added, FALSE if | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		there is a failure. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-30 12:37:29 +00:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetEvent()->test_gui_event({args}) | 
					
						
							|  |  |  | < | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_ignore_error({expr})			 *test_ignore_error()* | 
					
						
							|  |  |  | 		Ignore any error containing {expr}.  A normal message is given | 
					
						
							|  |  |  | 		instead. | 
					
						
							|  |  |  | 		This is only meant to be used in tests, where catching the | 
					
						
							|  |  |  | 		error with try/catch cannot be used (because it skips over | 
					
						
							|  |  |  | 		following code). | 
					
						
							|  |  |  | 		{expr} is used literally, not as a pattern. | 
					
						
							|  |  |  | 		When the {expr} is the string "RESET" then the list of ignored | 
					
						
							|  |  |  | 		errors is made empty. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetErrorText()->test_ignore_error() | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-02 13:59:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | test_mswin_event({event}, {args})		*test_mswin_event()* | 
					
						
							|  |  |  | 		Generate a low-level MS-Windows {event} with arguments {args} | 
					
						
							| 
									
										
										
										
											2023-02-02 13:59:48 +00:00
										 |  |  | 		for testing Vim functionality.  It works for MS-Windows GUI | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 		and for the console. | 
					
						
							| 
									
										
										
										
											2023-02-02 13:59:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 		{event} is a String and the supported values are: | 
					
						
							|  |  |  | 		    "mouse"	mouse event. | 
					
						
							|  |  |  | 		    "key"	keyboard event. | 
					
						
							| 
									
										
										
										
											2024-01-23 23:19:02 +01:00
										 |  |  | 		    "set_keycode_trans_strategy" | 
					
						
							| 
									
										
										
										
											2024-02-19 02:51:46 +09:00
										 |  |  | 				Change the key translation method. | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		"mouse": | 
					
						
							|  |  |  | 		  Inject either a mouse button click, or a mouse move, event. | 
					
						
							|  |  |  | 		  The supported items in {args} are: | 
					
						
							|  |  |  | 		    button:	mouse button.  The supported values are: | 
					
						
							|  |  |  | 				    0	right mouse button | 
					
						
							|  |  |  | 				    1	middle mouse button | 
					
						
							|  |  |  | 				    2	left mouse button | 
					
						
							|  |  |  | 				    3	mouse button release | 
					
						
							|  |  |  | 				    4	scroll wheel down | 
					
						
							|  |  |  | 				    5	scroll wheel up | 
					
						
							|  |  |  | 				    6	scroll wheel left | 
					
						
							|  |  |  | 				    7	scroll wheel right | 
					
						
							|  |  |  | 		    row:	mouse click row number.  The first row of the | 
					
						
							|  |  |  | 				Vim window is 1 and the last row is 'lines'. | 
					
						
							|  |  |  | 		    col:	mouse click column number.  The maximum value | 
					
						
							|  |  |  | 				of {col} is 'columns'. | 
					
						
							|  |  |  | 				Note: row and col are always interpreted as | 
					
						
							|  |  |  | 				screen cells for the console application. | 
					
						
							|  |  |  | 				But, they may be interpreted as pixels | 
					
						
							|  |  |  | 				for the GUI, depending on "cell". | 
					
						
							|  |  |  | 		    multiclick:	set to 1 to inject a double-click mouse event. | 
					
						
							|  |  |  | 		    modifiers:	key modifiers.  The supported values are: | 
					
						
							|  |  |  | 				    4	shift is pressed | 
					
						
							|  |  |  | 				    8	alt is pressed | 
					
						
							|  |  |  | 				   16	ctrl is pressed | 
					
						
							|  |  |  | 		    move:	Optional; if used and TRUE then a mouse move | 
					
						
							|  |  |  | 			        event can be generated. | 
					
						
							|  |  |  | 				Only {args} row: and col: are used and | 
					
						
							|  |  |  | 				required. | 
					
						
							|  |  |  | 				Only results in an event when 'mousemoveevent' | 
					
						
							|  |  |  | 				is set or a popup uses mouse move events. | 
					
						
							|  |  |  | 		    cell:	Optional for the GUI: when present and TRUE | 
					
						
							|  |  |  | 				then "move" uses screen cells instead of pixel | 
					
						
							|  |  |  | 				positions.  Not used by the console. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		"key": | 
					
						
							|  |  |  | 		  Send a low-level keyboard event (e.g. keyup or keydown). | 
					
						
							|  |  |  | 		  The supported items in {args} are: | 
					
						
							|  |  |  | 		    event:	The supported string values are: | 
					
						
							|  |  |  | 				    keyup   generate a keyup event | 
					
						
							|  |  |  | 				    keydown generate a keydown event | 
					
						
							| 
									
										
										
										
											2022-12-30 16:54:58 +00:00
										 |  |  | 		    keycode:	Keycode to use for a keyup or a keydown event. | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 		    modifiers:	Optional; key modifiers. | 
					
						
							|  |  |  | 				The supported values are: | 
					
						
							|  |  |  | 				    2	shift is pressed | 
					
						
							|  |  |  | 				    4	ctrl is pressed | 
					
						
							|  |  |  | 				    8	alt is pressed | 
					
						
							|  |  |  | 				Note: These values are different from the | 
					
						
							|  |  |  | 				mouse modifiers. | 
					
						
							| 
									
										
										
										
											2022-12-30 16:54:58 +00:00
										 |  |  | 		    execute:	Optional. Similar to |feedkeys()| mode x. | 
					
						
							|  |  |  | 				When this is included and set to true | 
					
						
							|  |  |  | 				(non-zero) then Vim will process any buffered | 
					
						
							|  |  |  | 				unprocessed key events.  All other {args} | 
					
						
							|  |  |  | 				items are optional when this is set and true. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-23 23:19:02 +01:00
										 |  |  | 		"set_keycode_trans_strategy": | 
					
						
							|  |  |  | 		  |w32-experimental-keycode-trans-strategy| | 
					
						
							| 
									
										
										
										
											2024-02-19 02:51:46 +09:00
										 |  |  | 		  Switch the keycode translation method. The supported methods | 
					
						
							|  |  |  | 		  are: | 
					
						
							| 
									
										
										
										
											2024-01-23 23:19:02 +01:00
										 |  |  | 		    experimental:   The method used after Patch v8.2.4807 | 
					
						
							|  |  |  | 				    using ToUnicode() Win API call. | 
					
						
							|  |  |  | 		    classic:	    The method used pre Patch v8.2.4807 | 
					
						
							|  |  |  | 				    using the TranslateMessage() Win API call. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-30 16:54:58 +00:00
										 |  |  | 		Returns TRUE if the event is successfully added or executed, | 
					
						
							|  |  |  | 		FALSE if there is a failure. | 
					
						
							| 
									
										
										
										
											2022-12-20 20:01:58 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetEvent()->test_mswin_event({args}) | 
					
						
							|  |  |  | < | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_null_blob()					*test_null_blob()* | 
					
						
							|  |  |  | 		Return a |Blob| that is null. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_null_channel()					*test_null_channel()* | 
					
						
							|  |  |  | 		Return a |Channel| that is null. Only useful for testing. | 
					
						
							|  |  |  | 		{only available when compiled with the +channel feature} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_null_dict()					*test_null_dict()* | 
					
						
							|  |  |  | 		Return a |Dict| that is null. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-01 22:11:01 +02:00
										 |  |  | test_null_function()					*test_null_function()* | 
					
						
							| 
									
										
										
										
											2020-04-10 22:10:56 +02:00
										 |  |  | 		Return a |Funcref| that is null. Only useful for testing. | 
					
						
							| 
									
										
										
										
											2020-04-01 22:11:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_null_job()						*test_null_job()* | 
					
						
							|  |  |  | 		Return a |Job| that is null. Only useful for testing. | 
					
						
							|  |  |  | 		{only available when compiled with the +job feature} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_null_list()					*test_null_list()* | 
					
						
							|  |  |  | 		Return a |List| that is null. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_null_partial()					*test_null_partial()* | 
					
						
							|  |  |  | 		Return a |Partial| that is null. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_null_string()					*test_null_string()* | 
					
						
							|  |  |  | 		Return a |String| that is null. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_option_not_set({name})				*test_option_not_set()* | 
					
						
							|  |  |  | 		Reset the flag that indicates option {name} was set.  Thus it | 
					
						
							|  |  |  | 		looks like it still has the default value. Use like this: > | 
					
						
							|  |  |  | 			set ambiwidth=double | 
					
						
							|  |  |  | 			call test_option_not_set('ambiwidth') | 
					
						
							|  |  |  | <		Now the 'ambiwidth' option behaves like it was never changed, | 
					
						
							|  |  |  | 		even though the value is "double". | 
					
						
							|  |  |  | 		Only to be used for testing! | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetOptionName()->test_option_not_set() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | test_override({name}, {val})				*test_override()* | 
					
						
							|  |  |  | 		Overrides certain parts of Vim's internal processing to be able | 
					
						
							|  |  |  | 		to run tests. Only to be used for testing Vim! | 
					
						
							|  |  |  | 		The override is enabled when {val} is non-zero and removed | 
					
						
							|  |  |  | 		when {val} is zero. | 
					
						
							| 
									
										
										
										
											2022-01-13 22:05:09 +00:00
										 |  |  | 		Current supported values for {name} are: | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-13 22:05:09 +00:00
										 |  |  | 		{name}	     effect when {val} is non-zero ~ | 
					
						
							| 
									
										
										
										
											2022-06-30 22:13:59 +01:00
										 |  |  | 		alloc_lines  make a copy of every buffer line into allocated | 
					
						
							|  |  |  | 			     memory, so that memory access errors can be found | 
					
						
							|  |  |  | 			     by valgrind | 
					
						
							| 
									
										
										
										
											2022-01-13 22:05:09 +00:00
										 |  |  | 		autoload     `import autoload` will load the script right | 
					
						
							|  |  |  | 			     away, not postponed until an item is used | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		char_avail   disable the char_avail() function | 
					
						
							|  |  |  | 		nfa_fail     makes the NFA regexp engine fail to force a | 
					
						
							|  |  |  | 			     fallback to the old engine | 
					
						
							|  |  |  | 		no_query_mouse  do not query the mouse position for "dec" | 
					
						
							|  |  |  | 				terminals | 
					
						
							|  |  |  | 		no_wait_return	set the "no_wait_return" flag.  Not restored | 
					
						
							|  |  |  | 				with "ALL". | 
					
						
							| 
									
										
										
										
											2022-01-13 22:05:09 +00:00
										 |  |  | 		redraw       disable the redrawing() function | 
					
						
							|  |  |  | 		redraw_flag  ignore the RedrawingDisabled flag | 
					
						
							|  |  |  | 		starting     reset the "starting" variable, see below | 
					
						
							| 
									
										
										
										
											2020-06-13 15:47:25 +02:00
										 |  |  | 		term_props   reset all terminal properties when the version | 
					
						
							|  |  |  | 			     string is detected | 
					
						
							| 
									
										
										
										
											2022-01-13 22:05:09 +00:00
										 |  |  | 		ui_delay     time in msec to use in ui_delay(); overrules a | 
					
						
							|  |  |  | 			     wait time of up to 3 seconds for messages | 
					
						
							| 
									
										
										
										
											2023-05-14 21:38:12 +01:00
										 |  |  | 		unreachable  no error for code after `:throw` and `:return` | 
					
						
							| 
									
										
										
										
											2023-02-20 20:44:55 +00:00
										 |  |  | 		uptime	     overrules sysinfo.uptime | 
					
						
							| 
									
										
										
										
											2022-01-20 14:57:29 +00:00
										 |  |  | 		vterm_title  setting the window title by a job running in a | 
					
						
							|  |  |  | 			     terminal window | 
					
						
							| 
									
										
										
										
											2022-06-30 22:13:59 +01:00
										 |  |  | 		ALL	     clear all overrides, except alloc_lines ({val} is | 
					
						
							|  |  |  | 			     not used) | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		"starting" is to be used when a test should behave like | 
					
						
							|  |  |  | 		startup was done.  Since the tests are run by sourcing a | 
					
						
							|  |  |  | 		script the "starting" variable is non-zero. This is usually a | 
					
						
							| 
									
										
										
										
											2023-05-14 21:38:12 +01:00
										 |  |  | 		good thing (tests run faster), but sometimes this changes | 
					
						
							|  |  |  | 		behavior in a way that the test doesn't work properly. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		When using: > | 
					
						
							|  |  |  | 			call test_override('starting', 1) | 
					
						
							|  |  |  | <		The value of "starting" is saved.  It is restored by: > | 
					
						
							|  |  |  | 			call test_override('starting', 0) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-14 21:38:12 +01:00
										 |  |  | <		To make sure the flag is reset later using `:defer` can be | 
					
						
							|  |  |  | 		useful: > | 
					
						
							|  |  |  | 			call test_override('unreachable', 1) | 
					
						
							|  |  |  | 			defer call test_override('unreachable', 0) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | <		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetOverrideVal()-> test_override('starting') | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_refcount({expr})					*test_refcount()* | 
					
						
							|  |  |  | 		Return the reference count of {expr}.  When {expr} is of a | 
					
						
							|  |  |  | 		type that does not have a reference count, returns -1.  Only | 
					
						
							|  |  |  | 		to be used for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetVarname()->test_refcount() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | test_setmouse({row}, {col})				*test_setmouse()* | 
					
						
							|  |  |  | 		Set the mouse position to be used for the next mouse action. | 
					
						
							|  |  |  | 		{row} and {col} are one based. | 
					
						
							|  |  |  | 		For example: > | 
					
						
							|  |  |  | 			call test_setmouse(4, 20) | 
					
						
							|  |  |  | 			call feedkeys("\<LeftMouse>", "xt") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | test_settime({expr})					*test_settime()* | 
					
						
							|  |  |  | 		Set the time Vim uses internally.  Currently only used for | 
					
						
							|  |  |  | 		timestamps in the history, as they are used in viminfo, and | 
					
						
							|  |  |  | 		for undo. | 
					
						
							|  |  |  | 		Using a value of 1 makes Vim not sleep after a warning or | 
					
						
							|  |  |  | 		error message. | 
					
						
							|  |  |  | 		{expr} must evaluate to a number.  When the value is zero the | 
					
						
							|  |  |  | 		normal behavior is restored. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 18:58:44 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetTime()->test_settime() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-08 16:40:39 +01:00
										 |  |  | test_srand_seed([seed])					*test_srand_seed()* | 
					
						
							|  |  |  | 		When [seed] is given this sets the seed value used by | 
					
						
							|  |  |  | 		`srand()`.  When omitted the test seed is removed. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-29 21:55:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | test_unknown()						*test_unknown()* | 
					
						
							|  |  |  | 		Return a value with unknown type. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test_void()						*test_void()* | 
					
						
							|  |  |  | 		Return a value with void type. Only useful for testing. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | ============================================================================== | 
					
						
							| 
									
										
										
										
											2019-07-31 21:07:14 +02:00
										 |  |  | 3. Assert functions				*assert-functions-details* | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | assert_beeps({cmd})					*assert_beeps()* | 
					
						
							|  |  |  | 		Run {cmd} and add an error message to |v:errors| if it does | 
					
						
							|  |  |  | 		NOT produce a beep or visual bell. | 
					
						
							| 
									
										
										
										
											2021-04-02 18:55:57 +02:00
										 |  |  | 		Also see |assert_fails()|, |assert_nobeep()| and | 
					
						
							|  |  |  | 		|assert-return|. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetCmd()->assert_beeps() | 
					
						
							|  |  |  | < | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 							*assert_equal()* | 
					
						
							|  |  |  | assert_equal({expected}, {actual} [, {msg}]) | 
					
						
							|  |  |  | 		When {expected} and {actual} are not equal an error message is | 
					
						
							|  |  |  | 		added to |v:errors| and 1 is returned.  Otherwise zero is | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 		returned. |assert-return| | 
					
						
							|  |  |  | 		The error is in the form "Expected {expected} but got | 
					
						
							|  |  |  | 		{actual}".  When {msg} is present it is prefixed to that. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		There is no automatic conversion, the String "4" is different | 
					
						
							|  |  |  | 		from the Number 4.  And the number 4 is different from the | 
					
						
							|  |  |  | 		Float 4.0.  The value of 'ignorecase' is not used here, case | 
					
						
							|  |  |  | 		always matters. | 
					
						
							|  |  |  | 		Example: > | 
					
						
							|  |  |  | 	assert_equal('foo', 'bar') | 
					
						
							|  |  |  | <		Will result in a string to be added to |v:errors|: | 
					
						
							|  |  |  | 	test.vim line 12: Expected 'foo' but got 'bar' ~ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-10 22:00:53 +02:00
										 |  |  | 		Can also be used as a |method|, the base is passed as the | 
					
						
							|  |  |  | 		second argument: > | 
					
						
							| 
									
										
										
										
											2019-08-04 15:04:10 +02:00
										 |  |  | 			mylist->assert_equal([1, 2, 3]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <							*assert_equalfile()* | 
					
						
							| 
									
										
										
										
											2020-06-03 19:55:35 +02:00
										 |  |  | assert_equalfile({fname-one}, {fname-two} [, {msg}]) | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		When the files {fname-one} and {fname-two} do not contain | 
					
						
							|  |  |  | 		exactly the same text an error message is added to |v:errors|. | 
					
						
							|  |  |  | 		Also see |assert-return|. | 
					
						
							|  |  |  | 		When {fname-one} or {fname-two} does not exist the error will | 
					
						
							|  |  |  | 		mention that. | 
					
						
							|  |  |  | 		Mainly useful with |terminal-diff|. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 22:50:07 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetLog()->assert_equalfile('expected.log') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | assert_exception({error} [, {msg}])			*assert_exception()* | 
					
						
							|  |  |  | 		When v:exception does not contain the string {error} an error | 
					
						
							|  |  |  | 		message is added to |v:errors|.  Also see |assert-return|. | 
					
						
							|  |  |  | 		This can be used to assert that a command throws an exception. | 
					
						
							|  |  |  | 		Using the error number, followed by a colon, avoids problems | 
					
						
							|  |  |  | 		with translations: > | 
					
						
							|  |  |  | 			try | 
					
						
							|  |  |  | 			  commandthatfails | 
					
						
							|  |  |  | 			  call assert_false(1, 'command should have failed') | 
					
						
							|  |  |  | 			catch | 
					
						
							|  |  |  | 			  call assert_exception('E492:') | 
					
						
							|  |  |  | 			endtry | 
					
						
							| 
									
										
										
										
											2020-08-18 13:41:50 +02:00
										 |  |  | < | 
					
						
							|  |  |  | 							*assert_fails()* | 
					
						
							| 
									
										
										
										
											2020-09-06 21:47:48 +02:00
										 |  |  | assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		Run {cmd} and add an error message to |v:errors| if it does | 
					
						
							| 
									
										
										
										
											2020-07-11 22:14:59 +02:00
										 |  |  | 		NOT produce an error or when {error} is not found in the | 
					
						
							|  |  |  | 		error message.  Also see |assert-return|. | 
					
						
							| 
									
										
										
										
											2022-01-23 12:07:04 +00:00
										 |  |  | 							*E856* | 
					
						
							| 
									
										
										
										
											2020-07-11 22:14:59 +02:00
										 |  |  | 		When {error} is a string it must be found literally in the | 
					
						
							|  |  |  | 		first reported error. Most often this will be the error code, | 
					
						
							|  |  |  | 		including the colon, e.g. "E123:". > | 
					
						
							|  |  |  | 			assert_fails('bad cmd', 'E987:') | 
					
						
							|  |  |  | < | 
					
						
							|  |  |  | 		When {error} is a |List| with one or two strings, these are | 
					
						
							|  |  |  | 		used as patterns.  The first pattern is matched against the | 
					
						
							|  |  |  | 		first reported error: > | 
					
						
							|  |  |  | 			assert_fails('cmd', ['E987:.*expected bool']) | 
					
						
							|  |  |  | <		The second pattern, if present, is matched against the last | 
					
						
							| 
									
										
										
										
											2020-12-23 13:56:35 +01:00
										 |  |  | 		reported error. | 
					
						
							|  |  |  | 		If there is only one error then both patterns must match. This | 
					
						
							|  |  |  | 		can be used to check that there is only one error. | 
					
						
							|  |  |  | 		To only match the last error use an empty string for the first | 
					
						
							|  |  |  | 		error: > | 
					
						
							| 
									
										
										
										
											2020-07-11 22:14:59 +02:00
										 |  |  | 			assert_fails('cmd', ['', 'E987:']) | 
					
						
							|  |  |  | < | 
					
						
							| 
									
										
										
										
											2020-08-18 13:41:50 +02:00
										 |  |  | 		If {msg} is empty then it is not used.  Do this to get the | 
					
						
							|  |  |  | 		default message when passing the {lnum} argument. | 
					
						
							| 
									
										
										
										
											2022-01-29 22:20:48 +00:00
										 |  |  | 							*E1115* | 
					
						
							| 
									
										
										
										
											2020-08-18 13:41:50 +02:00
										 |  |  | 		When {lnum} is present and not negative, and the {error} | 
					
						
							|  |  |  | 		argument is present and matches, then this is compared with | 
					
						
							|  |  |  | 		the line number at which the error was reported. That can be | 
					
						
							|  |  |  | 		the line number in a function or in a script. | 
					
						
							| 
									
										
										
										
											2022-01-29 22:20:48 +00:00
										 |  |  | 							*E1116* | 
					
						
							| 
									
										
										
										
											2020-09-06 21:47:48 +02:00
										 |  |  | 		When {context} is present it is used as a pattern and matched | 
					
						
							|  |  |  | 		against the context (script name or function name) where | 
					
						
							|  |  |  | 		{lnum} is located in. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		Note that beeping is not considered an error, and some failing | 
					
						
							|  |  |  | 		commands only beep.  Use |assert_beeps()| for those. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetCmd()->assert_fails('E99:') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-18 13:41:50 +02:00
										 |  |  | assert_false({actual} [, {msg}])			*assert_false()* | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		When {actual} is not false an error message is added to | 
					
						
							|  |  |  | 		|v:errors|, like with |assert_equal()|. | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 		The error is in the form "Expected False but got {actual}". | 
					
						
							|  |  |  | 		When {msg} is present it is prepended to that. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		Also see |assert-return|. | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		A value is false when it is zero. When {actual} is not a | 
					
						
							|  |  |  | 		number the assert fails. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetResult()->assert_false() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | assert_inrange({lower}, {upper}, {actual} [, {msg}])	 *assert_inrange()* | 
					
						
							|  |  |  | 		This asserts number and |Float| values.  When {actual}  is lower | 
					
						
							|  |  |  | 		than {lower} or higher than {upper} an error message is added | 
					
						
							|  |  |  | 		to |v:errors|.  Also see |assert-return|. | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 		The error is in the form "Expected range {lower} - {upper}, | 
					
						
							|  |  |  | 		but got {actual}".  When {msg} is present it is prefixed to | 
					
						
							|  |  |  | 		that. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 								*assert_match()* | 
					
						
							|  |  |  | assert_match({pattern}, {actual} [, {msg}]) | 
					
						
							|  |  |  | 		When {pattern} does not match {actual} an error message is | 
					
						
							|  |  |  | 		added to |v:errors|.  Also see |assert-return|. | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 		The error is in the form "Pattern {pattern} does not match | 
					
						
							|  |  |  | 		{actual}".  When {msg} is present it is prefixed to that. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		{pattern} is used as with |=~|: The matching is always done | 
					
						
							|  |  |  | 		like 'magic' was set and 'cpoptions' is empty, no matter what | 
					
						
							|  |  |  | 		the actual value of 'magic' or 'cpoptions' is. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		{actual} is used as a string, automatic conversion applies. | 
					
						
							|  |  |  | 		Use "^" and "$" to match with the start and end of the text. | 
					
						
							|  |  |  | 		Use both to match the whole text. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Example: > | 
					
						
							|  |  |  | 	assert_match('^f.*o$', 'foobar') | 
					
						
							|  |  |  | <		Will result in a string to be added to |v:errors|: | 
					
						
							|  |  |  | 	test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			getFile()->assert_match('foo.*') | 
					
						
							| 
									
										
										
										
											2021-04-02 18:55:57 +02:00
										 |  |  | < | 
					
						
							|  |  |  | assert_nobeep({cmd})					*assert_nobeep()* | 
					
						
							|  |  |  | 		Run {cmd} and add an error message to |v:errors| if it | 
					
						
							|  |  |  | 		produces a beep or visual bell. | 
					
						
							|  |  |  | 		Also see |assert_beeps()|. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetCmd()->assert_nobeep() | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | < | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 							*assert_notequal()* | 
					
						
							|  |  |  | assert_notequal({expected}, {actual} [, {msg}]) | 
					
						
							|  |  |  | 		The opposite of `assert_equal()`: add an error message to | 
					
						
							|  |  |  | 		|v:errors| when {expected} and {actual} are equal. | 
					
						
							|  |  |  | 		Also see |assert-return|. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-04 15:04:10 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			mylist->assert_notequal([1, 2, 3]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <							*assert_notmatch()* | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | assert_notmatch({pattern}, {actual} [, {msg}]) | 
					
						
							|  |  |  | 		The opposite of `assert_match()`: add an error message to | 
					
						
							|  |  |  | 		|v:errors| when {pattern} matches {actual}. | 
					
						
							|  |  |  | 		Also see |assert-return|. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			getFile()->assert_notmatch('bar.*') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 22:50:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | assert_report({msg})					*assert_report()* | 
					
						
							| 
									
										
										
										
											2021-08-14 21:25:52 +02:00
										 |  |  | 		Report a test failure directly, using String {msg}. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 		Always returns one. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 22:50:07 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetMessage()->assert_report() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | assert_true({actual} [, {msg}])				*assert_true()* | 
					
						
							|  |  |  | 		When {actual} is not true an error message is added to | 
					
						
							|  |  |  | 		|v:errors|, like with |assert_equal()|. | 
					
						
							|  |  |  | 		Also see |assert-return|. | 
					
						
							|  |  |  | 		A value is TRUE when it is a non-zero number.  When {actual} | 
					
						
							|  |  |  | 		is not a number the assert fails. | 
					
						
							| 
									
										
										
										
											2023-05-14 18:50:25 +01:00
										 |  |  | 		When {msg} is given it precedes the default message. | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 21:49:22 +02:00
										 |  |  | 		Can also be used as a |method|: > | 
					
						
							|  |  |  | 			GetResult()->assert_true() | 
					
						
							|  |  |  | < | 
					
						
							| 
									
										
										
										
											2019-07-21 16:42:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |  vim:tw=78:ts=8:noet:ft=help:norl: |